fix: deadline on prompt dispatch — re-send once, then terminal error result#13
Closed
dn00 wants to merge 1 commit into
Closed
fix: deadline on prompt dispatch — re-send once, then terminal error result#13dn00 wants to merge 1 commit into
dn00 wants to merge 1 commit into
Conversation
…minal result Claude's status file reports idle a beat before the TUI input box accepts keystrokes. A prompt typed into that gap is silently eaten: busy never arrives, and the readiness watchdog is intentionally suppressed while a dispatch is in flight, so nothing ever timed out — an unbounded silent wedge with no terminal result. Hit live in the parity replay (permission-deny on haiku: idle at 1.6s, prompt dispatched, only the startup quota probe ever reached the API, killed by the harness at 240s with zero output). After sendPrompt, arm a 10s deadline. If no turn starts: re-send the same prompt once (the TUI is certainly accepting input by then — recovers the race invisibly), then fail via failWithTerminalError so stream-json consumers get a parseable error result instead of a hang. The deadline stands down when the turn starts, when a permission dialog appears (the dialog machinery owns the session; re-typing would corrupt it), and during interrupts/shutdown. Tests: race recovered by a single re-send with no error; terminal error result (exactly one, no duplicate from the exit path) when the retry also fails; no re-send on a prompt turn start; stand-down on permission dialogs.
This was referenced Jun 10, 2026
f5d124a to
d34cc6b
Compare
3b4fe09 to
d8c9551
Compare
d34cc6b to
06ef75a
Compare
d8c9551 to
208fa2f
Compare
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.
Stacked on #12 (base =
fix/windows-readiness; uses itsfailWithTerminalErrormachinery). After #12 merges I'll rebase this onto main and retarget.The bug (seen live in the parity replay)
Claude's status file reports
idlea beat before the TUI input box accepts keystrokes. A prompt typed into that gap is silently eaten:busynever arrives, and the readiness watchdog is intentionally suppressed while a dispatch is in flight (promptDispatchInFlight), so nothing ever times out — an unbounded silent wedge with no terminal result.Observed in the haiku replay run (
permission-deny): idle at t=1.6s → prompt dispatched → only the startup quota probe ever reached the API → killed by the harness at 240s with zero output and noresult. A sonnet re-run of the same case passed cleanly (control round-trip in 7.6s), confirming a 1-in-N input race rather than a logic regression — but the race deserves a bound.The fix
Arm a 10s deadline after
sendPrompt:errorresult viafailWithTerminalErrorand shut down non-zero — consumers get a parseable terminator, never a hang.busy), permission dialog appeared (the dialog machinery owns the session; re-typing would corrupt it), interrupt in flight, shutdown.Tests
Full suite: 428 tests green.