Skip to content

aggregator(registry): isSessionRecord never checks status, agentLabel or tokensTotal — a status-less record crashes the sessions page and a string/Infinity tokensTotal poisons the page token total #3525

Closed

Description

@dezren39

Problem

isSessionRecord (pm-stack/aggregator/src/registry.ts:155-175) is the only hygiene gate on every path that admits a session-registry record from parsed JSON:

  • the durable registry store file (pm-stack/aggregator/src/sources/live.ts:654, parsed.filter(isSessionRecord))
  • the feed's registry section (live.ts:1094)
  • Muse launch-record JSONL (registry.ts:93-105, parseLaunchRecords → recordFromLaunch → isSessionRecord)

It validates id/source/label, the two timestamps (#2376) and taskRefs (#2408) — but it never checks three fields its consumers dereference unconditionally:

  • status — sessionRecordIsLive (render.ts:1470-1473) calls r.status.toLowerCase(), and sessionRecordLine calls it whenever identities are present.
  • tokensTotal — renderSessions sums it arithmetically (render.ts:4816, printed as the page total at render.ts:4864) and sessionRecordLine formats it with toLocaleString() (render.ts:1810).
  • agentId / agentLabel — required fields on SessionRecord (model.ts:1093-1095); identitiesFromRecords (registry.ts:184-192) interpolates agentLabel into the identity label.

No real producer can emit the bad shapes: recordFromSessionEntry (registry.ts:31-55) always builds a string status and string agent identity, and tokensTotal comes from the numeric tokensBySession map; recordFromLaunch (registry.ts:73-90) defaults status to "launched". The exposure is exactly the one #2376/#2408 were filed for: a poisoned store file, feed section, or hand-edited launch JSONL line reaches the renderers unchecked.

Verified (laptop probe, real sources at main 690c550a, sha256-matched registry.ts/render.ts; probe copy of feed.ts differs only by the missing brace tracked in #3452)

Probe: ~/git/fleet/probe-2026-11-01-laneB-sessionrecord/ (probe-run.log). Control record (all fields well-formed) passes the gate and sessionRecordIsLive returns true. Then:

  1. Status-less record passes, render crashes. {...valid} with status deleted → isSessionRecord returns true; sessionRecordIsLive throws TypeError: undefined is not an object (evaluating 'r.status.toLowerCase'), and sessionRecordLine(record, { identities }) throws the same — one poisoned record takes down the sessions-page render instead of dropping at the gate.
  2. Non-string status passes, same crash. status: 42 → gate true; sessionRecordIsLive throws TypeError: r.status.toLowerCase is not a function.
  3. String tokensTotal poisons the page total. tokensTotal: "5000" → gate true; renderSessions prints 05000 tokens recorded (the reduce at render.ts:4816 string-concatenates) instead of a numeric total.
  4. Infinite tokensTotal passes via ordinary JSON. JSON.parse('{"tokensTotal":1e999, ...}') yields Infinity → gate true; the page prints ∞ tokens recorded and the record line shows · ∞ tok.
  5. Negative and object tokensTotal pass. -500 → gate true (a negative cumulative total silently reduces the page sum for a singleton record; mergeRecords' Math.max only repairs the duplicate-key path). {x:1} → gate true; the line renders · [object Object] tok and the page total is poisoned to a string.
  6. The launch-JSONL path admits all of it. parseLaunchRecords('{"id":"launch1","label":"L","status":42,"tokensTotal":"9000"}') returns 1 record with numeric status and string tokensTotal — the gate is the only filter on that path.
  7. Missing agent identity passes. A record with agentId/agentLabel deleted → gate true; identitiesFromRecords renders its label with undefined interpolated.

Why it matters

The registry store is durable and self-perpetuating: once a malformed record is merged in, mergeIntoRegistry writes it back to the store file, so a single bad feed section or launch line permanently (a) crashes the sessions page (missing/non-string status), or (b) falsifies the fleet-wide token total every reader sees (string/Infinity/object tokensTotal). This is the same failure family the gate already owns for timestamps (#2376, fixed) and taskRefs (#2408, fixed); these three fields were simply missed.

Acceptance criteria

Distinct from

Activity

  1. developing-today commented on Nov 1, 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
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/lowNice to have; do when convenient
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 1, 2026
  3. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-b (Lane B, new-issue-creator-code-b job)
    • Session / ID: new-issue-creator-code-b run 2026-11-01 05:20 CST (2026-11-01T11:20Z scheduled)
    • Found via: filed this run
    • Task: Filed after verifying on the laptop with the real aggregator sources at main 690c550 (sha256-matched registry.ts/render.ts): isSessionRecord admits status-less/non-string-status records that crash sessionRecordIsLive/sessionRecordLine, and string/Infinity/negative/object tokensTotal that poison the sessions-page token total; producers (recordFromSessionEntry/recordFromLaunch) never emit these shapes — the store/feed/launch-JSONL JSON paths are gated only by this validator. Probe: ~/git/fleet/probe-2026-11-01-laneB-sessionrecord/ (probe copy of feed.ts differs only by the aggregator(feed): feed.ts does not parse — isUnmatchedCharge is missing its closing brace (merged in 4d7f643e3, #2445) #3452 brace).
    • Expectation: effort/s — triage confirms on current main and routes the gate fix per the issue's acceptance criteria.
    • Links: queue packet packets/packet-3525-triage.json (repo-health-code-pilot)
  4. added
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    queue/claimedQueue worker lifecycle state
    and removed on Nov 1, 2026
  5. 25 remaining items

  6. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor
    state: picked-up
    task: 7428
    queue: repo-health-code-pilot
    worker: repo-worker-code
    lane: 335a5d1f-bfc1-4831-99ea-850c8939a727
    at: 2026-11-03T10:53:00Z
    

    Triage pickup. Coverage pass flagged a label/queue desync — checking agent notes for live work first, then verifying on main.

  7. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor
    state: triaged-duplicate-tracking
    task: 7428
    queue: repo-health-code-pilot
    worker: repo-worker-code
    lane: 335a5d1f-bfc1-4831-99ea-850c8939a727
    at: 2026-11-03T10:56:00Z
    verdict: confirmed-open, fix in flight under task 6148
    

    Triage verdict: bug CONFIRMED still present on current main; fix is genuinely in flight — closing this coverage task as duplicate-tracking, no action on the issue.

    1. Bug re-verified on current main just now: isSessionRecord (pm-stack/aggregator/src/registry.ts) still checks only id/source/label, string-or-absent timestamps (aggregator(registry): non-string lastSeenAt passes isSessionRecord and crashes mergeRecords sort — /sessions and /api/registry.json fail once the registry grows #2376) and taskRefs (aggregator(registry): non-array taskRefs passes isSessionRecord and crashes mergeRecords' spread — a string one silently splits into single-character refs #2408/aggregator(registry): malformed taskRefs elements pass every gate and crash /sessions at render — an array of bad refs merges, persists, then refUrl throws #2485/aggregator(registry): isSessionRecord admits a record with taskRefs absent — merge keeps it undefined and the registry query/render path throws #4284) — no status/agentId/agentLabel/tokensTotal checks. Fix NOT landed.
    2. Fix task 6148 is live: handed to the opencode execution lane and launched ~3h ago (ses_e5e5f97d7f4ffeHja6SdHpN3Fq, worker verified responding at 07:57Z). No branch/PR yet, but 3h with no artifact is normal mid-fix time, and there is no contrary signal (no fail/block note, no competing PR).
    3. Labels already match reality: work/assigned + queue/claimed + status/in-progress correctly reflect the in-flight fix — leaving them untouched for the owning lane.

    No duplicate fix enqueued, nothing closed. This task completes so the next coverage pass sees one live fix path, not two.

  8. added
    user/reviewNeeds a user-look: Muse reviews first and handles what it can
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 3, 2026
  9. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 30 (priority/low). Stale queue/claimed label removed — it had no live task behind it. If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

  10. added
    queue/claimedQueue worker lifecycle state
    and removed on Nov 3, 2026
  11. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  12. added a commit that references this issue on Nov 3, 2026
  13. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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

Metadata

Metadata

Assignees

Labels

app/aggregatorPackage/app: aggregator (pm-stack in this repo)app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/sSmall: expected under 2 hours 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 jobtask/triageQueue packet kind: verify, reproduce, and route this itemuser/reviewNeeds a user-look: Muse reviews first and handles what it can

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions