From dc72086388090c950d48741fcaa210574ae0f69d Mon Sep 17 00:00:00 2001 From: Peyton Montei Date: Wed, 18 Feb 2026 10:25:05 -0800 Subject: [PATCH] fix: Gemini e2e tests stall --- cmd/entire/cli/e2e_test/agent_runner.go | 30 +++++++++---------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/cmd/entire/cli/e2e_test/agent_runner.go b/cmd/entire/cli/e2e_test/agent_runner.go index 89fd8c191..37e2ffe15 100644 --- a/cmd/entire/cli/e2e_test/agent_runner.go +++ b/cmd/entire/cli/e2e_test/agent_runner.go @@ -9,7 +9,6 @@ import ( "fmt" "os" "os/exec" - "strings" "time" ) @@ -264,28 +263,16 @@ func (r *GeminiCLIRunner) RunPrompt(ctx context.Context, workDir string, prompt } func (r *GeminiCLIRunner) RunPromptWithTools(ctx context.Context, workDir string, prompt string, tools []string) (*AgentResult, error) { - // Build command: gemini -m -p "" --approval-mode auto_edit --allowed-tools - // --approval-mode auto_edit: auto-approves edit tools (write_file, replace) while prompting for others - // --allowed-tools: comma-separated list of tools that bypass confirmation (e.g., git commands) + // Build command: gemini -m -p "" --yolo + // --yolo (-y): auto-approves all tools, required for non-interactive e2e tests + // Note: --approval-mode auto_edit + --allowed-tools doesn't work because + // tool matching is exact (e.g., "ShellTool(git commit)" won't match + // "ShellTool(git commit -m "msg")"), causing the agent to hang waiting + // for approval in a non-interactive context. args := []string{ "-m", r.Model, "-p", prompt, - "--approval-mode", "auto_edit", - } - - // Add default git tools that should be allowed without confirmation - defaultAllowedTools := []string{ - "ShellTool(git status)", - "ShellTool(git add)", - "ShellTool(git commit)", - "ShellTool(git diff)", - "ShellTool(git log)", - } - - // Merge with any additional tools passed in - allTools := append(defaultAllowedTools, tools...) - if len(allTools) > 0 { - args = append(args, "--allowed-tools", strings.Join(allTools, ",")) + "-y", } // Create context with timeout @@ -295,6 +282,9 @@ func (r *GeminiCLIRunner) RunPromptWithTools(ctx context.Context, workDir string //nolint:gosec // args are constructed from trusted config, not user input cmd := exec.CommandContext(ctx, "gemini", args...) cmd.Dir = workDir + // ENTIRE_TEST_TTY=0 prevents git hooks (prepare-commit-msg) from trying to + // read /dev/tty for interactive confirmation, which hangs in non-interactive tests. + cmd.Env = append(os.Environ(), "ENTIRE_TEST_TTY=0") var stdout, stderr bytes.Buffer cmd.Stdout = &stdout