AskUserQuestion hard-freezes CLI tab (Esc/Ctrl+C dead) when options use the preview/"press n to add notes" layout
Summary
The interactive AskUserQuestion prompt hard-freezes the entire CLI tab when a background agent (e.g. Explore/subagent) is running at the same time the question modal is on screen. The modal renders, but no input is captured at all — arrow keys, Enter, and Esc all do nothing. Ctrl+C does not drop back to the prompt. The only way out is to close the terminal tab.
This appears related to #83705 (background agent + AskUserQuestion hang) but manifests in the normal CLI session (not the claude agents attach view): the deadlock happens simply because a backgrounded agent and an interactive question coexist on the same TTY.
Reproduction
- In an interactive
claudesession, launch a subagent that runs in the background (Task/Agent tool, streaming). - Before it finishes, have the assistant call
AskUserQuestion(a modal with options). - The question modal appears while the background agent is still streaming.
Observed: The whole CLI tab is frozen. Navigating options does nothing, Enter does nothing, Esc does not cancel the question, Ctrl+C does not return to the prompt. Must close the tab. Running claude -c afterward correctly resumes the conversation, so the session state itself is intact — it's purely an input-loop deadlock.
Expected: The question modal captures input normally regardless of background agents, or the two are serialized so they never fight over the TTY.
Impact
Recurring (not a one-off). Any workflow that fans out background work and then asks a clarifying question can deadlock the session, forcing a tab close.
Environment
- Claude Code: 2.1.226 (reproduced); also updated to 2.1.228
- OS: Windows 11 Pro (26200)
- Terminal: Windows Terminal (
WT_SESSIONset) - Node: v22.21.0
- Shell: PowerShell / Git Bash
Notes
- Distinct from the "first keypress lost" / focus-loss cosmetic bugs (#70178, #22957) — this is a total input deadlock where even Esc/Ctrl+C are dead.
- Likely the same root cause as #83705 (background agent leaves
state: "working"whiletempo: "blocked"), surfacing in the main session input loop rather than the agent-attach guard. - Reliable avoidance: ask clarifying questions before dispatching any background agent, never after.
Showing cached comments. Read the full discussion on GitHub ↗
3 Comments
Correction — root cause is the preview/notes layout, NOT concurrency
Re-tested with fresh reproduction. My original report blamed a race between a background agent and the AskUserQuestion modal. That is wrong. The freeze reproduces with no background task running at all.
The actual trigger:
AskUserQuestionfreezes specifically when the question uses thepreviewfield on its options — the mode that switches the UI to the side-by-side layout with the option list on the left, a preview panel on the right, and the "Notes: press n to add notes" affordance at the bottom.preview(plain label + description options) render and capture input normally — reproduced clean multiple times in the same session.previewcontent hard-freeze the tab: no arrow/Enter/Esc/Ctrl+C response; only recovery is closing the tab (claude -cthen resumes the session intact).Minimal repro: call
AskUserQuestionwith a single-select question whose options include multi-linepreviewstrings (e.g. an ASCII mockup). The modal renders the split preview + "press n to add notes" footer, then accepts no input.Environment (unchanged): Claude Code 2.1.226 → 2.1.228, Windows 11 (26200), Windows Terminal, Node v22.21.0.
Likely area: the preview/notes-enabled variant of the question component enters a state where the key-input handler isn't wired (or the "n to add notes" sub-mode captures/eats the main input loop). The non-preview path is unaffected.
Thanks for the detailed follow-up narrowing this to the preview layout.
I tried to reproduce on the released 2.1.233 build (macOS, 140x45 terminal): had Claude call
AskUserQuestionwith a single-select question whose three options each had a multi-line ASCII box-drawingpreview. The side-by-side layout with "press n to add notes" rendered, and arrow keys,n(notes input accepted typing), Esc (left notes), Esc again (cancelled the question) and Enter all worked. So this looks Windows-specific and we couldn't reproduce it here without a Windows box.To help us pin it down, could you share:
claude update), andclaude doctoroutput🤖 Generated with Claude Code
We weren't able to reproduce this. Could you provide steps to trigger the issue — what you ran, what happened, and what you expected? This issue will be closed automatically if there's no activity within 7 days.