Conversation
PR SummaryLow Risk Overview Also forces Written by Cursor Bugbot for commit dc72086. Configure here. |
There was a problem hiding this comment.
Pull request overview
Updates the Gemini e2e agent runner to avoid non-interactive stalls when running Gemini CLI-driven workflows in Entire’s e2e test suite.
Changes:
- Switch Gemini runner invocation to use Gemini’s full auto-approval mode (
-y/--yolo) to prevent hanging on tool confirmations. - Add
ENTIRE_TEST_TTY=0to the Gemini runner subprocess environment to prevent git hooks from attempting/dev/ttyinteraction during agent-driven commits.
| func (r *GeminiCLIRunner) RunPromptWithTools(ctx context.Context, workDir string, prompt string, tools []string) (*AgentResult, error) { | ||
| // Build command: gemini -m <model> -p "<prompt>" --approval-mode auto_edit --allowed-tools <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 <model> -p "<prompt>" --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", | ||
| } |
There was a problem hiding this comment.
tools is now unused for the Gemini runner (everything is auto-approved via -y), which makes RunPromptWithTools misleading and may trigger unparam/unused-arg linting when the e2e build tag is included. Consider renaming the parameter to _ (or explicitly consuming it with a short comment) and documenting that tool allowlisting isn’t supported for Gemini in this runner.
| // --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 |
There was a problem hiding this comment.
The explanatory comment here is hard to read because of nested quotes (e.g., "... -m "msg""). Rephrasing the example (or using single quotes in the example strings) would avoid confusion when someone later revisits why --allowed-tools was removed.
| // "ShellTool(git commit -m "msg")"), causing the agent to hang waiting | |
| // "ShellTool(git commit -m 'msg')"), causing the agent to hang waiting |
| // 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") |
There was a problem hiding this comment.
Setting ENTIRE_TEST_TTY=0 here prevents interactive git-hook prompts during agent-driven git commit -m, but this same hang risk applies to other agent runners too (e.g., Claude). Consider applying the same environment override consistently for all agent subprocesses so e2e behavior doesn’t depend on which agent is selected or whether the developer has a real /dev/tty available.
No description provided.