Skip to content

fix(terminal): require double Escape to interrupt Claude turns - #13566

Closed
bbingz wants to merge 2 commits into
stablyai:mainfrom
bbingz:fix/13547-escape-btw-not-interrupt
Closed

bbingz wants to merge 2 commits into
stablyai:mainfrom
bbingz:fix/13547-escape-btw-not-interrupt

Conversation

@bbingz

@bbingz bbingz commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • agent-interrupt-inference tests (26)
  • Manual: Claude working → /btw → Escape once → still working spinner; Escape twice → interrupted

Fixes #13547

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bc15076f-184f-4b2e-9b84-2ed587aae5af

📥 Commits

Reviewing files that changed from the base of the PR and between 6a0c8fa and a254cc4.

📒 Files selected for processing (2)
  • src/renderer/src/components/terminal-pane/agent-interrupt-inference.test.ts
  • src/renderer/src/components/terminal-pane/agent-interrupt-inference.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/terminal-pane/agent-interrupt-inference.test.ts
  • src/renderer/src/components/terminal-pane/agent-interrupt-inference.ts

📝 Walkthrough

Walkthrough

Claude requires two plain Escape inputs before interrupt inference triggers while Claude is working. The first Escape is ignored. The second Escape triggers inference with inputCount: 2. Claude waiting states retain single-Escape handling. Immediate flushing uses the input count, Gemini, or Codex plain-Escape interrupts. OpenCode and Copilot double-Escape handling remains unchanged.

Mergeability Score: ⚪ Minimal · up to a254c

This localized terminal behavior change requires a second Escape to interrupt Claude turns while preserving Ctrl+C behavior; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the bug, fix, linked issue, and automated testing, but it omits most required template sections and visual proof or an N/A justification. Add the required template sections, include visual proof or an N/A justification, and document manual testing status and validation details.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: requiring double Escape to interrupt Claude turns.
Linked Issues check ✅ Passed The changes address issue #13547 by requiring double Escape for working Claude turns while preserving AskUserQuestion and other agent behavior.
Out of Scope Changes check ✅ Passed The changes remain focused on agent interrupt inference, related immediate-flush compatibility, and regression tests for the linked bug.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/agent-interrupt-inference.test.ts (1)

135-149: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the positive working-turn path.

This test proves that one Escape does not infer after the settle window. It does not prove that a second Escape before the double-Escape timer expires triggers inference with inputCount: 2. Add a separate positive test for that path.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a16d931-3e31-4a5d-8467-6b470953a65c

📥 Commits

Reviewing files that changed from the base of the PR and between 6cdd019 and 16f67773e5bd2c87a0050f1e0319401a1af3614e.

📒 Files selected for processing (2)
  • src/renderer/src/components/terminal-pane/agent-interrupt-inference.test.ts
  • src/renderer/src/components/terminal-pane/agent-interrupt-inference.ts

@bbingz

bbingz commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Ready for review (contributor priority pack)

  • Rebased / checked against current main where needed
  • Scoped bugfix; summary + test plan in the description
  • Community PR: please Approve and run workflows when convenient (fork CI stays off)
  • No maintainer merge expected from us — happy to iterate on review comments

Part of a short priority list for maintainers: P0 #13609 #13566 · hot #13710 #13692 #13691 #13536 #13572 #8072 #13237 · easy #13570 #13561 #13255.

bbingz added a commit to bbingz/orca that referenced this pull request Aug 11, 2026
Require two Escapes for Claude only while working so /btw dismiss stays
non-interrupt. AskUserQuestion waiting keeps single Escape for
inferQuestionAnswered, matching the main-process contract.

Addresses review on stablyai#13566
@bbingz
bbingz force-pushed the fix/13547-escape-btw-not-interrupt branch from 5068318 to 7189a3d Compare August 11, 2026 19:25
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

bbingz added 2 commits August 14, 2026 08:01
Claude Code uses plain Escape for TUI cancel (/btw composer, menus) without
stopping the turn. Treating a single Escape as interrupt flipped the pane to
false red \"Interrupted\". Align Claude with OpenCode/Copilot double-Escape.

Fixes stablyai#13547.
Require two Escapes for Claude only while working so /btw dismiss stays
non-interrupt. AskUserQuestion waiting keeps single Escape for
inferQuestionAnswered, matching the main-process contract.

Addresses review on stablyai#13566
@bbingz
bbingz force-pushed the fix/13547-escape-btw-not-interrupt branch from 7189a3d to a254cc4 Compare August 14, 2026 00:01
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@bbingz

bbingz commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Community PR: please Approve and run workflows on head a254cc48c8 when convenient (fork CI stays gated). Claude double-Escape for working turns rebased onto #14372 Codex immediate-flush.

@bbingz

bbingz commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Full PR Checks run for this exact head, green.

a254cc48c8 — https://github.com/bbingz/orca/actions/runs/32265818591

The fork workflow run on this PR sits at action_required and never executes, so this PR has shown an empty check list since it was opened. I enabled Actions on my own fork and ran the repository's own pr.yml there against this exact SHA, so there is at least verifiable evidence while the upstream run stays unapproved.

Happy to re-run it after any change you'd like.

@nwparker

Copy link
Copy Markdown
Contributor

Thank you for this, and sorry it sat so long.

#13547 is now fixed by #20149 (merged as fe4237c), so this is closing as superseded. The merged fix takes a different remedy from yours, and I want to be specific about why rather than leave it unexplained — and about the part of yours we did need.

What we took from your PR. You spotted that Claude's AskUserQuestion dismissal must stay on the single-Escape path, and you protected it by gating on state === 'working'. That constraint is real and easy to miss: the dismissal is also a plain Escape, but on a waiting row, so any rule that treats "plain Escape from Claude" uniformly breaks the question card. The merged change scopes its renderer-side skip with exactly that state === 'working' condition, for exactly your reason.

Why not double Escape. A second Escape raises the threshold but adds no information — it is the same ambiguous key pressed again, and closing two stacked overlays produces precisely that sequence, so the false positive survives in a rarer form. It also moves the cost onto the common path: every genuine interrupt then needs two presses, and a single press leaves the row spinning. The merged rule instead stops trying to read intent out of the keystroke at all for these agents and waits for the provider's own hook, which is where the answer actually lives.

That is a judgement about the remedy, not about the diagnosis — your read of the bug was correct, and so was the AskUserQuestion catch. Thanks for taking the time on it.

@nwparker nwparker closed this Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Escape dismissing Claude Code's /btw composer is inferred as a turn interrupt (false red "Interrupted")

4 participants