Skip to content

fix(coding-agent): avoid transcript scans for exact session IDs - #9601

Open
metaist wants to merge 1 commit into
earendil-works:mainfrom
metaist:fix/session-id-transcript-scan
Open

metaist wants to merge 1 commit into
earendil-works:mainfrom
metaist:fix/session-id-transcript-scan

Conversation

@metaist

@metaist metaist commented Sep 14, 2026

Copy link
Copy Markdown

@davidbrai
Fixes #9440

  • Uses an exact session-ID lookup to read session headers instead of loading the whole transcript. I did compare keeping the async contract vs doing it sync and the latter was better for subsequent cache hits, so I dropped the async bits.
  • Quick microbenchmark showed ~19.5x reduction in lookup time (68.1s -> 3.5s). Still linear in the number of transcripts, but tolerable for now.

Ran npm run check and ./test.sh which passed.

@holny

holny commented Sep 15, 2026

Copy link
Copy Markdown

Checked the diff against the existing discovery code: the filterCwd condition in findById matches list() (session-manager.ts:1672) and continueRecent() (:1591) verbatim, so exact-id lookups in a custom --session-dir stay consistent with how those filter by cwd. readSessionHeaderForDiscovery is the same bounded header scan findMostRecentSession() uses, and files exceeding the scan limit are skipped exactly like in list(), so corrupt/oversized sessions behave the same as before. The vi.spyOn(SessionManager, "list") in the regression test is a neat way to pin the no-full-listing contract.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--session-id with fresh id scans all transcripts

2 participants