`claude --bg` code-writing sessions stall on permission prompts with no non-interactive way to reply (acceptEdits insufficient)
Discovered while piloting single-terminal background dispatch (claude agents/claude --bg) for real development work on Claude Code 2.1.157.
What's wrong
When dispatching a background session with claude --bg that needs to write code, the session stalls on a permission prompt even under --permission-mode acceptEdits, and there is no non-interactive way to answer it from the shell. This blocks unattended automation.
Steps to reproduce
claude --bg --model opus --permission-mode acceptEdits --name test "create a Foo.cs class; delegate the actual write to a c-sharp-pro subagent"- The dispatched (top-level) session spawns a subagent that calls
Write. claude agents --jsonshows the sessionstatus: "waiting"— blocked on a permission prompt:1. Yes / 2. Yes, allow all edits during this session.- There is no
claude reply <id> <choice>equivalent.claude logsis read-only;claude attachneeds an interactive TTY, unavailable in headless automation.
Expected
Either acceptEdits auto-approves the subagent's Write in a background session, or a non-interactive way exists to answer a pending prompt from the shell (e.g. claude reply <id> <choice>).
Actual
Session hangs in waiting indefinitely. The only workaround is --permission-mode bypassPermissions, which itself requires a one-time interactive claude --dangerously-skip-permissions disclaimer acceptance — defeating unattended use.
Environment
- Claude Code 2.1.157
- Windows 11, Anthropic API, terminal (cross-platform relevant)
Related
#36170, #39889
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗