-
Notifications
You must be signed in to change notification settings - Fork 367
fix: add --skip-trust to Gemini CLI command to prevent yolo override in AWF sandbox #28496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,6 +168,14 @@ func (e *GeminiEngine) GetExecutionSteps(workflowData *WorkflowData, logFile str | |
| // Without this, Gemini CLI's default approval mode rejects tool calls with "Tool execution denied by policy" | ||
| geminiArgs = append(geminiArgs, "--yolo") | ||
|
|
||
| // Skip the workspace trust check so --yolo is not overridden to "default" approval mode. | ||
| // Gemini CLI v1.x checks whether the working directory is trusted and overrides --yolo | ||
| // with "default" approval mode (exit code 55) when the folder is untrusted. | ||
| // GEMINI_CLI_TRUST_WORKSPACE=true (also set in the step env) handles the same case via | ||
| // environment variable, but --skip-trust is more reliable when AWF's sandbox does not | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| // forward all host environment variables into the container. | ||
|
Comment on lines
+171
to
+176
|
||
| geminiArgs = append(geminiArgs, "--skip-trust") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ Good fix: using |
||
|
|
||
| // Add streaming JSON output (JSONL format, compatible with the log parser) | ||
| geminiArgs = append(geminiArgs, "--output-format", "stream-json") | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,6 +156,7 @@ func TestGeminiEngineExecution(t *testing.T) { | |
| assert.Contains(t, stepContent, "id: agentic_execution", "Should have agentic_execution ID") | ||
| assert.Contains(t, stepContent, "gemini", "Should invoke gemini command") | ||
| assert.Contains(t, stepContent, "--yolo", "Should include --yolo flag for auto-approving tool executions") | ||
| assert.Contains(t, stepContent, "--skip-trust", "Should include --skip-trust flag to prevent workspace trust check from overriding --yolo") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good test coverage for the new |
||
| assert.Contains(t, stepContent, "--output-format stream-json", "Should use streaming JSON output format") | ||
| assert.Contains(t, stepContent, `--prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"`, "Should include prompt argument with correct shell quoting") | ||
| assert.Contains(t, stepContent, "/tmp/test.log", "Should include log file") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Consider adding a comment explaining why
--yolocomes before--skip-trust— the ordering might matter if Gemini CLI processes args sequentially for trust checks.