GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — aggregator(registry): non-string lastSeenAt passes isSessionRecord and crashes mergeRecords sort — /sessions and /api/registry.json fail once the registry grows · Issue #2376 · developing-today/code

aggregator(registry): non-string lastSeenAt passes isSessionRecord and crashes mergeRecords sort — /sessions and /api/registry.json fail once the registry grows #2376

New issue
Copy link
New issue
Copy link
Closed
#3414
Closed
aggregator(registry): non-string lastSeenAt passes isSessionRecord and crashes mergeRecords sort — /sessions and /api/registry.json fail once the registry grows#2376
#3414
Copy link
Assignees
dezren39
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/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

Description

@dezren39
dezren39
opened on Oct 29, 2026
Issue body actions

aggregator(registry): a non-string lastSeenAt passes isSessionRecord and crashes mergeRecords' sort — /sessions and /api/registry.json go down once the registry is big enough

Bug

The session registry's hygiene check validates only three fields, but the merge that every live registry read runs sorts on a fourth, unchecked field with a string-only method:

  • pm-stack/aggregator/src/registry.ts:138-142 — isSessionRecord checks only id, source, and label are strings. lastSeenAt (and startedAt) may be any JSON value: a number, a boolean, an object.
  • pm-stack/aggregator/src/registry.ts:134 — mergeRecords returns [...byKey.values()].sort((a, b) => (b.lastSeenAt ?? "").localeCompare(a.lastSeenAt ?? "")). localeCompare exists only on strings, so a record whose lastSeenAt is e.g. 12345 throws TypeError: (b.lastSeenAt ?? "").localeCompare is not a function whenever the sort compares it in that position.
  • The unchecked value reaches the merge from three directions, all filtered only by isSessionRecord: the durable store file (sources/live.ts:611, loadRegistryStore), the fleet feed's registry section (sources/live.ts:980), and Claude launch records (registry.ts:82, recordFromLaunch copies l.lastSeenAt verbatim; parseLaunchRecords checks only that id is a string).

registry() (sources/live.ts:976-1000) calls mergeIntoRegistry → mergeRecords (sources/live.ts:619) with no guard around it whenever any incoming record exists. The callers split: /sessions and /api/registry.json await source.registry() uncaught (server.ts:543, server.ts:552), so the request fails; the facet-priming callers catch and silently substitute [] (server.ts:147, :160, :744), so the registry reads as empty there.

Evidence (verified this run, main 5a34fa7)

Sandbox Bun probe (/tmp/probe-laneB-regsort/probe.ts, probe2.ts) importing the real registry.ts:

isSessionRecord(good)= true
isSessionRecord(badNum)= true      (lastSeenAt: 12345)
isSessionRecord(badBool)= true     (lastSeenAt: true)
good+missing OK                    (lastSeenAt absent is fine: ?? "" )
big THROWS TypeError (b.lastSeenAt ?? "").localeCompare is not a function
rev THROWS TypeError (same, reversed input order)

The latency is part of the bug: with only two records Bun's sort happened to compare in the direction that coerces the number as the localeCompare argument, so a small registry can accept — and mergeIntoRegistry can persist (sources/live.ts:627-631) — a poisoned record without error. The same record throws reliably once the registry holds several records (8-record probe, both input orders). The durable store therefore accumulates the trigger silently and the failure switches on later, on an unrelated read, once enough sessions exist.

Why it matters

One malformed record — a hand-edited or torn store file, a collector/feed entry with a numeric epoch instead of an ISO string, a launch-record line with a numeric lastSeenAt — permanently breaks the registry surface: every live /sessions and /api/registry.json request fails while that record is present, and there is no signal about which record or field is responsible. The neighbouring stores learned this exact lesson in #2347 (comments/actions: load filter checked only id, all() sorted via createdAt.localeCompare); the registry's filter is the same shape with a different field. This is distinct from #1560 (same file: sparse incoming records wipe fields via undefined spread — a data-loss semantics bug, no type check or crash involved) and its acceptance criteria do not cover this.

Acceptance criteria

  • A record with a missing or non-string lastSeenAt can no longer crash mergeRecords: either isSessionRecord rejects/coerces it at both load sites (store + feed), or the sort (and the >= newest-comparison at registry.ts:131) treats a non-string value as absent — the triage pin records which layer owns the rule, applied consistently to recordFromLaunch's unchecked copy as well.
  • A poisoned record already in the durable store does not wedge the registry: /sessions and /api/registry.json keep serving the remaining records.
  • Regression tests (aggregator suite, e.g. test/slice3.test.ts) cover: mergeRecords over several records including one with numeric and one with boolean lastSeenAt, and a store/feed load containing such a record; existing merge tests keep passing.
  • No behaviour change for well-formed records: newest-lastSeenAt ordering and the merge special cases from aggregator: registry merge wipes a session's model/title/directory when a later sparse record omits them — the durable store forgets what it knew #1560's contract are preserved.

Related

  • aggregator(comments+actions): a store record that passes the load filter but lacks a string createdAt crashes every comments/actions read — and persist() re-writes it forever #2347 — same load-filter/sort-field mismatch in the comments + actions stores (createdAt), different stores and validator.
  • aggregator: registry merge wipes a session's model/title/directory when a later sparse record omits them — the durable store forgets what it knew #1560 — mergeRecords field-wipe on sparse records; different defect in the same function (spread semantics, not unchecked types).
  • aggregator: concurrent writes to the JSON stores share one temp path — most fail with ENOENT (returned as '400 invalid'), and persisted records don't match the calls that succeeded #1509 — registry store write atomicity; unrelated.

Activity

Next
  1. developing-today commented on Oct 29, 2026

    @developing-today
    developing-todayBot
    on Oct 29, 2026 – with developing.today
    Contributor
    More actions

    CODE-1205

  2. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    effort/xsTrivial: expected under 30 minutes of work
    on Oct 29, 2026
  3. dezren39 commented on Oct 29, 2026

    @dezren39
    dezren39
    on Oct 29, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator (new-issue-creator-code-b)
    • Session / ID: new-issue-creator-code-b run 2026-10-29T16:35Z (11:35 CDT)
    • Found via: filed this run
    • Task: Filed this issue after verifying against the real registry.ts on the sandbox (Bun probe /tmp/probe-laneB-regsort/, main 5a34fa7): isSessionRecord accepts lastSeenAt 12345 / true; mergeRecords over 8 records (both orders) throws TypeError: (b.lastSeenAt ?? "").localeCompare is not a function, while a 2-record merge happens not to throw — a poisoned record can be persisted by mergeIntoRegistry and only wedges /sessions later as the registry grows. Enqueued as a triage packet on repo-health-code-pilot.
    • Expectation: effort/xs triage — pin which layer owns the rule (isSessionRecord at both load sites vs a type-tolerant sort/newest comparison, including recordFromLaunch's unchecked copy), then route a small_fix with multi-record regression tests.
    • Links: issue body evidence file (goal hidden_files/issue-code-registry-lastseen-sort-body.md); related aggregator(comments+actions): a store record that passes the load filter but lacks a string createdAt crashes every comments/actions read — and persist() re-writes it forever #2347 (same shape, comments/actions stores), aggregator: registry merge wipes a session's model/title/directory when a later sparse record omits them — the durable store forgets what it knew #1560 (same function, field-wipe semantics — distinct defect)
  4. github-actions
    assigned
    dezren39
    on Oct 29, 2026
  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 1, 2026
  6. 9 remaining items

  7. dezren39
    added
    status/in-progressQueue worker lifecycle state
    on Nov 1, 2026
  8. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane E
    • Session / ID: queue task 5253
    • Found via: queue claim
    • Task: Fix aggregator(registry): non-string lastSeenAt passes isSessionRecord and crashes mergeRecords sort — /sessions and /api/registry.json fail once the registry grows #2376 — isSessionRecord must reject present-but-non-string lastSeenAt/startedAt, and the launch-record path gets the same validation; regression tests for store/feed/launch poisoned records.
    • Expectation: effort xs/s; done = PR opened and merged with tests green, issue closed.
    • Links: queue task 5253 (follow-up of triage task 3537)
  9. developing-today
    added
    status:in-review
    on Nov 1, 2026
  10. dezren39
    added
    queue/needs-reviewQueue task finished and is awaiting review
    status/needs-reviewReady for review
    and removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    on Nov 1, 2026
  11. dezren39
    added a commit that references this issue on Nov 1, 2026

    Merge pull request #3414 from developing-today/queue/5253-2376-regist…

    1d6e3e4
  12. dezren39
    closed this as completedin #3414on Nov 1, 2026
  13. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 1, 2026
  14. dezren39
    removed
    status/needs-reviewReady for review
    queue/needs-reviewQueue task finished and is awaiting review
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
  15. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane E
    • Session / ID: queue task 5253
    • Found via: queue claim
    • Task: Fix aggregator(registry): non-string lastSeenAt passes isSessionRecord and crashes mergeRecords sort — /sessions and /api/registry.json fail once the registry grows #2376 — hygiene filter rejects non-string lastSeenAt/startedAt; launch path validated the same way.
    • Expectation: done = PR merged, issue closed.
    • Links: PR aggregator(registry): reject non-string lastSeenAt/startedAt at the hygiene filter (#2376) #3414 (merged, 1d6e3e427) · branch queue/5253-2376-registry-lastseenat-filter

    Done. isSessionRecord now requires lastSeenAt/startedAt to be string-or-absent (rejection, not coercion), and parseLaunchRecords routes its output through the same filter. New test/registry-hygiene-2376.test.ts: poisoned records (numeric/boolean/object) dropped on the store/feed filter path and the launch path, survivors merge/sort unchanged. Verified on the laptop: 46/46 tests pass (6 new + slice3 + registry-view), tsc clean for touched files, Codex review completed with no findings.

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

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

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/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.