claude -r / Agent View hangs indefinitely and stops responding to keyboard input (Esc included) after "trust this folder" confirmation
Description
claude -r (and the Agent View it opens) hangs indefinitely and stops responding to keyboard input, including Esc. The only way out is kill <pid> from another terminal.
Environment
- Claude Code version: 2.1.204
- OS: macOS (Darwin 25.5.0)
- Install path:
/Users/ila/.local/bin/claude(/Users/ila/.local/share/claude/versions/2.1.204) - Terminal: standard macOS Terminal.app, zsh
Steps to reproduce
- Run
claude -rin any directory. - The Agent View dashboard opens (
Needs input/Working/Completedsections,> describe a task for a new sessionprompt). - Reproduced twice:
- Plain
claude -r: the dashboard itself becomes unresponsive to all keys, includingEsc. claude -r --bare: a "Yes, I trust this folder" / "No, exit" prompt appears over the dashboard. Arrow keys move the selection, andEntervisibly checks "Yes, I trust this folder ✓" — so keyboard input is reaching the UI — but nothing happens afterward.Escno longer does anything either.
In both cases the process must be killed from a second terminal to recover; closing the terminal window otherwise leaves it stuck.
Diagnostics collected
ps aux | grep claude while hung shows the foreground claude -r process plus a per-session "transient" daemon and background spare/pty-host processes, e.g.:
ila 5803 claude -r
ila 5821 /Users/ila/.local/bin/claude daemon run --origin transient --spawned-by {"label":"claude","cwd":"/Users/ila","pid":5803}
ila 5839 claude bg-spare --bg-spare /tmp/cc-daemon-502/<id>/spare/63340ab8.claim.sock
ila 5835 claude bg-pty-host --bg-pty-host /tmp/cc-daemon-502/<id>/spare/63340ab8.pty.sock 200 50 -- .../versions/2.1.204 --bg-spare ...
~/.claude/daemon.log shows a repeating pattern where the daemon claims a pre-warmed "spare" background session and spawns its PTY host, but the matching "settled" event that should follow is either very slow (up to ~3 minutes in successful runs) or never appears (in the hung run):
[...] [bg] bg claimed-spare 8b4b1f06 (spare)
[...] [bg] bg spare spawned host pid=4432
[... ~3 min gap in a "successful" run, or nothing at all in the hung run ...]
[...] [bg] bg settled 8b4b1f06 (killed)
sample <pid> 3 on the hung foreground process shows all threads (main thread, HTTP Client thread) idle in kevent64, i.e. genuinely blocked waiting for an event rather than spinning — consistent with the process waiting forever on a response from the daemon/spare-host handshake ("settle") that never arrives.
This reproduced consistently across multiple separate invocations, in a fresh directory (~, not a git repo) with no unusual load on the machine (no other claude-related process using significant CPU).
Expected behavior
claude -r opens the resume picker / Agent View and responds normally to Esc and other keys. Confirming "trust this folder" should immediately proceed (attach to the session or return to the list), not hang.
Workaround
From a second terminal: ps aux | grep claude, find the PID of the specific hung claude -r process, kill <pid>. This frees the terminal but the same hang reproduces on the next claude -r call.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗