Repository navigation
engine: a finished turn no longer reads busy for ten minutes (#130) - #143
Merged
Merged
Conversation
paneBusy() gates every exit of the subscription poll loop except the idle watchdog, so a pane that reads busy forever ends a turn the TUI already finished as a 10-minute timeout while the live pane shows the answer. - The elapsed-timer signal matched the whole pane. CLI 2.1.311 renders a finished subagent as "Done (3 tool uses · 12.4k tokens · 8s)", which matched for as long as it stayed on screen. It now matches only a spinner-shaped line (ellipsis verb), above the input box. - The animation signal diffed the whole pane, so a statusline clock or a draft typed into the live pane read as a spinner. It now diffs only the conversation above the input box; no box on screen falls back to the whole pane as before. - RULE_RE accepts a labeled rule: a chat opened with --name draws its title into the box's top rule, and the box was invisible in exactly the studio's chats (which also let a numbered draft read as a #20 widget). - The idle-timeout error names the signal that last held the pane busy. test/pane-busy.test.js pins both directions; each change reverted alone turns cases red.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
- RULE_RE is back to unlabeled: widening it let a dialog under a labeled header read as the input box and silenced the #20 prompt detector. The box is found by its own BOX_RULE_RE / _conversationAboveInputBox. - The box must sit at the bottom (lower rule within 6 lines), its top rule is the NEAREST rule above (3 dashes suffice for a narrow labeled rule), and a mismatch returns null instead of searching into the history. - The spinner is looked for in the last lines above the box only. - With no box (a dialog), the timer must still be spinner-shaped: a finished subagent line above a permission dialog read as busy and kept input_needed from ever being sent.
This was referenced Nov 15, 2026
Closed
Lexus2016
added a commit
that referenced
this pull request
Nov 16, 2026
…ing on (#130) (#144) The subscription engine announces a blocking TUI prompt once (input_needed) and withdraws it once (input_resolved). A page reloaded in between got a new socket that saw neither frame and a fresh tab state with nothing to redraw the banner from, so the chat showed a running turn and no question. This is the part #143 left open. - The engine reports both edges through an optional onPromptState callback, from wsSendAll, the one place both frames go through. - engine-prompts.js keeps the open prompt per session; all three runInteractiveSingle call sites (chat, Kanban task, Telegram) feed it. - subscribe_session replays it only without noCatchUp (a background tab that never reloaded still has it) and only while isSessionLive(), so a prompt left by a crash between the edges is dropped, not shown. test/engine-prompt-replay.test.js boots a real server whose fake claude draws the trust screen: a foreground subscribe gets the prompt, a noCatchUp one and one after the turn ended do not. It fails on the two positive checks without the replay.
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 #130.
What was wrong
paneBusy()gates every exit of the subscription engine's poll loop except the idle watchdog: the turn-end break isendTurnSeen && !busy && !gotNewBytes, and the quiet safety net only counts polls where!busy. A pane that reads busy forever therefore holds a turn the TUI has already finished open forCLAUDE_IDLE_TIMEOUT_MS(10 min), then ends it as "interactive engine timed out". That is the reported symptom: the live pane shows the answer, the web UI keeps waiting.Two signals could read a finished pane as busy indefinitely:
/\d+s\s*[·)]/was meant for the spinner line, but CLI 2.1.311 renders a finished subagent as`Done (${uses} · ${tokens} · ${duration})`(the template is in the shipped bundle), so⎿ Done (3 tool uses · 12.4k tokens · 8s)matches8s)for as long as it stays on screen.The fix
_conversationAboveInputBox), both content signals look only at the conversation above it, and the timer signal only at the spinner: an ellipsis verb, then(…Ns ·/…Ns)(SPINNER_TIMER_RE), in the last few lines above the box.Done (… 8s)line above a permission dialog read as busy. That forcesawaitingfalse, soinput_neededwas never sent, and the turn hung on exactly the question the user was meant to answer: the "back-and-forth" case in the report._inInputBox()/RULE_RE, which stay unchanged. WideningRULE_RElets a dialog under a labeled header read as the input box and silences the Terminal Access For Prompt Interactions #20 prompt detector. The box's lower rule must sit within 6 lines of the bottom. The top rule is the nearest rule above it, may carry a label (a chat opened with--namedraws its title into it), and needs only 3 leading dashes. A mismatch returns null (pre-fix behaviour) and never searches further up the history.esc to interruptis still matched on the whole pane.The pane still looked busy (spinner|animation|legacy-marker).), so if this recurs the report names the cause.The idle reaper (#141) calls the same
paneBusy()(it also has its ownisLiveguard for a running turn), so a finished pane with aDone (…)line on screen is now reapable too.Reviewed by an independent model (agy) over two rounds. Round 1: the
RULE_REwidening, a mid-history box match and the history-wide spinner scan were all fixed. Round 2: narrow labeled rules, the no-boxDonecase and an indented caret were fixed. Its remaining points (an earlyreturn nullfalling back to the old behaviour; the reaper relying onisLive) are the safe direction by design.The other two points in the issue
awaitAnnouncedstuck after an answer: already handled.awaitingis!busy && !gotNewBytes && paneAwaitingInput(pane)(claude-interactive.js, poll loop), so the first poll with new transcript bytes after an answer clears it and sendsinput_resolved. The case where it could stay set was the stuck-busy pane this PR fixes.wsis the turn'sWsProxy(server.jsparams.ws: proxy). It buffers while the browser is away, andsubscribe_sessionre-attaches it to the new socket.doneis also broadcast to every watcher (broadcastToSessionExcept, both success and error paths). Still open: after a full page reload, a pendinginput_neededbanner is not re-sent to the new page. That is a separate follow-up.Tests
test/pane-busy.test.js(new, wired intonpm test, 22 cases):Done (… 8s)line (which is also announced as a prompt).Cogitating… (8s · esc to interrupt)shape, the reaper suite's bare marker, a spinner below a framed quote with no box, a narrow labeled top rule over a history prompt.Mutation-checked: each of the 7 constraints reverted on its own turns at least one case red.
npm testis green locally (Node 26). Unrelated:test/global-workspace.test.jsis flaky on its own (1 of ~7 runs). Itsin_progressfixtures race the server's 3 s startup recovery (server.jsstartupsetTimeout). That is reported separately and not touched here.I could not reproduce the reporter's exact session. The fix targets the cause I can demonstrate from the code and the CLI's own output format.