Skip to content

install_copilot_cli.sh: cached toolcache hit never places binary at /usr/local/bin/copilot, causing spawn ENOENT #52327

Closed

Description

@alexsiilvaa

Summary

The agent job's Execute GitHub Copilot CLI step spawns the Copilot CLI via a hardcoded absolute path /usr/local/bin/copilot. When install_copilot_cli.sh finds a compatible cached version in the runner toolcache (within the 14-day TTL), it only activates the cached copy by prepending its directory to PATH/GITHUB_PATH — it never copies or symlinks the binary to /usr/local/bin. Since the harness ignores PATH and always spawns the hardcoded path, this results in an immediate ENOENT and the whole workflow run fails with 0 tokens used.

Where

install_copilot_cli.sh (materialized at runtime under $RUNNER_TEMP/gh-aw/actions/) — the toolcache-hit branch, roughly:

Searching toolcache for GitHub Copilot CLI ...
  Found candidate: /opt/hostedtoolcache/copilot-cli/1.0.78/x64/bin/copilot (version: 1.0.78, arch: x64)
  Cache age: 8 days (within TTL of 14 days)
  Selected best cached version: 1.0.78 ...
Using cached GitHub Copilot CLI from /opt/hostedtoolcache/copilot-cli/1.0.78/x64/bin/copilot...
Activating cached Copilot CLI from /opt/hostedtoolcache/copilot-cli/1.0.78/x64/bin/copilot...
  Prepended .../bin to PATH
  Exporting .../bin to GITHUB_PATH
✓ Copilot CLI installation complete (cached)

Compare with the cache-miss (fresh download) branch, which explicitly does Installing binary to /usr/local/bin before completing — that path always succeeds.

Meanwhile the copilot-harness.cjs invocation in the agent job always resolves the binary as an absolute path:

[copilot-harness] starting: command=/usr/local/bin/copilot ...
[copilot-harness] pre-flight: command not found: /usr/local/bin/copilot (F_OK check failed — binary does not exist at this path)
[copilot-harness] attempt 1: failed to start process '/usr/local/bin/copilot': spawn /usr/local/bin/copilot ENOENT (code=ENOENT syscall=spawn /usr/local/bin/copilot)
[copilot-harness] attempt 1: no output produced — not retrying (possible causes: binary not found, permission denied, auth failure, or silent startup crash)

Repro / evidence

Observed in a private workflow using engine.id: copilot and a custom runs-on: ubuntu-slim runner label.

Multiple consecutive workflow runs failed with the identical ENOENT signature, each preceded by a toolcache hit in the Install GitHub Copilot CLI step (cached version found within the 14-day TTL). Runs interleaved between the failures that succeeded always showed a toolcache miss (cache older than the TTL) followed by Installing binary to /usr/local/bin.

This only manifests on runners with a persistent tool cache across job runs (a runner label that reuses /opt/hostedtoolcache across jobs); ephemeral GitHub-hosted runners would never have a warm cache and wouldn't hit this branch.

Expected

The toolcache-hit branch of install_copilot_cli.sh should also ensure the resolved binary is available at the same path the harness spawns (copy/symlink to /usr/local/bin/copilot), or the harness should resolve the Copilot CLI location via PATH/command -v instead of a hardcoded absolute path.

Related but distinct

This issue is specifically about the toolcache-hit branch of the Copilot CLI installer not placing the binary where the harness expects it.

Activity

  1. locked and limited conversation to collaborators on Aug 12, 2026
  2. unlocked this conversation on Aug 12, 2026
  3. ckittel commented on Aug 12, 2026

    @ckittel

    +1 receiving what appears to be the same issue in our implementation.

  4. locked and limited conversation to collaborators on Aug 12, 2026
  5. unlocked this conversation on Aug 12, 2026
  6. myaschmitz commented on Aug 12, 2026

    @myaschmitz

    This also affects standard GitHub-hosted runners, not just persistent/self-hosted ones. The report says ephemeral hosted runners "would never have a warm cache" — but /opt/hostedtoolcache/copilot-cli is baked into the runner VM image, so a fresh ephemeral runner can start with a warm, in-TTL entry.

    Evidence from a single run of one workflow (stock ubuntu-latest, gh-aw v0.85.4), two jobs on two runners:

    agent job — old image, entry expired:

    Found candidate: /opt/hostedtoolcache/copilot-cli/1.0.56/x64/bin/copilot
    Cache age: 74 days (exceeds TTL of 14 days)
    Skipping candidate (cache expired and not max-agent: 1.0.56 != 1.0.79)
    No compatible toolcache entry found
    Installing binary to /usr/local/bin...      -> works
    

    detection job — newer image, entry in TTL:

    Found candidate: /opt/hostedtoolcache/copilot-cli/1.0.78/x64/bin/copilot
    Cache age: 8 days (within TTL of 14 days)
    Using cached GitHub Copilot CLI from /opt/hostedtoolcache/...   -> ENOENT
    

    Same lock, same script, same run. The only variable is which VM image the job landed on. The image carrying 1.0.78 appears to have started rolling out ~6-8 days ago, which lines up with the cluster of reports (#50906, #51068, #51373, #51843, this one) all filed since Aug 6.

    This gets worse, not better. The skip requires both expired and != max-agent. Once a runner image ships copilot-cli equal to the compat max (currently 1.0.79), the entry is used regardless of age and the TTL escape hatch disappears permanently. Every job then takes the cache-hit branch. Today that mostly surfaces in detection (which is continue-on-error: true, so it degrades quietly into an unscreened safe-output path plus a warning banner) — but the agent job runs the same installer and the same hardcoded spawn, and it is not continue-on-error.

    Note also that the installer self-verifies with command -v copilot, which succeeds via the PATH it just prepended, so it exits 0 and prints "installation complete (cached)" while /usr/local/bin/copilot does not exist.

  7. locked and limited conversation to collaborators on Aug 12, 2026
  8. unlocked this conversation on Aug 12, 2026
  9. ckittel commented on Aug 12, 2026

    @ckittel

    We are indeed using standard GitHub-hosted runners, and this error is the most common one we get. Awesome research @myaschmitz.

  10. locked and limited conversation to collaborators on Aug 12, 2026
  11. unlocked this conversation on Aug 12, 2026
  12. myaschmitz commented on Aug 12, 2026

    @myaschmitz

    Still reproducing on v0.85.4 today, and worth flagging that #51373, #51068 and #50906 are all closed as completed while the code path is unchanged on main.

    Two jobs, same workflow, same repo, ~45 min apart — the only difference is which runner image they landed on:

    Job Cached CLI Age Branch taken Result
    agent (run A) 1.0.56 74 days expired -> download works
    agent (run B) 1.0.78 9 days within TTL -> reuse spawn /usr/local/bin/copilot ENOENT

    Installer log from the failing run:

    Scanning toolcache root: /opt/hostedtoolcache/copilot-cli
    Found candidate: /opt/hostedtoolcache/copilot-cli/1.0.78/x64/bin/copilot
    Cache age: 9 days (within TTL of 14 days)
    Prepended /opt/hostedtoolcache/copilot-cli/1.0.78/x64/bin to PATH
    Verifying cached Copilot CLI installation...
    Resolved copilot binary: /opt/hostedtoolcache/copilot-cli/1.0.78/x64/bin/copilot
    / Copilot CLI installation complete (cached)
    

    The verification resolves through the PATH it just set, so it never checks the absolute path its caller uses. copilot_harness.cjs is spawned with a compile-time-baked /usr/local/bin/copilot, which the cached branch never creates.

    Three things that may not be captured yet:

    1. It hits agent, not just detection. agent is not continue-on-error, so the run fails outright. 2 of 4 dispatches today.
    2. The retry logic cannot help. Failure is classed no_output: attempt 1: no output produced - not retrying. maxRetries=3 never engages.
    3. Exposure grows as images refresh. Reuse requires the cached copy to be younger than the TTL, so every refreshed image moves more runners into the failing branch. Once an image ships a version equal to the compat max (1.0.79), the expired AND != max-agent skip stops firing and the TTL escape hatch closes entirely.

    Workaround for anyone blocked — force a cache miss before Install GitHub Copilot CLI:

    - run: sudo rm -rf /opt/hostedtoolcache/copilot-cli || true
  13. locked and limited conversation to collaborators on Aug 12, 2026
  14. unlocked this conversation on Aug 12, 2026
  15. OFollan commented on Aug 13, 2026

    @OFollan

    Confirming this on stock GitHub-hosted ubuntu-24.04 with gh-aw v0.85.4, and adding a datapoint that pins the trigger to the runner image rather than anything in the consuming repository.

    Two runs of the same workflow, same lock file, 16 hours apart:

    Run Runner image Toolcache entry Age vs 14-day TTL Result
    pass 20260720.247.2 copilot-cli 1.0.56 74 days — expired downloads 1.0.79 to /usr/local/bin → works
    fail 20260810.271.1 copilot-cli 1.0.78 9 days — in TTL cache hit → PATH only → spawn /usr/local/bin/copilot ENOENT

    So this is not intermittent anymore for anyone landing on the 20260810 image or later: the image now bakes in a copilot-cli young enough to satisfy the TTL, and activate_cached_copilot_bin() returns after appending to $GITHUB_PATH without ever staging ${INSTALL_DIR}/copilot. $GITHUB_PATH can't help, since the agent is spawned by absolute path inside the AWF sandbox.

    Two things that may save others some time:

    • v0.86.2 (newest tag, prerelease) is unchanged: pkg/constants/constants.go still has const CopilotBinaryPath = "/usr/local/bin/copilot", and actions/setup/sh/install_copilot_cli.sh still has the GITHUB_PATH early return at the same place. The latest stable release is still v0.85.4, so there is nothing to upgrade to.
    • Bumping only the action doesn't help either: setup/js/copilot_harness.cjs is byte-identical between gh-aw-actions v0.85.4 and v0.86.1, as is the cache-hit branch of the installer. We had a Dependabot bump to v0.86.1 merged and later reverted by a recompile, and neither state made any difference.

    Workaround we are using, as a step before the install step:

    steps:
      - name: Force a fresh Copilot CLI install
        run: sudo rm -rf "${RUNNER_TOOL_CACHE}/copilot-cli"
  16. locked and limited conversation to collaborators on Aug 13, 2026
  17. unlocked this conversation on Aug 13, 2026
  18. davidslater commented on Aug 13, 2026

    @davidslater
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions