Repository navigation
Never fail a claude turn on a timer while the CLI is still working (#17) - #45
Merged
currentbits merged 1 commit intoAug 15, 2026
Merged
Conversation
…ng (#17) A resumed or kept-alive Claude CLI settles a queued task-notification as its own turn first and answers it with an empty success result. The runner holds that phantom, but a 30s grace timer then failed the run outright — and the real turn's first token can land much later (48s of thinking on a large resumed session, per the session transcript for the one occurrence in the wild). Everything the still-running CLI produced afterwards was dropped by the runId guard: both work-log steps checkmarked, no output, no error. A held phantom now becomes a failure only when the process exits, the one piece of evidence that the turn is really over. Same class of bug in onExit: it finalized on `sawResult || gotResult`, but claude.js sets gotResult for any result line including a held phantom, so a phantom discarded by real content followed by a CLI crash checkmarked both steps with no message, no status and no notification. 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/agent-task-shows-starting-agent-and-agen-8165b0
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 #17 — "Starting agent ✓, Agent working ✓, then nothing happens".
Root cause (reconstructed from real data, not inference)
The one occurrence under the current build is fully traceable:
coder-store.jsonthread107aa530, run at2026-08-15T06:53:42Z, cross-referenced with the claude session transcript~/.claude/projects/-Users-willem-code-AppVideo/374136fe-….jsonl.continueto a resumed CLI<task-notification>as its own turn, answering it with an empty success result → the runner correctly holds it as a phantomRun error: no output from agent, run slot clearedThe grace timer treated wall-clock silence as proof the turn was over. No timeout can be both short enough to catch a dead CLI and long enough to survive a legitimately slow first token — the same reasoning already recorded for the hung-stdin remainder in
docs/ISSUES.md.Before the phantom-hold shipped, this same race appeared 12× in the store as a silent success: both work-log steps checkmarked, no output, no error — the issue exactly as filed.
Second silent path (found by audit, covered by test)
onExitfinalized onsawResult || gotResult.gotResultis claude.js's per-process flag for any parsed result line — including a phantom the runner deliberately did not finalize on. So phantom → real content → CLI crash checkmarked both steps with no message, no status change and no notification: the reported symptom, reachable by a second route.What changed
electron/runner.js: a held phantom becomes a failure only when the process exits — the one piece of evidence that the turn is really over. The grace timer,PHANTOM_RESULT_GRACE_MSandCODER_PHANTOM_RESULT_GRACE_MSare deleted.electron/runner.js:onExitfinalizes onsawResultalone, so a resultless death always surfacesRun error (exit N)instead of silently checkmarking the work log.docs/ISSUES.md: symptom → evidence → cause → fix → tradeoff entry.Tests (both new ones verified red before the fix)
failedinstead ofdone.failedagainst the oldgotResultbranch.npm test: 1574 tests, 0 failures (38 core / 718 renderer / 699 electron / 119 memory).Tradeoff
A CLI that answers a phantom and then never speaks or exits now spins on "Agent working…" (step unchecked, Stop available) instead of failing after 30s. That is the honest state, it is the same gap as the documented hung-stdin remainder, and it is strictly better than fabricating a failure while discarding a turn that is still running.
🤖 Generated with Claude Code