Skip to content

aggregator(record-claude-launch): empty flag values are recorded verbatim — '--id ""' appends a session with no id, '--parent ""' a parent that is not null, exit 0 #6895

Closed

Description

@dezren39

Problem

pm-stack/aggregator/scripts/record-claude-launch.ts: the #3415 guard in valueAfter (:35-41) refuses a missing value and a value that is itself a flag, but it does not refuse an empty (or whitespace-only) value. Its settled siblings do: post-alert.ts:131 and collect-fleet-feed.ts:231 both check value === "", and append-usage-snapshots.ts (resolveObservedBy) checks value.trim() === "". This script is the one value-taking CLI in the set whose guard omits the empty case, so empty strings flow into the appended launch record verbatim, with exit 0.

Evidence (verified this run, laptop @ 4cd2927, real script, --file pointed at a probe file)

Probe: ~/git/fleet/probe-launch-empty/ (real record-claude-launch.ts run via bun run, control first):

  • Control --label "Control" → record with a generated claude-… id, parentId: null, status: "launched", rc 0.
  • --label "EmptyId" --id "" → rc 0, appended record is {"id":"", …} — an identity record with no identity.
  • --label "EmptyParentStatus" --parent "" --status "" → rc 0, appended record carries "parentId":"" (instead of the null the default produces) and "status":"".
  • --id " " → rc 0, "id":" ". --label " " → rc 0, a session whose display name is a single space (the !label check at :54 catches only the empty string).
  • --file "" → not a usage error at all: raw ENOENT stack from appendFile(""), rc 1, no message naming the flag.

Why it matters

The collector's reader accepts these records: parseLaunchRecords (pm-stack/aggregator/src/registry.ts:105) admits any record whose id is a string — "" qualifies — and the registry merge keys records by (source, id) (:133-135). Every session ever recorded with --id "" therefore collides on the same merge key and folds into a single phantom registry entry, silently losing those sessions' task↔session linkage (the file's stated purpose, script header :5-11); a parentId of "" likewise points at that phantom instead of meaning "no parent". Because the script exits 0 and prints the usual recorded … line, a launcher passing an unset shell variable (--id "$SESSION_ID") gets no signal that it just registered a nameless session.

Acceptance criteria

Activity

  1. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor
  2. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    source/creatorFiled by the new-issue-creator job
    work/self-assignedAn agent grabbed this item directly, outside the queue
    priority/lowNice to have; do when convenient
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    effort/xsTrivial: expected under 30 minutes of work
    on Nov 7, 2026
  3. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: filed
    agent: new-issue-creator-code-b
    Found via: filed this run — verified on the laptop @ 4cd2927 with the real script (probe ~/git/fleet/probe-launch-empty): --id "" appends {"id":"", …} rc 0, --parent ""/--status "" recorded verbatim, --file "" raw ENOENT stack. Residual door of closed #3415 (flag-as-value): the empty-value case its guard omitted, which both sibling guards (post-alert.ts:131, collect-fleet-feed.ts:231) do check.
    Disposition: guarded self-solve this run (trivial, one guard function + pinning test) — work/self-assigned + status/in-progress instead of the queued labels; no queue packet per the self-solve path.

  4. added a commit that references this issue on Nov 7, 2026
  5. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: done
    agent: new-issue-creator-code-b
    Fixed and merged this run: PR #6896 (branch creator-b/6895-record-launch-empty-values, commit 8cdf874) — valueAfter now refuses empty/whitespace-only values via the usage-error path (exit 2, nothing appended) for every value-taking flag, matching the sibling guards; pinning test record-claude-launch-empty-value-6895.test.ts added beside the #3415 test.
    Verification: laptop bun test on the branch and again on merged origin/main — 4 pass / 0 fail across the new + #3415 test files. Issue closed by the PR's Fixes marker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/aggregatorPackage/app: aggregator (pm-stack in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobstatus:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions