Repository navigation
fix(cli): let ESC cancel ongoing work before popping queued messages - #8353
Conversation
When the agent is actively responding (streamingState === Responding), InputPrompt's ESC handler consumed the key before AppContainer's global cancel-work handler could fire. Users had to press ESC 3 times (pop queue, clear input, cancel work) to stop the agent. Skip the pop-queue-into-input and double-ESC-clear logic when the agent is responding, returning false so the key propagates to the global handler which cancels the ongoing request. The up-arrow key still pops queued messages into the input at any time. Fixes QwenLM#8201
Review:
|
buffer.setText calls |
onEscapePromptChange calls |
|
|---|---|---|
| before this PR | [] (text kept) |
[[false], [true]] → "Press ESC again to clear" shown |
| with this PR | [[""]] (text wiped) |
[[false]] → no warning |
So a user who types their next message while the agent is streaming — a very common flow, and the same flow that produces the queued messages this PR is about — loses that text on the first ESC, with no confirmation step and no undo. That first ESC also probably doesn't cancel: AppContainer's handler runs on the same broadcast and checks buffer.text.length > 0 before the cancel branch (AppContainer.tsx:3905), reading the pre-clear value from its render closure, so it takes the double-press path. Net effect for that case: text destroyed, still 2 presses to cancel.
🟠 The stated root cause isn't what's happening (affects how to fix it)
The global cancel-work handler in AppContainer was never reached because InputPrompt always returned
truefor ESC when the input was focused.
InputPrompt's return value has never gated AppContainer. KeypressContext broadcasts each key to every subscriber and ignores return values (KeypressContext.tsx:774-776), and AppContainer subscribes with isActive: true unconditionally (AppContainer.tsx:4114) — the vim-INSERT guard at AppContainer.tsx:3886 exists precisely because both handlers always fire.
The actual cause is ordering plus buffer state: InputPrompt (child) subscribes first, pops the queue into the buffer, and AppContainer then sees a non-empty buffer and takes "double-press to clear" instead of cancel. That means the queue-pop guard alone is what fixes #8201; the return false is not required for the fall-through and is what introduces the regression above.
🟡 Suggested minimal fix
Keep the pop-queue guard, and gate the fall-through on an empty buffer — that's exactly the #8201 scenario (queued messages, nothing typed) and it leaves nothing to lose:
// Only defer to AppContainer's global cancel handler when there is no
// typed input to protect — otherwise BaseTextInput's default ESC branch
// would wipe the buffer on a single press. #8201
if (uiState.streamingState === StreamingState.Responding && buffer.text === '') {
resetEscapeState();
return false;
}With typed input present the user keeps today's guarded behavior (ESC → "press again to clear" → ESC clears), and because the buffer is then empty the next ESC cancels — no silent data loss.
🟡 Test coverage
No tests are added, and the existing suite passes vacuously: the useUIState mocks in InputPrompt.test.tsx (e.g. :71, :5036) never set streamingState, so undefined !== StreamingState.Responding and neither new branch is exercised. "7/7 ESC tests pass" therefore isn't evidence for this change. Please add cases with streamingState: StreamingState.Responding:
- queue non-empty + ESC →
popAllQueuedMessagesnot called (this one does fail onmain, so it's a real regression test) - buffer has text + one ESC →
buffer.setText('')not called - buffer empty + ESC → not consumed (global handler can cancel)
🔵 Minor
resetEscapeState()isn't called beforereturn false, so a pendingescPressCount/"press ESC again" prompt from just before streaming started can linger for the remainder of the 500 ms window while ESC no longer does what the prompt says.StreamingState.WaitingForConfirmationisn't covered — ESC during a tool-confirmation prompt still pops the queue. Pre-existing and arguably out of scope, but worth a follow-up since it's the other "agent is busy" state.- Style/conventions otherwise look fine: value import of the enum is correct, comments reference the issue, no perf or security implications.
Summary: the queue-pop guard is a correct, well-targeted fix. The return false fall-through should be narrowed to the empty-buffer case before merge — as written it trades a 3-press annoyance for silent loss of typed input — and both branches need direct tests.
Address wenshao's review on QwenLM#8353: - Gate the return false on buffer.text === '' to prevent BaseTextInput's default ESC from silently wiping typed input without double-press confirmation - Add resetEscapeState() before return false to clear any pending escPressCount/escape-prompt timer - Add two regression tests with streamingState: StreamingState.Responding: 1. queue non-empty + ESC -> popAllQueuedMessages NOT called 2. buffer has text + single ESC -> buffer NOT cleared
|
Addressed all review feedback in
@qwen-code /triage |
Address bot suggestion: the comment claimed returning true 'consumed the key before the global cancel-work handler could fire', but KeypressContext broadcasts to all handlers regardless of return value. The real mechanism is that popQueueIntoInput() fills the shared buffer, steering AppContainer's handler into its 'input has content -> double-press to clear' branch instead of the cancel-work branch.
…nput fall-through Bot suggestion: the comment said returning false 'avoids' BaseTextInput's wipe, but return false actually *enables* it (BaseTextInput only short-circuits on truthy returns). The buffer is safe because the buffer.text === '' gate makes the wipe a no-op, not because return false prevents it. Reworded to make this explicit and warn against relaxing the gate.
The PR's Responding guards were pinned only by InputPrompt-side tests (queue not popped; non-empty buffer preserved). Add the positive case the review asked for: while Responding with an empty buffer and queued follow-ups, a single Esc reaches the global handler's cancel-work branch (cancelOngoingRequest called once) and the queue is not consumed. QwenLM#8201
|
@qwen-code /triage |
doudouOUC
left a comment
There was a problem hiding this comment.
— qwen3.7-max via Qwen Code /review (v0.21.3)
The positive ESC cancel test asserts popAllMessages is not called, but the comment framed it as 'must not consume the queue' end-to-end. In production that exact cancel path DOES drain the queue back into the buffer via the cancel handler (cancelOngoingRequest -> onCancelSubmit -> popAllMessages), under the 'never silently drop queued work' invariant. The assertion only holds because cancelOngoingRequest is replaced by a spy here, severing that hop. Reword the comment to describe the real contract: the global keypress handler itself doesn't pop the queue (InputPrompt owns that and skips it while Responding; QwenLM#8201), while the end-to-end drain is a separate hop severed by the spy. Addresses the review finding on AppContainer.test.tsx:2405.
|
@qwen-code /review |
Address two review suggestions on the ESC cancel tests: - The `return false` branch in InputPrompt.tsx (Responding + empty buffer + empty queue -> defer to AppContainer's cancel-work branch) had no test coverage: reverting it left all 334 tests green. Add an InputPrompt test that pins it (no queue pop, no buffer mutation). - The AppContainer cancel test inlined a byte-identical copy of the getGlobalKeypress() helper that already existed ~2600 lines down in the Ctrl+O describe block. Hoist the helper to the outer describe so both blocks share one definition of the fragile toString() discovery idiom.
Per review (R4-1): the sequence literal embedded a raw 0x1B control byte that renders as an empty string in diffs and truncates grep output, so the fixture was unreadable. Use the escaped form matching the sibling vim-INSERT fixture on the line above.
|
@qwen-code /review |
…-while-responding
|
@qwen-code /review --timeout=360 |
Per review (R5-1/R5-2): the flagship QwenLM#8201 test asserted only the mechanism (popAllQueuedMessages not called), not the effect (buffer stays empty so AppContainer takes its cancel branch). Add the buffer assertion. Also correct the return-false test comment: deleting that branch leaves the test green (KeypressContext.broadcast ignores return values, BaseTextInput's clear is a no-op on empty buffer), so the test pins the no-side-effect contract, not the branch itself.
Per review (R6-1/R6-2): the pop-skip guard was pinned only for the empty-buffer case, and the double-press clear contract had no test under Responding. Add: - non-empty queue AND typed text: ESC does not pop the queue and preserves the buffer (pins the guard regardless of buffer content). - double-ESC while Responding: first ESC preserves typed text, second clears it (pins the double-press contract this diff preserves).
|
@qwen-code /review |
Per review (R7-1/R7-2): the double-ESC test spaced presses with the default 150ms wait (~30% of the 500ms window); use 50ms to match the sibling double-ESC test. Hoist the escKey fixture to the Cancel Handler describe scope so both tests share one definition (matching the getGlobalKeypress hoist this PR already did).
|
@qwen-code /review |
Per review: the cancel-handler test's useMessageQueue mock omitted removeGoalTurns, a required member that every other queue-mock override in this file includes. The real cancel handler calls removeGoalTurns() before popAllMessages(); the test passed only because cancelOngoingRequest was a spy severing that hop.
|
@qwen-code /review |
Per review (R9-1): the vim-INSERT test still inlined a handler-discovery loop matching on 'handleExit', duplicating the hoisted getGlobalKeypress helper (matching TOGGLE_THINKING_EXPANDED). Both tokens occur in the same handleGlobalKeypress closure, so the two idioms can only drift. Reuse the shared helper.
|
Addressed R9-1 (reuse getGlobalKeypress in vim-INSERT test). On R7-3 (the end-to-end broadcast integration test): the existing tests cover both sides of the #8201 contract independently - InputPrompt's Responding guard skips the pop (InputPrompt tests) and the global handler takes its cancel branch with an empty buffer (AppContainer tests). A full integration test rendering both under a real KeypressContext broadcast would require mocking the entire daemon/gemini-stream stack, which is a large setup for a contract already pinned from both sides. I'd treat it as a follow-up if a maintainer wants it. |
…ing Esc Per review (R10-1/R10-2): the shared escKey fixture embedded a raw 0x1B control byte (invisible in diffs, truncates grep). Use the escaped form. Also update keyboard-shortcuts.md: Esc now cancels the ongoing request while the agent is responding instead of moving queued messages back into the input.
|
@qwen-code /review |
Per review (R11-1): the previous wording said queue pop happens only when idle, but Up Arrow pops in any state (no streamingState guard) and Esc pops whenever not actively responding (including WaitingForConfirmation). Reword to match the code, and note that the responding-cancel only fires when the input is empty.
|
@qwen-code /review |
|
@qwen-code /review |
Review:
|
| Check | Result |
|---|---|
InputPrompt.test.tsx + AppContainer.test.tsx full suites |
344/344 pass (the "pre-existing flaky clipboard timeout" you mention did not reproduce here) |
Mutation: drop streamingState !== Responding from guard #1 |
2 tests fail → guard #1 is pinned ✅ |
| Mutation: delete guard #2 entirely (all 7 lines) | all 12 ESC tests still pass ❌ |
prettier --check / eslint on all 4 changed files |
clean |
1. Guard #2 is dead code — recommend removing it
if (uiState.streamingState === StreamingState.Responding && buffer.text === '') {
resetEscapeState();
return false;
}Deleting this block changes no observable behavior. With it gone, control falls to if (escPressCount === 0) { if (buffer.text === '') return true; } — no buffer mutation, no queue pop, and AppContainer cancels either way since the return value is ignored by the broadcast. escPressCount === 1 is unreachable here: it is only ever set when buffer.text !== '', and any non-ESC key resets it, so the else branch can't be entered with an empty buffer.
That's 7 lines of code plus a 10-line comment that carries no weight, and the comment's warning — "Do NOT relax this gate: returning false with non-empty text would let BaseTextInput wipe it" — guards a branch that can't currently be reached. Your own test comment already concedes the branch is unpinned. I'd either drop it and fold the useful part of the explanation into guard #1's comment, or keep it only with an explicit // intentionally inert today; documents the invariant note. Right now the PR description presents it as half the fix, which overstates it.
2. The real coverage gap: nothing tests the integration
Both new test groups mock the other side of the interaction:
InputPrompt.test.tsxassertspopAllQueuedMessagesisn't called — but never runsAppContainer's handler.AppContainer.test.tsxpullshandleGlobalKeypressout of theuseKeypressmock and invokes it directly — soInputPrompt's guard is never in the picture. Itsexpect(mockPopAllMessages).not.toHaveBeenCalled()is close to tautological, sincecancelOngoingRequestis a spy andonCancelSubmitnever fires (your comment says as much). ThecancelSpyassertion is a useful regression guard on pre-existing code, though.
So the PR's central claim — "one ESC instead of three" — has no test. Worse, the fix silently depends on two implicit invariants:
InputPrompt/BaseTextInputsubscribing toKeypressContextbeforeAppContainer, andbuffer.textreading through tostateRef.currentsynchronously.
Break either (e.g. memoize text off React state, or hoist the input's keypress subscription) and the 3-press bug returns with a fully green suite. One test that renders the real provider tree and asserts cancelOngoingRequest is called once after a single \x1B with a non-empty queue would lock this down. If that's too heavy, at minimum reference both invariants in the guard #1 comment — it currently explains what happens but not why the ordering holds.
3. Behavior notes (not blockers)
- The guard fires regardless of buffer content, so while Responding the ESC→pop-queue route is gone entirely, not just in the empty-buffer case. Up arrow still covers it, and the cancel path drains the queue back into the input anyway (
AppContainer.tsx:2736), so nothing is lost. Good outcome — just broader than "when the input is empty". - Docs wording: "queued messages are preserved" is slightly imprecise — after the cancel they are moved into the input box, not left queued. Something like "queued messages are moved back into the input" matches what actually happens.
WaitingForConfirmationis not covered by either guard. That's consistent —AppContainer's cancel branch also only checksResponding— so ESC during a tool confirmation behaves as before. Worth a sentence in the guard comment so nobody "fixes" it later by broadening the check to!== Idle, which would make ESC a no-op there.- Typed text + Responding: guard Where is the config saved? #2 doesn't apply, so the first ESC shows the double-press prompt and the second both clears the buffer and cancels (AppContainer sees the freshly-emptied live buffer in the same broadcast). Pre-existing, unchanged by this PR, but it means the double-press contract is a bit fuzzier than the tests suggest.
4. Test/style nits
- The
getGlobalKeypressdedupe is a genuine improvement. It does change the vim test's discovery token fromhandleExittoTOGGLE_THINKING_EXPANDED— both live inhandleGlobalKeypress, so it's fine, thoughhandler.toString().includes(...)remains brittle (pre-existing idiom). - The docs diff reflows all 42 table rows because the column width changed. Prettier-clean, just diff noise — nothing to do.
Summary
| Correctness | ✅ root cause identified correctly, guard #1 fixes it |
| Conventions | ✅ prettier + eslint clean, matches surrounding test idioms |
| Performance | ✅ two enum comparisons per keypress |
| Security | ✅ n/a |
| Tests |
Suggested before merge: (a) drop guard #2 or mark it explicitly inert, (b) add one integration test for the single-ESC cancel, (c) tighten the docs sentence about queued messages.
wenshao's mutation test showed guard QwenLM#2 (Responding + empty buffer -> return false) is dead code: with it gone, control falls to the escPressCount===0 branch which returns true on an empty buffer, and KeypressContext.broadcast ignores handler return values anyway - AppContainer's own cancel branch acts on the empty buffer either way. Remove it, fold the subscription-ordering invariants it relied on into guard QwenLM#1's comment, and document that only Responding is gated (do not broaden to !== Idle or ESC becomes a no-op during a tool confirmation). Also tighten the docs wording: cancelled queued messages are moved back into the input, not preserved. QwenLM#8201
|
@qwen-code /review |
Round-13 review (no blockers) flagged comment inaccuracies that could misdirect future debugging: - R13-1: the invariant comment pointed at an integration test that does not exist - note the harnesses mock each other's side instead. - R13-2: the regression-test comment still said the branch returns false and that AppContainer acts on return values; it returns true and broadcast ignores return values. - R13-4: the docs row claimed Up Arrow/Esc pop in any state, but during WaitingForConfirmation Composer unmounts InputPrompt (isInputActive admits only Idle/Responding), so neither key pops. - R13-5: the guard comment warned against broadening to !== Idle as if WFC ran this branch; it never does because the component is unmounted. No behavior change. QwenLM#8201
|
@qwen-code /review |
Round-14 review: the invariant comment overstated subscription order as load-bearing - the Responding pop guard skips the pop in either order, and InputPrompt re-subscribes after AppContainer on any remount (e.g. a tool-confirmation round trip), so only the buffer.text-liveness invariant matters. And the double-ESC clear comment now notes it composes with AppContainer's cancel on the same keypress in the initial order but lands on the next press after a remount. No behavior change. QwenLM#8201
|
@qwen-code /review |
Real-environment verification — ✅ behaves as advertised, safe to mergeI built two real CLI bundles from source and drove both through an actual TUI (tmux, 120×40) against a live streaming provider, then compared them key-press for key-press. The fix does exactly what the description claims, and the three paths it must not touch are byte-identical to Setup
Bundle provenance checked before running, so the two binaries really are the two revisions:
Results — 5 scenarios, both builds
A — the reported bug (#8201), before: ESC #1 pops the queue into the input while the model keeps streaming, ESC #2 clears it (the queued text is now gone for good), ESC #3 finally cancels. A — after: one ESC cancels, and the queued message survives — the cancel path drains it back into the input box. B — typed text and a queue (the messier case). C — the untouched baseline. Streaming with an empty input and an empty queue: one ESC cancels on both builds. The ledgers are indistinguishable — both aborted at D + E — the regression checks. Up-Arrow still reaches the queue while streaming, and the double-ESC-clear contract for typed text is intact (ESC #1 preserves the draft and shows Wire-level evidenceScenario A ledgers, same script, same timings: Scenario C ledgers (the path the guard must not affect): Test suite + mutation check
Notes, not blockers
Verdict: LGTM — the root-cause analysis is right, the fix is minimal, and every neighbouring ESC path is provably unchanged. 🇨🇳 中文版报告真实环境验证 —— ✅ 行为与描述一致,可以合入我从源码构建了两份真实 CLI bundle,在真实 TUI(tmux,120×40)里对接真实流式 provider,逐次按键对比。修复确实做到了描述里说的事情,而它不该动的三条路径与 环境
跑之前先核对了 bundle 出处,确认两个二进制确实是两个 revision:
结果 —— 5 个场景,两份构建
A —— 问题复现(#8201),修复前: ESC #1 把队列弹进输入框、模型还在输出;ESC #2 清空输入框(排队文本就此丢失);ESC #3 才真正取消。(见上文第一张图) A —— 修复后: 一次 ESC 就取消,并且排队消息不丢 —— 取消路径把它回灌进了输入框。(第二张图) B —— 同时有草稿和队列(更麻烦的情况): C —— 不该被影响的基线。 流式中输入框为空、队列为空:两份构建都是一次 ESC 取消,账本完全一致 —— 都在 D + E —— 回归检查。 流式中 ↑ 依然能取到队列;已输入文本的双击 ESC 清空契约完好(ESC #1 保留草稿并提示 网络层证据场景 A 的账本(同一脚本、同一时序): 场景 C 的账本(守卫不该影响的路径): 单测与变异测试
说明(非阻塞项)
结论:LGTM —— 根因分析正确,修复足够小,相邻的每条 ESC 路径都被证明未受影响。 |
…t review Ten findings from a 9-agent review round plus one reverse-audit round over the PR's own diff; all verified against the cited lines before fixing. - Step 4 k=0 batch: pre-confirmed [build]/[test] entries enter the cumulative list untagged (the every-entry-tagged wording would have sent deterministic findings into the tag backstop and capped the verdict); the no-shard clause covers the all-pre-confirmed case, not just zero findings. - Convergence pair x retroactive-dry: the two rules now compose instead of conflicting - a pair retired in full counts as the dry predecessor at round 3's return; round k-1 counts launches, not labels; verdicts are applied at a round's return before the dry consultation; the pair's verification is one build over the deduped union passed as --round 2. - Tail batching: a group (3) that cannot be resolved no longer gates cleanup forever - disclose, skip record_artifact, preserve the inputs beside the report, and still run cleanup so the bypass audit and the completion line always happen; the old before-cleanup ordering sentence now names the group (3)/(4) split instead of contradicting it. - Accuracy: "byte-identical" weakened to what the pipelined merge rule actually guarantees, and the pair's round-2 suppression window named as the already-accepted trade; the #8353 incident recast to the forward pairing the rule licenses (round 5 was the waste, not rounds 4-5) with the ledger-vs-audit round numbering disambiguated. - save-artifact: comment block and test comments no longer describe the flag as embedder-only - it is the containment anchor the skill passes on every run; new CLI option contract test drives --workspace-root through real yargs into saveReviewArtifact (mirrors the test-plan/test-delta precedent for camel-case flag regressions).
…t review Ten findings from a 9-agent review round plus one reverse-audit round over the PR's own diff; all verified against the cited lines before fixing. - Step 4 k=0 batch: pre-confirmed [build]/[test] entries enter the cumulative list untagged (the every-entry-tagged wording would have sent deterministic findings into the tag backstop and capped the verdict); the no-shard clause covers the all-pre-confirmed case, not just zero findings. - Convergence pair x retroactive-dry: the two rules now compose instead of conflicting - a pair retired in full counts as the dry predecessor at round 3's return; round k-1 counts launches, not labels; verdicts are applied at a round's return before the dry consultation; the pair's verification is one build over the deduped union passed as --round 2. - Tail batching: a group (3) that cannot be resolved no longer gates cleanup forever - disclose, skip record_artifact, preserve the inputs beside the report, and still run cleanup so the bypass audit and the completion line always happen; the old before-cleanup ordering sentence now names the group (3)/(4) split instead of contradicting it. - Accuracy: "byte-identical" weakened to what the pipelined merge rule actually guarantees, and the pair's round-2 suppression window named as the already-accepted trade; the #8353 incident recast to the forward pairing the rule licenses (round 5 was the waste, not rounds 4-5) with the ledger-vs-audit round numbering disambiguated. - save-artifact: comment block and test comments no longer describe the flag as embedder-only - it is the containment anchor the skill passes on every run; new CLI option contract test drives --workspace-root through real yargs into saveReviewArtifact (mirrors the test-plan/test-delta precedent for camel-case flag regressions).
…needed (QwenLM#8642) * perf(review): remove serial wall-clock the audit loop and tail never needed Four latency cuts, each backed by stage-level timings extracted from six real CI review runs (2026-08-05/06); none changes what a review covers or what evidence a verdict requires. - Step 4's initial verification rides with the first reverse-audit launch (the k=0 case of the existing pipelined-loop rule). One measured run held its round-1 auditor 22 minutes behind verdicts the launch never consumed, while a sibling run the same day launched the two together. - Reverse-audit rounds 1 and 2 become the convergence pair on 3A plans: two independent auditors launched together, both-dry = the two dry audits the criterion already demands. A dry round leaves the findings list unchanged, so serial round 2's input was byte-identical to round 1's; the pair removes the wall clock between them, not either audit. Also spares the budget-stop cap a run took for want of a second dry round it had time to run in parallel but not in series. - A reporting round whose every finding the verifier rejected is retroactively dry: rejections already remove the entries, but not the reset they applied to the dry counter, and one measured run spent two extra rounds re-proving what round 2 plus a rejection had already answered. - save-artifact resolves its workspace root from cwd (or an explicit --workspace-root), not QWEN_CODE_PROJECT_DIR - the harness exports that variable as the session-storage dir under the runtime base, never the main checkout, and all six runs burned minutes rediscovering it before improvising workarounds. Steps 8/9 also batch the tail bookkeeping into four responses instead of one command per model turn. * perf(review): address review feedback on the pipeline-latency changes - Pin the cwd default with the trap armed: the regression test now chdirs into the root, passes no workspace root, and points QWEN_CODE_PROJECT_DIR at a decoy - reintroducing the removed env preference turns it red (verified by negative control). - Have the skill pass --workspace-root explicitly in the Step 8 block, so the containment anchor never depends on where the command happened to run. - Pin the retroactive-dry pairing direction: forward only, consulted on a round's return; the upgrade never ends the loop by itself and never discards an in-flight round. - Make the Step 4 batch self-contained (findings files written before either prompt set is built), and gate tail group 4 on group 3's success so cleanup cannot destroy save-artifact's only inputs after a failure. - Add the defensive rule for a deadline-refused pair member: launch round 1 alone and treat the refusal as the budget stop. * perf(review): fix rule conflicts and stale claims found by multi-agent review Ten findings from a 9-agent review round plus one reverse-audit round over the PR's own diff; all verified against the cited lines before fixing. - Step 4 k=0 batch: pre-confirmed [build]/[test] entries enter the cumulative list untagged (the every-entry-tagged wording would have sent deterministic findings into the tag backstop and capped the verdict); the no-shard clause covers the all-pre-confirmed case, not just zero findings. - Convergence pair x retroactive-dry: the two rules now compose instead of conflicting - a pair retired in full counts as the dry predecessor at round 3's return; round k-1 counts launches, not labels; verdicts are applied at a round's return before the dry consultation; the pair's verification is one build over the deduped union passed as --round 2. - Tail batching: a group (3) that cannot be resolved no longer gates cleanup forever - disclose, skip record_artifact, preserve the inputs beside the report, and still run cleanup so the bypass audit and the completion line always happen; the old before-cleanup ordering sentence now names the group (3)/(4) split instead of contradicting it. - Accuracy: "byte-identical" weakened to what the pipelined merge rule actually guarantees, and the pair's round-2 suppression window named as the already-accepted trade; the QwenLM#8353 incident recast to the forward pairing the rule licenses (round 5 was the waste, not rounds 4-5) with the ledger-vs-audit round numbering disambiguated. - save-artifact: comment block and test comments no longer describe the flag as embedder-only - it is the containment anchor the skill passes on every run; new CLI option contract test drives --workspace-root through real yargs into saveReviewArtifact (mirrors the test-plan/test-delta precedent for camel-case flag regressions). * perf(review): shard the convergence pair's verification per verifyShard Round-2 reverse audit: the pair bullet's "one verify build over the deduped union" contradicted Step 4's verifyShard sharding (quality collapses past 8 findings per verifier) and its own plural "the pair's verifiers". The rule now shards the deduped union exactly as any reporting round's findings are, every shard passed as --round 2; the per-member ban is unchanged. --------- Co-authored-by: verify <verify@local>





What this PR does
When the agent is actively responding (
streamingState === Responding), ESC now falls through to AppContainer's global handler which cancels the ongoing request, instead of being consumed by InputPrompt's pop-queue / double-ESC-clear logic.Why it's needed
Users had to press ESC 3 times to stop the agent when they had queued messages: first ESC popped the queue into the input box, second ESC cleared the input, third ESC finally canceled the work. The global cancel-work handler in AppContainer was never reached because InputPrompt always returned
truefor ESC when the input was focused.What changed
Two guards added to InputPrompt's ESC handler (
packages/cli/src/ui/components/InputPrompt.tsx):popQueueIntoInput()whenstreamingState === Responding-- the queue stays untouched, ESC propagates.false(don't consume ESC) whenstreamingState === Responding-- lets AppContainer's global handler fire its cancel-ongoing-request step.When the agent is idle, ESC behavior is unchanged: pop queue, double-ESC clear, etc. all work as before. The up-arrow key still pops queued messages into the input at any time.
Reviewer Test Plan
How to verify
InputPrompt.test.tsxpass (7/7).keeps generated attachment references out of submitted provenance) is a pre-existing flaky clipboard timeout, unrelated to this change.Tested on
Risk & Scope
false.Linked Issues
Fixes #8201