fix(chat): look a Codex chain up again once a rollout in it is archived - #19
Conversation
Follow-up to devswha#18's review. A complete chain stays cached until 64 others push it out. If its parent rollout was archived meanwhile, every read that reached the parent failed with transcript_missing and the chat fell back to terminal output. Right after a backtrack the live file is small, so even the newest page reached the parent. When a remembered chain names a file that no longer exists, the chain is forgotten and looked up again. It comes back shorter (archived_sessions/ is not searched) under another stream id, so a cursor into the old chain answers 409 once and the chat reloads. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Merged. Thanks. The shorter chain is cached like any incomplete one, so One small follow-up: |
|
Thanks. It's in #20: |
From the merge reviews: - #19: codexHistoryTail read the remembered chain as it was. After a backtrack the live file's tail reached an archived parent, the read threw, and an app-server TUI without an open rollout lost its screen match until the entry was evicted. Both codexHistoryTail and codexHistorySegments now use the chain only while every file in it exists, and look it up again otherwise. transcriptStream's own check is folded into that. - #16: the 32 candidates for a screen match are interactive threads only, so a burst of `codex exec` runs no longer pushes a pane's own thread out. - #16: another pane now claims a newer thread only when its screen shows that thread's first message as well as its answer. An answer of this pane quoted or pasted there claims nothing. Its screen is matched against this pane's own thread and its own binding too, so a match is unique across all of them. - #16: the conversation route hands its session snapshot down, so an unsure poll takes no extra snapshot, and closed panes' bindings are dropped with it. Not changed: narrowing `source='vscode'`. On this machine, TUIs attached to a Codex Desktop app-server record originator "Codex Desktop" too, so the store cannot tell a Desktop or plugin thread from a TUI's. A thread no pane shows keeps reading as unsure, never as another conversation. Tests: the archived-parent tail and the exec burst each fail without their change. A pane showing only the other thread's answer leaves this pane unsure; the pane that typed it claims it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Follow-up to #18, as requested in its merge review.
Problem
historyChainkeeps a complete chain cached until 64 others push it out. If the parent rollout was archived during that time, every read that reached the parent failed withtranscript_missing, and the route answeredscrollback. Right after a backtrack the live file is small, so even the newest page reached the parent: the whole chat fell back to terminal output until the entry was evicted or the server restarted.Fix
When a remembered chain names a file that no longer exists (checked where the stream already stats its files), the chain is forgotten and looked up again. It comes back shorter, because
archived_sessions/isn't searched, under another stream id. A cursor into the old chain then answers 409 once and the chat reloads.Tests
conversation.test.ts: a complete chain is remembered, then the parent moves toarchived_sessions/. The newest page still reads (the live file's turns only), and abeforecursor into the old chain answersHistoryChanged. Without the fix the test fails withtranscript_missing.bun test: 270 pass. Typecheck clean.🤖 Generated with Claude Code