From 6d4a1a0586ac3b89a40f48200d218a51d7684e61 Mon Sep 17 00:00:00 2001 From: Thomas SharedInbox Date: Sun, 17 May 2026 07:24:06 +0200 Subject: [PATCH] fix(agent-loop): answer workspace-trust dialog by piping a newline to stdin The new Claude Code trust dialog appeared inside the tmux PTY despite -p mode and stdout being piped, blocking the agent indefinitely. With < /dev/null the dialog could never be answered. Replace < /dev/null with printf '\n' | so the Enter keypress confirms the default "Yes, I trust this folder" option. After that single newline stdin reaches EOF, which -p mode ignores. Co-Authored-By: Claude Sonnet 4.6 --- scripts/agent_loop.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/agent_loop.py b/scripts/agent_loop.py index 7ad2427..729a2c7 100755 --- a/scripts/agent_loop.py +++ b/scripts/agent_loop.py @@ -175,11 +175,14 @@ def _start_agent(prompt: str, session_name: str) -> str: # Kill any stale session with this name before creating a new one. subprocess.run(["tmux", "kill-session", "-t", session_name], capture_output=True) + # printf '\n' answers the workspace-trust dialog (press Enter to confirm the + # default "Yes, I trust this folder") when claude shows it despite -p mode. + # After that newline, stdin hits EOF, which -p mode ignores. shell_cmd = ( - f"claude --dangerously-skip-permissions" + f"printf '\\n' | claude --dangerously-skip-permissions" f" --name {shlex.quote(session_name)}" f" -p {shlex.quote(prompt)}" - f" < /dev/null 2>&1 | tee {shlex.quote(str(log_file))}" + f" 2>&1 | tee {shlex.quote(str(log_file))}" ) subprocess.run( ["tmux", "new-session", "-d", "-s", session_name, "bash", "-c", shell_cmd],