Repository navigation
Description
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
registrysection (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) callsr.status.toLowerCase(), andsessionRecordLinecalls it whenever identities are present.tokensTotal—renderSessionssums it arithmetically (render.ts:4816, printed as the page total atrender.ts:4864) andsessionRecordLineformats it withtoLocaleString()(render.ts:1810).agentId/agentLabel— required fields onSessionRecord(model.ts:1093-1095);identitiesFromRecords(registry.ts:184-192) interpolatesagentLabelinto 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:
- Status-less record passes, render crashes.
{...valid}withstatusdeleted →isSessionRecordreturnstrue;sessionRecordIsLivethrowsTypeError: undefined is not an object (evaluating 'r.status.toLowerCase'), andsessionRecordLine(record, { identities })throws the same — one poisoned record takes down the sessions-page render instead of dropping at the gate. - Non-string status passes, same crash.
status: 42→ gatetrue;sessionRecordIsLivethrowsTypeError: r.status.toLowerCase is not a function. - String
tokensTotalpoisons the page total.tokensTotal: "5000"→ gatetrue;renderSessionsprints05000 tokens recorded(the reduce atrender.ts:4816string-concatenates) instead of a numeric total. - Infinite
tokensTotalpasses via ordinary JSON.JSON.parse('{"tokensTotal":1e999, ...}')yieldsInfinity→ gatetrue; the page prints ∞ tokens recorded and the record line shows· ∞ tok. - Negative and object
tokensTotalpass.-500→ gatetrue(a negative cumulative total silently reduces the page sum for a singleton record;mergeRecords'Math.maxonly repairs the duplicate-key path).{x:1}→ gatetrue; the line renders· [object Object] tokand the page total is poisoned to a string. - The launch-JSONL path admits all of it.
parseLaunchRecords('{"id":"launch1","label":"L","status":42,"tokensTotal":"9000"}')returns 1 record with numericstatusand stringtokensTotal— the gate is the only filter on that path. - Missing agent identity passes. A record with
agentId/agentLabeldeleted → gatetrue;identitiesFromRecordsrenders its label withundefinedinterpolated.
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
isSessionRecordrejects a record whosestatusis absent or not a string, whoseagentId/agentLabelare absent or not strings, and whosetokensTotalis present but not a finite number ≥ 0 — following the validator-owns-the-rule precedent in the aggregator(registry): non-string lastSeenAt passes isSessionRecord and crashes mergeRecords sort — /sessions and /api/registry.json fail once the registry grows #2376/aggregator(registry): non-array taskRefs passes isSessionRecord and crashes mergeRecords' spread — a string one silently splits into single-character refs #2408 comments (reject the record; never coerce).- Well-formed records from both real producers (
recordFromSessionEntry,recordFromLaunch) pass unchanged, including a record withtokensTotalabsent. - The aggregator(registry): non-string lastSeenAt passes isSessionRecord and crashes mergeRecords sort — /sessions and /api/registry.json fail once the registry grows #2376/aggregator(registry): non-array taskRefs passes isSessionRecord and crashes mergeRecords' spread — a string one silently splits into single-character refs #2408 hygiene tests' minimal fixture (
{id, source, label}) is updated to the new contract (it currently asserts a status-less record passes,test/registry-hygiene-2376.test.ts:40), and new regression tests cover: missing status, numeric status, string/Infinity (1e999)/negative/objecttokensTotal, and the launch-JSONL admission path. - A poisoned record in the store/feed/JSONL drops individually; the sessions page renders and its token total stays numeric.
- Note: the aggregator suite cannot run cleanly on current main until the
feed.tsparse break (aggregator(feed): feed.ts does not parse — isUnmatchedCharge is missing its closing brace (merged in 4d7f643e3, #2445) #3452) lands; sequence after it if needed.
Distinct from
- aggregator(registry): non-string lastSeenAt passes isSessionRecord and crashes mergeRecords sort — /sessions and /api/registry.json fail once the registry grows #2376 (closed):
lastSeenAt/startedAttimestamp types in this same gate. - aggregator(registry): non-array taskRefs passes isSessionRecord and crashes mergeRecords' spread — a string one silently splits into single-character refs #2408 (closed):
taskRefsshape in this same gate. - aggregator(feed): feed.ts does not parse — isUnmatchedCharge is missing its closing brace (merged in 4d7f643e3, #2445) #3452 (open):
feed.tsparse breakage — unrelated, but it gates running the suite.
Activity
developing-today commentedon Nov 1, 2026
CODE-1352
dezren39 commentedon Nov 1, 2026
🤖 Agent note · filed
25 remaining items
dezren39 commentedon Nov 3, 2026
Triage pickup. Coverage pass flagged a label/queue desync — checking agent notes for live work first, then verifying on main.
dezren39 commentedon Nov 3, 2026
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.
mainjust now:isSessionRecord(pm-stack/aggregator/src/registry.ts) still checks onlyid/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) andtaskRefs(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) — nostatus/agentId/agentLabel/tokensTotalchecks. Fix NOT landed.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).work/assigned+queue/claimed+status/in-progresscorrectly 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.
developing-today commentedon Nov 3, 2026
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
dezren39 commentedon Nov 3, 2026
🤖 Agent note · picked up
Merge pull request #5107 from developing-today/queue/8469-3525-sessio…
dezren39 commentedon Nov 3, 2026
🤖 Agent note · done