Repository navigation
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
A fix for a regression in #17832's remote parse-cache half: Codex titles live in session_index.jsonl, which the remote cache's (mtimeMs, sizeBytes, hostKey) key does not measure, so a cache hit froze the fallback title forever.
- Shared staleness rule —
session-scanner-codex-cached-title.tsextracts an IO-freerefreshCodexTitleFromIndex(session, readIndexedTitle)core; the localrefreshCachedCodexTitlebecomes a byte-identical wrapper. - Remote reader factory —
remoteCodexIndexedTitleReader(codexHome, context)reuses the scan-scopedtitleCachespath, so parse and reuse provably read the same index map. - Reuse-path refresh —
parseRemoteSessionFileCachedgains an optionalrefreshReusedSessionhook, applied only on cache hit and written back into the entry;reusedCodexTitleRefreshwires it for Codex candidates only. - Regression test — proves a title written after the transcript was cached is picked up on the next scan while the transcript itself is not re-read.
The test is real coverage, not theatre: without the fix it fails with expected 'First prompt' to be 'Named by Codex after the fact', and it fails today on src/main/ai-vault/remote-session-parse-cache.test.ts if refreshReusedSession is omitted. Verified the hostPlatform source in the new reader is identical to the old closure's (context.hostPlatform === args.hostPlatform), that no new heavy dependency is dragged into the remote bundle, and that the cached entry stays free of subagentTranscriptCount (it is re-applied post-cache).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
ccd3b8d to
030916e
Compare
|
Folded into #17832 and closing here. This fix is not an enhancement on top of that PR — it repairs a user-visible regression #17832 introduces. Before the remote parse cache, the scanner re-parsed every transcript on the renderer's 30 s forced rescan, so a Codex title written into Landing it as a stacked PR would put a commit on So the whole change — the Nothing is lost; review it at #17832. |

An adversarial review found a regression in #17832's vault half (#13753's parse cache).
The bug: derived content from a file the cache key does not measure
Codex session titles are not in the rollout transcript — they are in
~/.codex/session_index.jsonl, read by a callback that runs insidesource.parse. The cache keys on the transcript's(mtimeMs, sizeBytes, hostKey)and justified that as sound "because discovery already folds a source'scontentDependencyPathstat into both fields".The codex sources declare no
contentDependencyPath, so that argument never covered them. On a cache hitparse()never runs, the index is never read, and the title freezes at whatever the first parse produced. Codex writes the title asynchronously, after the rollout is created — so a session that gets named after its last transcript append keeps its fallback title indefinitely.The local scanner already solved this.
refreshCachedCodexTitleexists as its own module solely to defeat this staleness, called on the local cache's reuse path. The remote cache calls itself "its remote counterpart" in a comment and shipped without it. This is divergence between two things meant to be the same.The fix: share the module, do not pair a copy
session-scanner-codex-cached-title.tsnow exports the staleness rule as an IO-free core, with the local disk reader kept as a wrapper:Injecting the reader is what lets both sides share one implementation — a direct import of the remote reader would have dragged
../ssh/ssh-remote-platforminto the local scanner worker's bundle, so the callback is the seam. The local call site is byte-identical to before.remote-session-scanner-sources.tsnow builds its parser'sreadIndexedTitlefrom the same exportedremoteCodexIndexedTitleReaderthe refresh uses (the inline closure is deleted), so parse and refresh provably read the same map. The refreshed title is written back into the cache entry, matching the local behaviour.The #13753 win is preserved:
context.titleCachesis scan-scoped, so this is onesession_index.jsonlread per CODEX_HOME per scan, shared with the parse path. No transcript is re-read — the new test assertsprovider.readFilePathsis empty.The test gap mattered as much as the bug
The suite could not have caught this by construction:
CountingRemoteProviderfilters to/sessions/, andsession_index.jsonlsits outside it, so it was invisible to every assertion — while every fixture is a Codex rollout, i.e. the suite is built on the one agent whose title path the cache breaks and then filters that path out of what it measures.The new test asserts both halves — new title and zero transcript reads — so a "fix" that merely invalidated the cache entry would fail it.
The
/sessions/filter is left alone — it is the right instrument for the corpus term, and the new zero-read assertion depends on the index staying outside it. The filter was never the bug; the missing assertion was.Subagent-count verdict: the review was right, remote is correct
remote-session-scanner.ts:249-252re-appliessubagentTranscriptCounton every return, hit or miss, from a value discovery recomputes each scan. Airtight for two reasons: the spread builds a new object and never writes back intoentry.session, so the cached row stays count-free; and the> 0guard cannot strand a stale non-zero count because the remote parse always produces0(countSubagentTranscriptsis gated behindownsTranscriptDisk, false for SSH). A 3 → 0 transition correctly falls through.Other local/remote divergences, checked and left
invalidateSessionParseCacheEntryon the remote cache. Benign for the reason the local comment gives — discovery walks first, so a deleted file is never rediscovered — but a deleted remote transcript occupies an LRU slot until evicted.readFilehas no ranged read. Intentional.contentDependencyPath; cline and opencode likewise declare theirs.Verification
pnpm test src/main/ai-vault/— 77 files, 494 tests passed.pnpm tc:nodeclean.check:code-quality:changed0 new findings.A first draft pushed
session-scanner-parse-cache.tsone line over themax-linesceiling. Rather than bump or disable it (prohibited), the factoring was changed so the local call site keeps its original shape and the remote path takes the new core — the better structure anyway.Refs #13753