Repository navigation
fix(chat): never bounce a typed follow-up on a slow complete-history read - #4958
Conversation
…read After a restart, reopening a thread whose turn was interrupted and typing the next message could show it as pending and then hand the text back to the composer with an error. Since #4838 the send waited on the uncapped complete-history read so a follow-up could tell whether it must interrupt a delegated task; on a cold engine that read can outlast the renderer's request timeout, and the timed-out read failed the send itself. Decide the interruption from cached complete history when the thread has it, otherwise from one bounded newest read, and never block a send on the uncapped read. Keep a transport failure's own message when the SDK settles without a response instead of surfacing a TypeError in its place. Proof: evals/specs/thread-continues-after-restart.e2e.test.ts covers a crash (SIGKILL of the process group), an ordinary quit, and a relaunch whose complete-history read is slower than the request timeout; each case requires the typed continuation to be accepted exactly once, answered, and never returned to the composer, with earlier history intact and no replay of the interrupted tool. The slow-read case bounces the message on the previous send path. Unit coverage in session-history.test.tsx and opencode-session-native.test.ts.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Passed · 12/12 tests · 18/18 assertions · 8 images Commit |
Warden review summary — ClearNative findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (65642 ms), confidentiality-review (92221 ms), spec-provenance-review (138213 ms), desktop-den-sync-review (126950 ms). Blockers
Advisories
Needs recheck
Observed review-thread metrics
Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority. |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (9f61bd25fd810a0c8c3311765598b2d0bb574195). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Summary
After restarting OpenWork, reopening a thread whose turn was still working and typing the next message could show it as pending and then hand the text back to the composer with a failure.
Since #4838 every send awaited the uncapped complete-history read so a follow-up could tell whether it must interrupt a delegated task. On a cold engine after a restart, a long thread's complete history can outlast the renderer's 10 s request timeout (four attempts), and that failed read failed the send itself — the message was pulled from the transcript and returned to the composer. A second defect hid the cause:
unwrapSessionResultdereferencedresult.response.statuswhen the SDK settles a thrown fetch withresponse: undefined, so the banner readCannot read properties of undefined (reading 'status')instead ofRequest timed out..session-history.tsx: newreadSendHistory()— cached complete history when the thread has it, otherwise one bounded newest read (24 messages, which always holds the current turn's running delegation). A send never waits on the uncapped read.ensureFullSnapshot()stays for branching.session-surface.tsx:sendDraftuses it in place ofensureFullSnapshot().opencode-session-native.ts: a transport failure keeps its own message when the SDK settles without a response.Proof
Verdict: Passed at
9f61bd25f, local lane.pnpm evals:e2e thread-continues-after-restart --local→placement: local (--local), 3 passed / 0 failed / 0 skipped. New journeyevals/specs/thread-continues-after-restart.e2e.test.ts(worldevals/worlds/thread-restart.ts: Den-less desktop, host-booted model witness, caller-owned profile relaunched on the same renderer origin). A running tool is interrupted by a crash (SIGKILL of the desktop process group: renderer, embedded server, engine), by an ordinary quit, and by a relaunch whose complete-history read is delayed past the request timeout. Each case requires the typed continuation to be accepted exactly once, answered, the composer left empty, earlier history intact, and the interrupted tool not replayed.draft: "continue", bounced, 0 continuations, "The rest of this conversation could not be loaded · Retry") while the crash and quit cases passed.apps/app/tests/session-history.test.tsx45/45 (new: a send reads from cached complete history or one bounded newest read, never the uncapped read; a foreign newest read is refused);apps/app/tests/opencode-session-native.test.ts51/51 (new: a transport failure keeps its own message).pnpm --filter @openwork/app typecheckclean; eval channel/boundary ratchets and layer lint clean for the new files.Observed, not changed
A SIGKILL of the desktop lost the last minute of renderer
localStorage(default model reverted to its first committed value, active workspace, drafts, per-session model memory) on the same renderer origin; an ordinary quit lost nothing. The crash case therefore commits preferences with one ordinary quit before the interrupted turn, so it tests thread continuity rather than storage durability.UI/UX impact
None — existing UI/UX preserved. Only the failure path changes: the message no longer bounces back into the composer, and an engine transport failure shows its real cause instead of a TypeError.