Repository navigation
Transactional message delivery + turn watchdog against zombie 'Working' states - #446
Merged
currentbits merged 12 commits intoAug 18, 2026
Merged
Conversation
… Tool call bodies scroll horizontally instead of wrapping
… Memory: distill procedural strategy entries from successes a
contextTokens is the last turn's FULL prompt (input + cache-read + cache-creation + output), and contextWindow carries the CLI's own window when it reports one. Contract only; runner and UI land next. Refs #317 Co-Authored-By: Claude Opus 5 <[email protected]>
…ued message Fields only, no behaviour. Main process fills them (watchdog + transactional queue drain); the renderer surfaces Stalled and a delivery retry. Co-Authored-By: Claude Opus 5 <[email protected]>
…into coder/fork-transactional-message-delivery-turn-68408d
…into coder/fork-transactional-message-delivery-turn-22ba60
Main now drains thread.queued at the run terminal and sets stalledAt. Stop the renderer from also flushing (that double-sent), show queued.error with Retry, and replace the infinite Working spinner with Stalled.
A failed retry cleared the queue optimistically and only raised a toast, so the prompt vanished — the exact loss #314 is about. Restore it with the new error, and offer Retry for any prompt still queued on a settled thread, not only one whose error survived a reload. Co-Authored-By: Claude Opus 5 <[email protected]>
Main-process half of transactional delivery. Stamps lastEventAt on stream events (throttled, no touch), sweeps working threads for stalls without killing the CLI, and drains thread.queued at every run terminal via takeQueued so a queued follow-up survives a reload.
…into coder/transactional-message-delivery-turn-watc-a3edde
The thread:updated merge kept a local queued copy whenever the incoming row had none — written when the RENDERER owned delivery. With main draining at the terminal, an explicit null is real news and re-pinning our copy stranded the Queued chip forever. Only an omitted field falls back now. Co-Authored-By: Claude Opus 5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
currentbits
deleted the
coder/transactional-message-delivery-turn-watc-a3edde
branch
October 3, 2026 16:07
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 #314.
Two failure modes this kills: a prompt typed mid-run that silently never gets sent, and a turn that sits on "Working" forever with no output and no timeout.
Delivery moves into the main process
The type-ahead queue was persisted by main (
thread.queued) but delivered by the renderer (useCoder.flushQueued, fired on the working→settled transition). Close or reload the app at the wrong moment and the prompt was never sent — that is the silent loss.services.takeQueued— atomic read-and-clear. Take-and-clear is what makes double delivery impossible.runner.drainQueued→startRun, called at every run terminal (notifyRunTerminalfor done/failed/stopped,afterSuccessfulTurn/afterFailedTurnfor the simulate path that bypasses it, and the sim-stop branch ofstopRun).queued.errorset, so nothing is lost and the composer can offer a Retry.flushQueuedis deleted, so there is exactly one owner of delivery.Turn watchdog
runner.checkStalls()on a 15s unref'd interval setsthread.stalledAtwhen a working thread has emitted nothing for 10 minutes (CODER_STALL_MSoverrides) and is notawaitingInput, and appends one event message.activemap — aworkingrow with no live run at all is the actual zombie, and an active-map scan would miss it.pushDetail, the one funnel every provider goes through, throttled to ~5s and written withouttouchso the sidebar does not re-sort on every stream chunk. The sweep's own push skips the stamp or it would clear the flag it just set.The pre-existing 60s
CLAUDE_ACK_MStimer (reused warm CLI only) stays as is. Thecommand_lifecycle/command_uuidcorrelation left over from #178 is deliberately not done here: this generic no-output watchdog covers the "stray first line then silence" hole it was for.UI
Stalled badge in place of the endless Working spinner (sidebar, thread view status strip, agents panel team rows), and the queued strip now carries the failure reason plus Retry alongside Cancel. Dev-mode fixtures seed both states.
Two joins fixed after the halves came together
Both are the same class of bug this issue is about, and both were invisible to each half on its own:
runs.startfailed — the prompt vanished. It now restores the prompt with the new error, and Retry is offered for any prompt still queued on a settled thread rather than only one whose error survived a reload.thread:updatedmerge re-pinned the renderer's ownqueuedcopy whenever the incoming row had none. Correct while the renderer owned delivery; with main draining, an explicitnullis real news and re-pinning would have stranded the Queued chip forever. Only an omitted field falls back now.Verification
npm run test:electron1168 pass / 0 fail,npm run test:renderer920 pass / 0 fail,npm run typecheckclean. New coverage inelectron/test/stall-watchdog.test.js(stall flagged once,awaitingInputexempt, activity clears it, a terminal delivers a queued prompt exactly once, a throwing start leaves it queued with an error),test/deliveryState.test.tsx, and the rewrittentest/queuedFollowup.test.tsx.🤖 Generated with Claude Code