Repository navigation
fix: finish admitted terminal prompts after sender disconnects - #34373
Conversation
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 2

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
7f595392-3080-49a5-8c99-3988180ca564
Files selected for processing: 15-
src/main/runtime/agent-prompt-permission-wait.test.tssrc/main/runtime/agent-prompt-submission-runtime-hook-and-generation.test.tssrc/main/runtime/agent-prompt-submission-runtime-test-fixture.tssrc/main/runtime/launched-agent-write-guard.test.tssrc/main/runtime/launched-agent-write-guard.tssrc/main/runtime/restored-pane-start-cli-handles.test.tssrc/main/runtime/rpc/methods/terminal/terminal-send-method.tssrc/main/runtime/rpc/terminal-agent-prompt-send.test.tssrc/main/runtime/rpc/terminal-agent-prompt-socket.test.tssrc/main/runtime/runtime-terminal-contracts.tssrc/main/runtime/terminal/input/agent-prompt-signals.tssrc/main/runtime/terminal/input/terminal-agent-prompt-submit.tssrc/main/runtime/terminal/input/terminal-agent-prompt.tssrc/main/runtime/terminal/input/terminal-input-dispatch.tssrc/main/runtime/terminal/output/terminal-output-generation.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
-
|
A sending CLI could disconnect after its prompt reached the terminal agent’s composer but before the delayed Enter. The host treated that disconnect as cancellation and left an unsent draft. This PR separates observation from the host operation: an admitted prompt now completes through its first Enter even when its sender disappears. Explicit operation cancellation, generation retirement, exact PTY/known-incarnation checks and permission checks still stop further bytes; the prompt FIFO remains intact. The full review loop finished in two rounds, with no remaining proven production findings. The target-input bridge, byte classifier and input subscriptions were removed; their framing and scaling findings disappear with that code. The retained fixes clean up a foreground guard even when cancellation wins its pending probe and allow null-to-known incarnation enrichment while still rejecting known replacement. The deciding session confirmed the bridge-free design and explicit-cancellation paths before the fresh round. The final reference and performance passes agreed. Final price: 262 production / 258 test lines changed, within the 400-line production allowance. Intended, main parity: target-typed Ctrl-C follows the existing input path and the agent’s own composer handling. In the real run both agents cleared their composer before the delayed Enter and submitted no stray prompt. Standalone terminal interrupt APIs still send keys; they do not cancel a separate host operation. After the first Enter, observer loss still stops held-submit retries and observation, as on main; actual-source main/branch traces refuted the proposed retry regression. Temporary: raw cross-writer interleave and the plain/shell or unproven-agent fallback remain tracked in #26676. No new saved field or wire operation was added. Retained paired-host coverage is compositional: an executed private joined WebSocket-close→writer→receipt-replay proof passed, but its additional regression was not retained under the test-line allowance. Verification: focused named Vitest runs passed through tc-gate (115-test initial set, 92-test final affected set, 35 explicit-cancellation/consumer tests, 12 tests for the consumer follow-up, and two socket tests after the test-only CI correction). Normal implementation hooks passed. Main was synced once without conflicts in 980bf30; the final test-only correction is 9c08485. All PR and auxiliary WSL checks are green on that head. The targeted qa-gate/qa-drive run passed on M4Air with actual Claude Opus 5.5 and Codex GPT-6.1-Sol, using terminals and exact PTYs carried through a graceful upgrade from main. Main left both pasted prompts unsent after sender death; the branch issued exactly one Enter and obtained a real reply for each. Actual Orca conversation Cancel after paste prevented Enter for over 12 seconds, and both same-agent terminals subsequently replied to recovery prompts. Target Ctrl-C left no stray submitted prompt. Ordinary rendered typing and CLI Enter produced real replies and working→done status. Status transitions are recorded; no busy-state screenshot is claimed. This is local macOS real-agent coverage; paired/Windows behavior is covered by tests, and no remote/mobile or unrelated lifecycle run is claimed. The QA apps and their 62 recorded process identities were stopped; the QA slot was released. For Brennan’s reviewWhole-window screenshots from the actual runs: Three places where the ownership boundary matters:
|












The problem
orca terminal send --text … --enterpastes a prompt into a Claude Code or Codex terminal, then presses Enter a moment later. If the script running that command was stopped or killed in between, Orca also cancelled the Enter, so the prompt sat unsent in the agent's input box. In the reported case one draft sat for 23 minutes until someone pressed Enter and submitted a stale message.What this PR changes
How it works: Orca now treats "the sender stopped listening" and "someone asked to cancel" as different things. Losing the sender only stops Orca reporting back to it; only a real cancel, the terminal restarting or switching to a different process, or a permission change stops the remaining typing. No new saved data or message types.
What stays the same
How it was tested
Tracked in STA-12291.