agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

Claude Code bypass permissions prompt blocks worker sessions in tmux

Open whoisasx opened this issue 8 months ago • 0 comments

Problem

After a recent Claude Code update (v2.1.x), the --dangerously-skip-permissions flag now shows an interactive confirmation prompt:

WARNING: Claude Code running in Bypass Permissions mode
...
❯ 1. No, exit
  2. Yes, I accept

Enter to confirm · Esc to cancel

This prompt requires user interaction (Down arrow + Enter to select "Yes, I accept"). Since AO worker sessions run inside tmux in detached/non-interactive mode, no one is there to press the keys. The session hangs on the prompt until it times out and exits.

Impact: All AO worker sessions using permissions: "permissionless" or permissions: "auto-edit" with the Claude Code agent are completely broken. Workers spawn, hit the prompt, and exit immediately — no work gets done.

Root Cause

  • getLaunchCommand() in packages/plugins/agent-claude-code/src/index.ts generates claude --dangerously-skip-permissions
  • Previously this flag skipped all permission prompts silently
  • Now Claude Code requires interactive confirmation before entering bypass mode
  • tmux sessions can't interact with the prompt

Fix

Wrap the launch command with a background subshell that auto-accepts the prompt by sending keystrokes via tmux send-keys after a 3-second delay:

(sleep 3 && tmux send-keys -t "$AO_TMUX_NAME" Down Enter 2>/dev/null) & claude --dangerously-skip-permissions
  • Background subshell waits for the prompt to appear (3s delay)
  • Sends Down (select "Yes, I accept") + Enter (confirm) to the tmux pane
  • Uses $AO_TMUX_NAME / $AO_SESSION_NAME env vars (already set by session manager) to target the correct pane
  • 2>/dev/null suppresses errors if the prompt was already dismissed
  • Falls back silently — doesn't affect sessions that don't show the prompt

Files Changed

  • packages/plugins/agent-claude-code/src/index.ts — wrap launch command with auto-accept for bypass mode
  • packages/plugins/agent-claude-code/src/index.test.ts — updated tests to verify the wrapper is present

Testing

  • All 149 unit tests pass
  • Verified live: spawned ao-114 for issue #816, worker successfully auto-accepted the prompt and started working

whoisasx avatar Mar 30 '26 14:03 whoisasx