arc-dind: "Copy Copilot CLI to daemon-visible path" fails with "are the same file" after the rootless install moved to $RUNNER_TEMP/gh-aw/bin (v1.2.2)
Summary
On runner.topology: arc-dind, the compiled Copy Copilot CLI to daemon-visible path step runs cp on a file onto itself and exits non-zero, so the detection job fails (and with it every safe output, since safe_outputs is skipped). Since v1.2.2 the rootless Copilot install already lands in ${RUNNER_TEMP}/gh-aw/bin/, which is exactly the copy's destination. The step still assumes the install is in ~/.local/bin.
Regression from #75445 / #75446 (merged 2026-11-07, shipped in v1.2.2). The same step passes on v1.2.0.
Environment
| gh-aw | v1.2.2 (compiler and github/gh-aw-actions/setup) |
| topology | runner.topology: arc-dind, self-hosted ARC runners (runs-on a runner scale set) |
| engine | pi main engine; threat detection runs copilot (threat-detect v0.5.3, COPILOT_MODEL=claude-sonnet-5.5) |
| Copilot CLI | 1.0.103, installed with --rootless |
Observed
The detection job's Install GitHub Copilot CLI step succeeds:
bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.103 --rootless --checksums-sha256 ... --prefer-toolcache --cooldown-days 3
Installing GitHub Copilot CLI version 1.0.103 (os: Linux, arch: x86_64)...
then the next compiled step fails:
Run mkdir -p "${RUNNER_TEMP}/gh-aw/bin"
COPILOT_SRC="$(command -v copilot)"
cp "$COPILOT_SRC" "${RUNNER_TEMP}/gh-aw/bin/copilot"
chmod +x "${RUNNER_TEMP}/gh-aw/bin/copilot"
cp: '/home/runner/_work/_temp/gh-aw/bin/copilot' and '/home/runner/_work/_temp/gh-aw/bin/copilot' are the same file
Copy Copilot CLI to daemon-visible path is the only failed step. The rest of the detection job is skipped, safe_outputs and the other downstream jobs are skipped, and the run ends failure. The agent job (same workflow, pi engine) is green.
Root cause
pkg/workflow/nodejs.goL283-L293 emits the step. Its comment says that with--rootlessthe binary is at~/.local/bin/copilot, and it copies unconditionally from$(command -v copilot)to${RUNNER_TEMP}/gh-aw/bin/copilot.pkg/workflow/copilot_engine_installation.goL138-L140 carries the same stale comment.actions/setup/sh/install_copilot_cli.shL15 and L135 now put a--rootlessinstall under$RUNNER_TEMP/gh-aw/bin("the job-scoped gh-aw tree, which AWF mounts read-only"), and the script prepends that directory toPATH, socommand -v copilotreturns the destination itself.
So the install location and the copy destination are the same path, and the copy is redundant in that case. arc_dind_copilot_staging_test.go does not cover a rootless install into gh-aw/bin.
Suggested fix
Make the copy idempotent:
COPILOT_SRC="$(command -v copilot)"
COPILOT_DST="${RUNNER_TEMP}/gh-aw/bin/copilot"
[ "$COPILOT_SRC" -ef "$COPILOT_DST" ] || cp "$COPILOT_SRC" "$COPILOT_DST"
chmod +x "$COPILOT_DST"
Alternatively drop the step when the install is already under ${RUNNER_TEMP}/gh-aw/bin, and update the two stale comments.
Acceptance criteria
- A workflow compiled with
runner.topology: arc-dindand--rootlessinstallation runs the detection job to completion, with the staging step a no-op when source and destination are the same file. - A test compiles an ARC/DinD workflow and asserts the staging step does not fail when the install directory is
${RUNNER_TEMP}/gh-aw/bin. - The non-rootless path (source
/usr/local/bin/copilot, destinationgh-aw/bin/copilot) still copies.
Impact
Every workflow compiled with runner.topology: arc-dind whose threat detection uses the Copilot CLI (the pi and copilot engines) fails the detection job on v1.2.2, and with detection failing the workflow's safe outputs never run. It happens whatever runner the detection job itself runs on: moving safe-outputs.threat-detection.runs-on to a GitHub-hosted runner fails at the same step, because the topology is a workflow-level setting, the compiler still emits the staging step, and the install is --rootless into $RUNNER_TEMP/gh-aw/bin there too.
v1.2.0 is unaffected. There is no frontmatter workaround: runner.installation: privileged is rejected with runner.topology: arc-dind (validateRunnerConfig), so the only options are staying on v1.2.0 or dropping the topology.
Related
- #66926 (arc-dind: threat detection sandbox scope, same area; #75690 addressed the read-access half in v1.2.2)
- #75445, #75446 (introduced the rootless install location)
Confirming the same failure from a second repository, on runner.topology: arc-dind (self-hosted ARC runners), gh-aw v1.2.2 compiler and github/gh-aw-actions/setup, threat-detect v0.5.3, Copilot CLI 1.0.103 installed with --rootless --prefer-toolcache.
The detection job's Install GitHub Copilot CLI step finds the toolcache binary and writes a wrapper into the job tree:
Using cached GitHub Copilot CLI from /opt/hostedtoolcache/copilot-cli/1.0.103/x64/bin/copilot
Installing wrapper at /home/runner/work/_temp/gh-aw/bin/copilot
Resolved copilot binary: /home/runner/work/_temp/gh-aw/bin/copilot
and the next compiled step fails:
COPILOT_SRC="$(command -v copilot)"
cp "$COPILOT_SRC" "${RUNNER_TEMP}/gh-aw/bin/copilot"
cp: '/home/runner/work/_temp/gh-aw/bin/copilot' and '/home/runner/work/_temp/gh-aw/bin/copilot' are the same file
After that threat-detect is not found on PATH, safe_outputs is skipped and the run ends failure; the agent job is green. The toolcache path (not only a fresh download) hits it, so -ef before the cp, as suggested above, covers it.
Affected runs, all with a Copilot-CLI detector (pi main engine and a pi-engine pull request review), same single failed step each time: 43105264831, 43106331694 and 43133897143 in IntuitiveWebSolutions/BriteCore (private). The same workflows compiled with v1.2.0 pass, and a Claude-engine workflow (no Copilot detector) on v1.2.2 is not affected. We reverted to v1.2.0 while waiting for a fix.
I can also confirm, the bug seems to be introduced in "gh aw" 1.2.2, while 1.2.1 works for us.
I can also confirm that using 1.2.1 works for me but 1.2.2 does not.
Bug confirmed on my side too
@pelikhan any idea of when this would be picked up? It prevents us from upgrading to newer versions. The fix looks small (skip the copy when the source is already the destination), and we're happy to test a pre-release.
I was about to open a PR and saw contributing.md restricting PRs so here's the agent plan instead:
Agentic plan
Analysis
With --rootless, install_copilot_cli.sh now installs copilot into ${RUNNER_TEMP}/gh-aw/bin and prepends that directory to PATH. The Copy Copilot CLI to daemon-visible path step in pkg/workflow/nodejs.go still copies from $(command -v copilot) to ${RUNNER_TEMP}/gh-aw/bin/copilot. In that case the source and destination are the same file, so cp exits non-zero, the detection job fails and safe_outputs is skipped.
The staging step is only emitted when the engine is copilot and runner.topology: arc-dind. A workflow with pi as its main engine gets the step only if its threat detection runs copilot.
Implementation plan
-
Make the staging copy idempotent (
pkg/workflow/nodejs.go,buildNpmEngineInstallStepsWithAWF). Emit:mkdir -p "${RUNNER_TEMP}/gh-aw/bin" COPILOT_SRC="$(command -v copilot)" COPILOT_DST="${RUNNER_TEMP}/gh-aw/bin/copilot" [ "$COPILOT_SRC" -ef "$COPILOT_DST" ] || cp "$COPILOT_SRC" "$COPILOT_DST" chmod +x "$COPILOT_DST"The non-rootless path (source
/usr/local/bin/copilot) still copies. -
Fix the stale comments that say rootless installs land in
~/.local/bin:pkg/workflow/nodejs.go, above the staging steppkg/workflow/copilot_engine_installation.go, aboveuseRootlessCLIInstallation
-
Extend the tests in
pkg/workflow/arc_dind_copilot_staging_test.go:- For the
copilotengine onarc-dind, assert the compiled lock file contains the-efguarded copy. - Suggested extra coverage from the acceptance criteria: run the emitted step script in a temp dir with source equal to destination and assert it exits 0. Run it with a distinct source and assert the file is copied.
- For the
-
Validate:
make fmtmake recompile, then confirm no.lock.ymldiff (none of the repo's lock files contain this step)make agent-report-progressonce before the final push
Reference implementation
A working version of steps 1 and 2, plus a string-match assertion for step 3, is on my fork: <link to fix/arc-dind-copilot-copy-same-file on the fork>. Feel free to use it or discard it. The step 3 script-execution tests are not in it. ArcDind tests pass locally. make fmt and make recompile did not run in my environment, so I checked formatting with gofmt -l instead.
Diff
--- a/pkg/workflow/nodejs.go
+++ b/pkg/workflow/nodejs.go
@@ -281,17 +281,20 @@
// Copy Copilot CLI to daemon-visible path for ARC/DinD.
- // With --rootless, the binary is at ~/.local/bin/copilot; otherwise /usr/local/bin/copilot.
+ // With --rootless, the install script places the binary in ${RUNNER_TEMP}/gh-aw/bin
+ // (already the destination); otherwise it is at /usr/local/bin/copilot.
// On ARC/DinD, the AWF command references ${RUNNER_TEMP}/gh-aw/bin/copilot which is
- // daemon-visible, so we copy from wherever the install script placed it.
+ // daemon-visible, so we copy from wherever the install script placed it, skipping
+ // the copy when source and destination are the same file.
` COPILOT_SRC="$(command -v copilot)"`,
- " cp \"$COPILOT_SRC\" \"${RUNNER_TEMP}/gh-aw/bin/copilot\"",
- " chmod +x \"${RUNNER_TEMP}/gh-aw/bin/copilot\"",
+ ` COPILOT_DST="${RUNNER_TEMP}/gh-aw/bin/copilot"`,
+ ` [ "$COPILOT_SRC" -ef "$COPILOT_DST" ] || cp "$COPILOT_SRC" "$COPILOT_DST"`,
+ ` chmod +x "$COPILOT_DST"`,
🔗 AWF tracking issue: github/gh-aw-firewall#12192
Generated by Firewall Issue Dispatcher · copilot · routed: haiku55 xhigh · ~2 AIC · ⊞ 3K · ◷