AskUserQuestion hard-freezes CLI tab (Esc/Ctrl+C dead) when options use the preview/"press n to add notes" layout

Status Closed — not planned
Reported on v2.1.226
Maintainer reply ✓ Yes — bcherny
Activity 4 comments · opened Aug 12, 2026 · closed Aug 23, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

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

  1. In an interactive claude session, launch a subagent that runs in the background (Task/Agent tool, streaming).
  2. Before it finishes, have the assistant call AskUserQuestion (a modal with options).
  3. 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_SESSION set)
  • 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" while tempo: "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.

View original on GitHub ↗

3 Comments

daltonloomis0818 · 18 days ago

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: AskUserQuestion freezes specifically when the question uses the preview field 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.

  • Questions without preview (plain label + description options) render and capture input normally — reproduced clean multiple times in the same session.
  • Questions with preview content hard-freeze the tab: no arrow/Enter/Esc/Ctrl+C response; only recovery is closing the tab (claude -c then resumes the session intact).

Minimal repro: call AskUserQuestion with a single-select question whose options include multi-line preview strings (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.

bcherny collaborator · 15 days ago

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 AskUserQuestion with a single-select question whose three options each had a multi-line ASCII box-drawing preview. 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:

  • Whether it still happens on 2.1.233 (claude update), and claude doctor output
  • Whether it reproduces in plain PowerShell / cmd.exe as well as Git Bash, and in a non-Windows-Terminal console (e.g. conhost)
  • Your terminal size (columns x rows) when it freezes, and whether it also freezes with a tiny preview (e.g. a single short line) vs. a tall multi-line mockup
  • Whether CPU usage spikes while it's frozen (Task Manager), which would tell us if it's a rendering loop vs. dropped input

🤖 Generated with Claude Code

github-actions[bot] · 15 days ago

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.

Showing cached comments. Read the full discussion on GitHub ↗