[BUG] Pressing Esc to exit /btw mode rejects the pending tool-use prompt instead of just exiting the mode
Summary
When in /btw mode with a tool-use / permission prompt pending from the assistant, pressing Esc — which is the way to exit /btw mode — gets routed to the pending prompt and declines/rejects the tool use, instead of simply exiting /btw mode. The user only intended to leave /btw mode, but the assistant receives a "user rejected the tool use" signal and changes course.
Steps to reproduce
- Enter
/btwmode. - While in
/btwmode, have the assistant issue a tool call that triggers a permission/confirmation prompt (e.g. anAskUserQuestion, or any tool requiring approval). - Press Esc to exit
/btwmode (the documented/only way out of the mode).
Expected
Esc exits /btw mode and leaves the pending tool-use prompt untouched (still pending, or otherwise unaffected). Exiting a mode and rejecting a tool call should not be conflated.
Actual
Esc is consumed by the pending tool-use prompt and declines it. The assistant is told the user rejected the tool use (even though the user did not intend to decline anything), and there is no separate way to exit /btw mode without hitting the prompt.
Impact
- The assistant misinterprets the Esc as a deliberate rejection and abandons / redirects whatever it was doing.
- The user is effectively unable to exit
/btwmode while a tool prompt is pending without side effects.
Environment
- Claude Code: 2.1.150
- OS: macOS (Darwin 25.5.0)
Notes
Key conflict: /btw mode's only exit is Esc, but Esc is also the reject/cancel key for a pending tool-use permission prompt. When both are active, the prompt swallows the Esc. A possible fix would be to have Esc exit the mode first (without rejecting the pending tool call), or to provide a distinct keybinding for exiting /btw mode.
13 Comments
Commenting to keep this bug report on Anthropic's radar.
Upvote if you are reading this and have the problem described
I noticed this behavior occurred for me after the introduction of the fullscreen tui. Try doing a "/tui default" and see if that resolves for you (it did for me).
we need this fix 🤓
I'm switching from claude code to goose. (Note Anthropic is part of the AAIF, so they shouldn't be too mad about it.) But probably going to be paying less attention to claude code bugs now. If there's a bug in goose, I can fix it myself.
I have noticed this behavior on Mac, Windows, and Raspberry PI both natively and via SSH sessions. Please pick something else to switch from or close the btw session. It's a great feature! But as is, unusable.
Any news on this bug? It's really annoying and open for quite a while
I'm on Mac, ghostty, claude code v2.1.212
ping
Still reproduces on 2.1.227 (macOS,
"tui": "fullscreen"), and nothing in the 2.1.228 changelog touches this — so it has survived ~2.5 months. (I have not tested @tekstrong's/tui defaultworkaround, so I can't confirm or rule it out.)One detail that hasn't been mentioned yet, and that I think narrows the fix: there is no
Btwcontext in the keybindings registry at all. The documented context list isGlobal, Chat, Autocomplete, Confirmation, Help, Transcript, HistorySearch, Task, ThemePicker, Settings, Tabs, Attachments, Footer, MessageSelector, DiffDialog, DiffPanel, ModelPicker, Select, Plugin, Scroll— no btw/side-channel entry — and there is nobtw:*action either.So Esc typed inside btw scope isn't being "swallowed by the prompt" so much as it never had a handler of its own: it falls straight through to
Confirmation→confirm:no(default keysescape,n). Same mechanism explains the sibling reports where Esc kills a focused background agent instead (chat:cancel, alsoescape).Two consequences:
~/.claude/keybindings.json, because there is no context to rebind — the only lever is unbindingescapefromConfirmationglobally, which costs Esc-to-deny in every permission dialog and may just fall through tochat:cancelanyway.escapeahead ofConfirmation/Chat, and expose it as a rebindablebtw:exitaction.Related reports of the same root cause, all open: #74959, #78876, #81977, #69416 (auto-marked
stale).Reproduced on v2.1.233 (macOS, default permission mode).
Steps:
claudein an empty project.Use the AskUserQuestion tool to ask me whether I prefer cats or dogs.(a Bash command that needs approval behaves the same)./btw what is 3+3? answer in one word. The/btwoverlay opens with the answer, and the question/permission prompt appears above it.Esconce, intending to close the/btwoverlay.Observed: the
Escis consumed by the pending prompt — the transcript shows⏺ User declined to answer questions(for the Bash case the command is rejected and never runs), and the/btwoverlay is still open. A secondEsccloses the overlay.Expected:
Esccloses the/btwoverlay and leaves the pending question/permission prompt untouched.Assessment: This is a genuine bug and a regression. Until roughly v2.1.141 (mid-May 2026), a permission or question prompt that arrived while the
/btwoverlay was open stayed hidden until you dismissed the overlay, soEsconly ever closed/btw. Since then the prompt is shown and takes keyboard focus underneath the still-open overlay, so the firstEscanswers the prompt (as "no") instead of closing the overlay. The same root cause affects other overlays such as/usage(#86491). The fix is to keep pending permission prompts parked while a/btw-style overlay is open, soEscgoes to the overlay first.🤖 Generated with Claude Code
I have found that <Return> instead of ESC exits the /btw without cancelling the prompt. It hasn't collided with a decision prompt for me yet, but I have not tested exhaustively.
Confirmed — reproduced on 2.1.233 (Linux terminal).
With the
/btwpanel open (showing "Esc to close") and a pending prompt in the main conversation, one press of Esc went to the pending prompt, not the panel:/btwpanel stayed open.A second Esc then closes the panel — exactly the behavior you describe. This is a real key-conflict bug: the panel's own "Esc to close" hint should win while it's focused. We're looking at making Esc close the
/btwpanel first (or giving the panel a distinct close key) so exiting the mode can't silently reject a pending tool call.🤖 Generated with Claude Code
Cheap interim mitigation that needs no change to the propagation logic: the overlay already accepts Space and Enter to close, and neither key is treated as reject/cancel by the underlying prompt. So change the footer hint from "esc to close" to "space or enter to close". That steers users away from the colliding key for the common case even before the deeper fix lands.
The text change alone reduces the footgun.
Related open reports of the same root cause: #88013, #64568, #83026, #63092, #81977. Prior closed duplicates: #75201, #79045, #75680, #65153, #69416, #65781.
🤖 Generated with Claude Code
Wtf are "you" talking about?
The /btw panel treats Space as an input character for the prompt field - you know, the purpose of the prompt field - and Enter as the submit key for that prompt.
So no, neither key "closes the overlay" in any meaningful sense while the prompt is focused. They perform the exact actions they’re supposed to perform.
Just make the panel capture the Escape key, and not the underlying stuff.
🧠 Generated with my fucking brain