From fc470886ac286de1aba5b6205babf73aad6051b7 Mon Sep 17 00:00:00 2001 From: Eric Minish Date: Tue, 20 Oct 2026 00:22:24 -0400 Subject: [PATCH] fix(agent-eval): accept the trust dialog on "Yes", never type into a bare shell (#1925) Current Claude Code builds list the per-folder trust dialog's options in a different order, so itrun.sh now moves onto "Yes, I trust this folder" before pressing Enter, whichever order the build uses, and stops instead of typing the prompt into a bare shell when claude has already exited. Co-Authored-By: Claude Opus 5.5 --- scripts/agent-eval/itrun.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/agent-eval/itrun.sh b/scripts/agent-eval/itrun.sh index f9becee3a..9289696f8 100755 --- a/scripts/agent-eval/itrun.sh +++ b/scripts/agent-eval/itrun.sh @@ -38,15 +38,28 @@ done [ "$ready" = 1 ] || { echo "claude never drew its UI"; cap; tmux kill-session -t "$SESSION" 2>/dev/null; exit 1; } # Accept the per-folder "Is this a project you trust?" dialog if it shows (first -# time claude opens a given repo). Option 1 ("Yes, I trust this folder") is -# pre-selected, so Enter accepts. This dialog also contains ❯, so it must be -# cleared before the type-and-verify loop or keystrokes land on the menu. +# time claude opens a given repo). Which option is pre-selected varies by Claude +# Code version — current builds put "No, exit" first — so move the cursor onto +# "Yes, I trust this folder" explicitly before pressing Enter; a bare Enter on +# "No, exit" quits claude. This dialog also contains ❯, so it must be cleared +# before the type-and-verify loop or keystrokes land on the menu. for _ in $(seq 1 20); do cap | grep -q "trust this folder" || break - tmux send-keys -t "$SESSION" Enter + if cap | grep -qE "❯ *([0-9]\. *)?No, exit"; then tmux send-keys -t "$SESSION" Down; sleep 0.5; fi + cap | grep -qE "❯ *([0-9]\. *)?Yes, I trust" && tmux send-keys -t "$SESSION" Enter sleep 1 done +# Never type into a bare shell. If claude exited (declined dialog, bad flag, +# crash), the type-and-verify loop below would still "see" the prompt echoed at +# the shell and send it as a command. claude must still be the pane's program. +sleep 2 +case "$(tmux display -p -t "$SESSION" '#{pane_current_command}')" in + bash|zsh|sh|fish|dash) + echo "claude exited before the prompt was sent (pane is a shell) — aborting" + cap; tmux kill-session -t "$SESSION" 2>/dev/null; exit 1 ;; +esac + # Type-and-verify: send the prompt, confirm a distinctive chunk of it actually # landed in the input box, retry if it didn't (handles the early-❯ race where # the welcome screen shows the prompt glyph but MCP init is still eating keys).