Repository navigation
fix(opencode): heal the transcript gap when the database path turns up late - #1229
Merged
Merged
Conversation
…p late
When OpenCode's database path is resolved late, the package opens the
durable channel at the database's current head, so every row the TUI
committed while the pane was dark counts as already seen and is never
emitted. It reports db_path_recovered_late and asks the user to reload.
The renderer now answers that diagnostic with the reload itself: a
history read admits only uuids the pane does not hold and places them
in order, so the dark-window prompt and answer come back. A load that
succeeds writes `ready`; a failed one leaves the error standing.
The OpenCode Terminal harness gains `lateDatabase`: launch dark while the
replay keeps committing, with a mocked resolver that starts answering on
demand. The new test drives the real package, SessionManager and
forwarder: it failed first ("timed out waiting for the dark-window
prompt") and passes with the fix.
Fixes #1117
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…anner Review of #1229: - A (major): a late path recovery whose first store open was BUSY never emitted db_path_recovered_late, so no heal ran. Fixed in the package (opencode-terminal-headless#9, pointer bumped here): the report now fires wherever the reader actually starts. - A/B: a heal whose own history load failed was cleared by the next committed row, and the pane looked whole with rows still missing. The recovered-late message now becomes the lifetime banner in that case. - B: the heal test now pins that the diagnostic reached the pane and healed exactly once; a new test covers the failed heal (removing the handler fails it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round-2 review of #1229: after a failed heal the recovered-late message became a permanent lifetime banner, so a later read that succeeded (a retry, a reload, a parent's hydrate) left Agent Status and every parent's transcript_unavailable over a complete transcript. The history load now drops that one banner on success; channel errors that describe the live channel still stand. The failure handler also no longer resurrects a runtime for a pane closed mid-heal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1117
What was wrong
When
opencode db pathfails at launch, the package retries it (#1114). When it later succeeds,DurableReader.position()seeds from the database's current head, so every row the TUI committed while the pane was dark counts as already seen. Those rows are never emitted, and the pane shows an answer whose prompt never appeared, or nothing at all. The package reportsdb_path_recovered_late("Reload the session to re-read it") because it cannot tell a dark-window row from last week's.Fix
useIpcSubscriptions.tsanswersdb_path_recovered_lateby runningloadInitialHistoryForSessiononce. A history read admits only uuids the pane does not already hold, andplaceHistoryEntriesplaces them in order around the rows it does hold. On success the status becomesready; if the load fails, the error stays, which is still true. The diagnostic never reaches the lifetime banner (unchanged).Evidence
The OpenCode Terminal harness gains a
lateDatabaseoption. It launches dark while the replay keeps committing to the real fixture database, and uses a mockedresolveOpencodeDbPaththat starts answering on demand. The new test inopencodeTerminalDiagnostics.renderer.test.tsxruns through the real package, SessionManager and forwarder with the recordedplain.json:timed out waiting for the dark-window prompt, after the recovery had fired.runtime.entries, the status isready, and there is no lifetime banner.transcriptErrorfor both codes. Forrecovered_latethat value now belongs to the heal, so it asserts only the banner, with a comment explaining why.tsc -bis clean.Not verified
Live OpenCode (house rule). The package's own dark-window test (#6) is unchanged.
🤖 Generated with Claude Code
Review disposition (A Grok, B Pi; 2 rounds)
openDurablenever emitteddb_path_recovered_late, so no heal ran and the pane looked healthy6f343e7c): the report fires wherever the reader starts. New package system test1f23a5d8): a failed heal sets the recovered-late message as the lifetime bannertranscript_unavailableover a complete transcriptd52a779b): a successful history read clears that one banner (channelErrorAfterRead); other channel errors stand. The heal failure no longer resurrects a closed pane's runtime. Test extended; the mutant is killedsession:jsonl-errorreached the paneRound 2: A and B both MERGE-READY. The round-2 banner fix followed, with a test and a mutation check.