Summary
PR #31622 (merged 2026-05-12 13:48 UTC) added a dev-mode gh aw runtime setup step that runs gh extension remove gh-aw || true; gh extension install .; gh aw version, without setting GH_TOKEN. gh extension install . shells out to gh and fails with the standard error:
gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable.
The step exits with code 4, the agent job fails, and the entire workflow run is marked failure. This already broke today's run of Static Analysis Report (a daily scheduled workflow). Two more dev-mode workflows carry the same defective step and will fail on their next schedule.
Affected workflows and runs
| Workflow |
Lock file step |
Last known result |
First failure |
| Static Analysis Report |
static-analysis-report.lock.yml:441-445 |
Green daily 2026-05-04 → 2026-05-12 (§25716057035 succeeded 2026-05-12) |
§25781225241 failed 2026-05-13 05:55 UTC, exit code 4 |
| Copilot Token Audit |
copilot-token-audit.lock.yml:436-440 |
(not yet run since PR #31622) |
Will fail on next schedule |
| Copilot Token Optimizer |
copilot-token-optimizer.lock.yml:405-409 |
(not yet run since PR #31622) |
Will fail on next schedule |
All three lock files were modified by PR #31622 and contain the identical generated step:
- name: Build and install gh-aw CLI from source
run: |
gh extension remove gh-aw || true
gh extension install .
gh aw version
The very next step in each file (Configure gh CLI for GitHub Enterprise) does pass GH_TOKEN: ${{ github.token }} — the new step was simply missed.
Root cause
pkg/workflow/runtime_step_generator.go:61-73 emits the dev-mode gh-aw setup step but never attaches an env: block:
if runtime.ID == "gh-aw" && !IsRelease() {
step := GitHubActionStep{" - name: Build and install gh-aw CLI from source"}
if req.IfCondition != "" {
step = append(step, " if: "+req.IfCondition)
}
step = append(step,
" run: |",
" gh extension remove gh-aw || true",
" gh extension install .",
" gh aw version",
)
return step
}
gh extension install . (and the preceding gh extension remove) invoke gh, which refuses to run without GH_TOKEN/GITHUB_TOKEN in a GitHub Actions context.
Failure excerpt — run 25781225241 / agent job
##[group]Run gh extension remove gh-aw || true
gh extension remove gh-aw || true
gh extension install .
gh aw version
...
gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Example:
env:
GH_TOKEN: ${{ github.token }}
gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Example:
env:
GH_TOKEN: ${{ github.token }}
##[error]Process completed with exit code 4.
Why this didn't show up in PR validation
PR #31622's validation ran targeted workflow runtime tests for detection and setup-step generation plus code review + CodeQL. Those checks do not execute the generated step against a real Actions runner, and the existing assertion in pkg/workflow/runtime_step_generator.go tests only verifies that the literal string gh extension install . appears in the rendered YAML — it does not assert anything about the surrounding env: block.
Proposed remediation
Fix the generator so every dev-mode gh-aw setup step carries env: GH_TOKEN: ${{ github.token }} (and GITHUB_TOKEN if needed for parity with the next step), then re-compile the three affected lock files.
Specifically:
- In
pkg/workflow/runtime_step_generator.go, append:
" env:",
" GH_TOKEN: ${{ github.token }}",
to the dev-mode branch before return step.
- Re-run
gh aw compile so the three .lock.yml files pick up the env block.
- Add a unit test in
pkg/workflow/runtime_gh_aw_test.go (or a new test) asserting the dev-mode step contains GH_TOKEN: ${{ github.token }}.
- Verify by re-running
Static Analysis Report via workflow_dispatch on the fix branch.
Success criteria
Related
References:
Generated by [aw] Failure Investigator (6h) · ● 15.1M · ◷
Summary
PR #31622 (merged 2026-05-12 13:48 UTC) added a dev-mode
gh awruntime setup step that runsgh extension remove gh-aw || true; gh extension install .; gh aw version, without settingGH_TOKEN.gh extension install .shells out toghand fails with the standard error:The step exits with code 4, the
agentjob fails, and the entire workflow run is marked failure. This already broke today's run ofStatic Analysis Report(a daily scheduled workflow). Two more dev-mode workflows carry the same defective step and will fail on their next schedule.[aw-failures]parent report ([aw-failures] [aw] Failure Report 2026-05-11 (6h): aw-portfolio-yield workflow defect blocks compile + own runtime + recurrences [Content truncated due to length] #31455).Affected workflows and runs
static-analysis-report.lock.yml:441-445copilot-token-audit.lock.yml:436-440copilot-token-optimizer.lock.yml:405-409All three lock files were modified by PR #31622 and contain the identical generated step:
The very next step in each file (
Configure gh CLI for GitHub Enterprise) does passGH_TOKEN: ${{ github.token }}— the new step was simply missed.Root cause
pkg/workflow/runtime_step_generator.go:61-73emits the dev-modegh-awsetup step but never attaches anenv:block:gh extension install .(and the precedinggh extension remove) invokegh, which refuses to run withoutGH_TOKEN/GITHUB_TOKENin a GitHub Actions context.Failure excerpt — run 25781225241 / agent job
Why this didn't show up in PR validation
PR #31622's validation ran
targeted workflow runtime tests for detection and setup-step generationplus code review + CodeQL. Those checks do not execute the generated step against a real Actions runner, and the existing assertion inpkg/workflow/runtime_step_generator.gotests only verifies that the literal stringgh extension install .appears in the rendered YAML — it does not assert anything about the surroundingenv:block.Proposed remediation
Fix the generator so every dev-mode
gh-awsetup step carriesenv: GH_TOKEN: ${{ github.token }}(andGITHUB_TOKENif needed for parity with the next step), then re-compile the three affected lock files.Specifically:
pkg/workflow/runtime_step_generator.go, append:return step.gh aw compileso the three.lock.ymlfiles pick up the env block.pkg/workflow/runtime_gh_aw_test.go(or a new test) asserting the dev-mode step containsGH_TOKEN: ${{ github.token }}.Static Analysis Reportvia workflow_dispatch on the fix branch.Success criteria
pkg/workflow/runtime_step_generator.goemitsenv.GH_TOKENfor the dev-modegh-awstep..lock.ymlfiles containGH_TOKEN: ${{ github.token }}on theBuild and install gh-aw CLI from sourcestep.workflow_dispatchofStatic Analysis Reporton the fix branch completes with conclusionsuccess.Static Analysis Reportrun after merge is green.Related
Treat gh aw as a first-class runtime with release setup-cli injection, dev source build, and firewall domains.References:
Related to [aw-failures] [aw] Failure Report 2026-05-11 (6h): aw-portfolio-yield workflow defect blocks compile + own runtime + recurrences [Content truncated due to length] #31455