Repository navigation
Description
Summary
Two gh-aw v0.71.5 issues hit during real-world wiring of a pull_request_target review-panel workflow at hackathon-white-pig-8/zava-storefront. Both blocked the run before the agent started; both have local workarounds. Filing for upstream visibility.
Repro context
- gh-aw
v0.71.5 - Engine:
copilot(claude-sonnet-4.6) - Workflow uses
microsoft/[email protected]to install APM bundles - Workflow source:
pr-review-panel.md
Issue 1 — checkout: false is incompatible with PR-context triggers
When checkout: false is set under any PR trigger (pull_request or pull_request_target), the compiler still emits a Checkout PR branch step in the agent job. That step runs checkout_pr_branch.cjs via actions/github-script, which executes git fetch / git rev-parse against the runner's working directory — but with checkout: false, no actions/checkout ran, so there is no .git and the helper aborts:
fatal: not a git repository (or any of the parent directories): .git
##[error]Event type: pull_request
##[error]PR number: 3
##[error]Error message: The process '/usr/bin/git' failed with exit code 128
##[error]Attempted to check out: test/panel-smoke
##[error]ERR_API: Failed to checkout PR branch: The process '/usr/bin/git' failed with exit code 128
Failing run (pull_request): https://github.com/hackathon-white-pig-8/zava-storefront/actions/runs/25479961077
Workaround: remove checkout: false. After removal the next run was fully green: https://github.com/hackathon-white-pig-8/zava-storefront/actions/runs/25480109686.
Suggested fix: when checkout: false is in frontmatter and the trigger is PR-context, either (a) skip the Checkout PR branch helper step entirely in the compiled lock yml, or (b) emit a fast-fail at compile time so users learn this isn't a supported combination before they ship.
Issue 2 — pull_request_target × microsoft/apm-action wipes .git before the helper runs
Independent of Issue 1: with pull_request_target and checkout: true (default), the lock yml correctly emits an actions/checkout (sparse) step early in the agent job, which DOES create .git. But by the time the Checkout PR branch helper runs (after the microsoft/[email protected] step that installs bundles), .git is gone and the same fatal: not a git repository error fires.
Failing run (pull_request_target): https://github.com/hackathon-white-pig-8/zava-storefront/actions/runs/25479764768
I have not yet root-caused which step wipes .git — it's somewhere between the sparse-checkout step (lock line ~152) and the Checkout PR branch helper (lock line ~434). Strong suspicion is microsoft/apm-action (line ~430) altering the workspace, but it could be one of the intervening agent-config save/restore steps.
Workaround: switch the workflow trigger from pull_request_target to pull_request. This loses fork-safety but is acceptable in a workshop / same-org context where label application requires repo write.
Suggested investigation: repro inside gh aw test fixtures with microsoft/apm-action enabled, isolate the step that wipes .git, and either preserve the workspace or have the helper re-actions/checkout lazily before its git operations.
Why both matter together
Anyone vendoring a pull_request_target review-panel workflow alongside microsoft/apm-action (the canonical pattern for fork-safe agentic CI) currently can't ship: Issue 2 forces them off _target, and if they try checkout: false as a defensive measure on the way to pull_request, Issue 1 catches them. The combination meant ~3 hours of debugging across 4 failed runs before we got to green.
Reference
- Local fix PRs: #4 (trigger swap), #5 (remove
checkout: false) - Smoke green: run 25480109686, advisory comment posted on PR #3
Happy to bring more repro detail or test against a fix candidate.
Activity
danielmeppiel commentedon May 7, 2026
Update — RCA done locally against
gh-aw@6c1b6bd69andmicrosoft/[email protected]. The two failing runs are the same bug, not two. Issue 2 retracted;microsoft/apm-actionis innocent. Sharper Issue 1 + a patch + a branch ready to cherry-pick below.(Apologies for the original "two bugs" framing — I jumped to a
pull_request_target× supply-chain hypothesis before finishing the RCA.)Single root cause
pkg/workflow/compiler_yaml_main_job.gohas two places that emit git-dependent steps:generateGitConfigurationStepsis correctly gated onneedsGitConfig := needsCheckout || customStepsContainCheckout. The original author noted the precondition explicitly: without.git,git remote set-url originwould crash.c.generatePRReadyForReviewCheckout(yaml, data)is called unconditionally. The "Checkout PR branch" helper it emits (actions/setup/js/checkout_pr_branch.cjs) shells out togit fetch origin(line 153) andgh pr checkout(line 180) — both require a.gitdirectory. Withcheckout: falseand no custom checkout step, the workspace is bare and the helper fails the entireagentjob withfatal: not a git repositorybefore the agent ever runs.Setting
checkout: falsecorrectly suppresses gate (1) viashouldAddCheckoutStepincompiler_jobs.go:759(which honorsCheckoutDisabled), but gate (2) was missed.Proof that Issue 2 is the same bug, not a separate
pull_request_target× apm-action interactionBoth failing runs in our smoke test had
checkout: falsein their workflow source at the head SHA:25479764768(pull_request_targetvariant) — workflow source line 80:checkout: false25479961077(pull_requestvariant) — workflow source line 70:checkout: falseStep-by-step inspection of run
25479764768'sagentjob logs:[email protected]restoring APM) ran withworking-directory: .and successfully unpacked 31 files into/home/runner/work/zava-storefront/zava-storefront. No.gitto wipe —.gitwas never created by any prior step. Noactions/checkoutappears anywhere in the job's step list.Checkout PR branch) immediately failed withfatal: not a git repository (or any of the parent directories): .git.The sister
apm-prepjob'sapm-actioninvocation runs in/tmp/gh-aw/apm-workspace— entirely outside the repo workspace — so it cannot affect theagentjob's working directory either way.I also re-read
microsoft/[email protected]end-to-end:src/runner.tsand the install/restore paths never touch.git. (For what it's worth,v1.4.2was released specifically to keep apm-action from dirtying the workspace.)Patch (cherry-pick ready)
I have a branch with the fix + two regression tests at:
👉 https://github.com/danielmeppiel/gh-aw/tree/fix/pr-checkout-honor-checkout-disabled
(Couldn't open a PR —
github/gh-awblocks fork-based PRs from non-org members. Happy to do whatever wires this into your contribution flow — file under your name, get added as a contributor, etc.)The change is two files, +51/-2:
pkg/workflow/compiler_yaml_main_job.go— gate the helper on the same precondition the git-config step already uses:This preserves the existing escape hatch: if the user opted out of
actions/checkoutbut supplied a custom step that does its own checkout,customStepsContainCheckoutis true and the helper still emits.pkg/workflow/pr_ready_for_review_checkout_test.go— added two regression cases toTestPRCheckout:pull_request+checkout: false⇒ helper MUST NOT emitpull_request_target+checkout: false⇒ helper MUST NOT emitBoth fail before the patch and pass after. Full integration suite green locally:
Workaround (until fix lands)
Either:
checkout: falsefrom PR-context workflows, orsteps:that performs a checkout (will setcustomStepsContainCheckout=trueonce the fix lands; today, even without the fix, this also works because the helper at least has a.gitto operate on).Optional polish (orthogonal to the fix)
actions/setup/js/checkout_pr_branch.cjscould detectfatal: not a git repositoryin its catch path and emit a hint pointing atcheckout: false— would have saved me ~3 hours.[engsys] Keep mgmt-review agent job alive despite gh-aw checkout bug
Keep mgmt-review agent job alive despite gh-aw checkout bug (gh-aw#30…
Remove obsolete agentic checkout guard (#39426)
pelikhan commentedon Aug 25, 2026
/scout investigate status of this issue
github-actions commentedon Aug 25, 2026
github-actions commentedon Aug 25, 2026
🔍 Scout Research Report
Triggered by
@pelikhanExecutive Summary
Issue 1 (the
checkout: false+ PR-trigger crash) is already fixed onmain, merged over a month ago in PR #46771 (2026-07-20) — before this issue's own RCA patch was even proposed. A second PR, #49815 ("Fixes #30791"), added further runtime hardening but was closed without merging by@pelikhanon 2026-08-02. The issue itself is still open.Click to expand detailed findings
Research Findings
Issue 1 — already fixed on
mainpkg/workflow/pr.go'sShouldGeneratePRCheckoutStepcurrently reads:This exact guard — landed via PR #46771, "Disable checkout by default for
pull_request_targetworkflows" (merged 2026-07-20) — makesgeneratePRReadyForReviewCheckouta no-op whenevercheckout: falseis set, for any PR-context trigger (not justpull_request_target). The PR's own description independently reproduces this issue's root cause:Regression coverage exists in current
pkg/workflow/pr_test.go:79(TestShouldGeneratePRCheckoutStep_CheckoutDisabled) andpkg/workflow/pr_ready_for_review_checkout_test.go:232(TestPullRequestTargetCheckoutDisabledByDefault), both asserting no "Checkout PR branch" step is emitted.PR #46771 also auto-sets
CheckoutDisabled = trueforpull_request_targettriggers with no explicitcheckout:key — which independently neutralizes the retracted "Issue 2" scenario (pull_request_target×apm-action), since checkout is now off by default in that case too.The reporter's own patch (PR #49815) was closed, not merged
danielmeppiel's branch was later opened upstream as PR #49815, "Harden PR branch checkout against missing
.gitand lock incheckout: falsebehavior", explicitly taggedFixes #30791. It bundled two things:checkout: falsebehavior (redundant by then — Disable checkout by default for pull_request_target workflows #46771 had already shipped the fix and its own tests).actions/setup/js/checkout_pr_branch.cjs: detect a missing.git,git init, and re-addoriginbefore the fetch/checkout logic runs — a defense-in-depth layer for cases where some other step wipes workspace git metadata after checkout.A github-actions bot review commented positively on the PR, but
@pelikhanclosed it without merging or commenting on 2026-08-02. Confirmed by grepping the currentactions/setup/js/checkout_pr_branch.cjs: there is nogit init/ missing-.gitrecovery logic inmaintoday — that part of #49815 did not land.Recommendations
main; the issue can likely be closed (or narrowed to track only the runtime-hardening idea, if still wanted)..gitand lock incheckout: falsebehavior #49815 (missing-.gitauto-recovery incheckout_pr_branch.cjs). It's a reasonable defense-in-depth addition for cases where a custom step between checkout and the PR-checkout helper strips.git, but it was silently dropped — worth a one-line decision (accept/reject and why) so it isn't proposed again.microsoft/apm-action— the reporter's own RCA retracted that hypothesis, and it's independently moot now sincepull_request_targetdefaults tocheckout: false.Key Sources
pkg/workflow/pr.go,pkg/workflow/pr_test.go,pkg/workflow/pr_ready_for_review_checkout_test.goon currentmainSuggested Next Steps
hackathon-white-pig-8/zava-storefront'spr-review-panel.md), then close this issue..gitruntime recovery is still wanted, reopen it as its own scoped PR/issue rather than reviving Harden PR branch checkout against missing.gitand lock incheckout: falsebehavior #49815 as-is.pelikhan commentedon Oct 7, 2026
Status (2026-10-07; Verify resolution): The
checkout: falseportion is reported fixed by merged #46771, while the original report'spull_request_targetbehavior has not been fully verified. Confirm the remaining behavior with a current workflow before closing the issue.pelikhan commentedon Oct 16, 2026
Current-state refresher — 2026-10-16
Verdict: Apparently resolved for the reported bug. Current
main(0d15bd1649f6) supports the August Scout finding, with an important correction to the October 7 refresher.Merged #46771 fixed helper generation.
ShouldGeneratePRCheckoutStepreturns false for disabled checkout andpull_request_target; regression tests explicitly cover both conditions.The reporter's May 7 RCA retracted the separate
apm-action/workspace-wipe hypothesis: both failing runs hadcheckout: false, so neither had a.gitdirectory to wipe. That should not remain listed as an independently unresolved second bug.#49815 closed without merging; recovery if a later custom step deletes
.gitis separate defense-in-depth, not evidence that the original compiler bug persists.Remaining confirmation is a fresh reproduction using a newly compiled workflow/current version before a maintainer resolves the issue. I inspected source, tests, and merge history; I did not rerun the hosted workflow or change issue state.