fix: add GEMINI_CLI_TRUST_WORKSPACE=true to unblock Gemini headless mode#28475
fix: add GEMINI_CLI_TRUST_WORKSPACE=true to unblock Gemini headless mode#28475
Conversation
…eadless mode (#28268) Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ce6af64c-bc54-4de7-8a01-d21423b6aef9 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the Gemini engine’s GitHub Actions execution environment to trust the workspace by default so Gemini CLI v1.x won’t override --yolo into default approval mode (which causes early termination / exit code 55 in headless runners).
Changes:
- Add
GEMINI_CLI_TRUST_WORKSPACE=trueto Gemini’s base env map inGetExecutionSteps. - Add a unit test assertion ensuring the compiled execution step includes
GEMINI_CLI_TRUST_WORKSPACE. - Recompile affected workflow lock output to include the new env var in both agent and detection Gemini execution steps.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/gemini_engine.go | Adds GEMINI_CLI_TRUST_WORKSPACE to the Gemini execution env so --yolo remains effective under Gemini CLI v1.x trusted-folder enforcement. |
| pkg/workflow/gemini_engine_test.go | Verifies the generated step content includes the new env var. |
| .github/workflows/smoke-gemini.lock.yml | Updates the compiled lock workflow to include the new env var for both agent and detection Gemini runs. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
🧪 Test Quality Sentinel ReportTest Quality Score: 95/100✅ Excellent test quality
Test Classification Details
AnalysisThe PR adds a single assert.Contains(t, stepContent, "GEMINI_CLI_TRUST_WORKSPACE: true", "Should include GEMINI_CLI_TRUST_WORKSPACE")Design invariant enforced: The compiled Gemini engine step output must include the Value if deleted: A regression that removes or renames the env var would go undetected — high value. Assessment: The assertion follows all project guidelines — it verifies an observable output (compiled YAML content), includes a descriptive message, and the test file has the correct Language SupportTests analyzed:
Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 95/100. Test quality is excellent — 0% of new/modified assertions are implementation tests (threshold: 30%). The added assertion directly verifies the behavioral contract of the GEMINI_CLI_TRUST_WORKSPACE env var in compiled output.
Gemini CLI v1.x introduced a trusted-folders security model that overrides
--yoloto"default"approval mode when the workspace is not trusted, causing exit code 55 with 0 turns executed before any work begins.Changes
pkg/workflow/gemini_engine.go: AddedGEMINI_CLI_TRUST_WORKSPACE: "true"to the base env map inGetExecutionSteps, alongside the other Gemini-specific vars. This env var is the official bypass for Gemini CLI v1.x's workspace trust check, allowing--yoloto function as intended in GitHub Actions runners.pkg/workflow/gemini_engine_test.go: Added assertion verifying the env var is present in the compiled execution step.All 202 workflow lock files were recompiled with the new env var present in both agent and detection execution steps.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/graphql/usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GOMOD GOMODCACHE node /opt�� prettier --check 64/bin/go **/*.ts **/*.json --ignore-path golangci-lint(http block)/usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GOMOD GOMODCACHE node /opt�� prettier --check 64/bin/go **/*.ts **/*.json --ignore-path go(http block)/usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GOMOD GOMODCACHE node /opt�� prettier --check 64/bin/go **/*.ts **/*.json --ignore-path git(http block)https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b/usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE 6164680/b400/impGO111MODULE -c 6164680/b400/embGOINSECURE GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcGO111MODULE(http block)/usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv k/gh-aw/gh-aw/pkGOINSECURE **/*.cjs $name) { hasDiscussionsEnabled } } **/*.json --ignore-path ../../../.prettiGOPATH /opt/hostedtoolcGOPROXY -o /tmp/go-build263GOSUMDB -trimpath 64/bin/go -p main -lang=go1.25 go(http block)/usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv che/go-build/e1/GOINSECURE **/*.cjs 64/bin/go **/*.json --ignore-path ../../../.pretti--noprofile /opt/hostedtoolcGOPROXY -o /tmp/go-build263GOSUMDB -trimpath 64/bin/go -p github.com/githuapi -lang=go1.25 go(http block)https://api.github.com/repos/github/gh-aw/usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch k/gh-aw/gh-aw/.gremote.origin.url rev-parse n-dir/node -json GO111MODULE r: $owner, name:/home/REDACTED/work/gh-aw/gh-aw /usr/bin/gh 1/x6�� graphql -f ache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java -f owner=github(http block)If you need me to access, download, or install something from one of these locations, you can either: