Fix Copilot CLI toolcache hit not creating /usr/local/bin/copilot#53490
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes cached Copilot CLI activation by ensuring the canonical executable path exists.
Changes:
- Installs a wrapper for toolcache hits and verifies the canonical path.
- Adds a test-only install-directory override.
- Expands regression tests and adds a patch changeset.
Show a summary per file
| File | Description |
|---|---|
actions/setup/sh/install_copilot_cli.sh |
Materializes the canonical Copilot wrapper. |
pkg/cli/install_copilot_cli_test.go |
Tests wrapper creation and execution. |
.changeset/patch-fix-copilot-toolcache-wrapper.md |
Documents the patch. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Balanced
| if [ "$cached_copilot_bin" = "${INSTALL_DIR}/copilot" ]; then | ||
| echo " Cached binary already lives at ${INSTALL_DIR}/copilot — no wrapper needed" | ||
| return 0 |
There was a problem hiding this comment.
Addressed in 5f5d213. The new test sets COPILOT_INSTALL_DIR to the selected toolcache bin, verifies the cached file is not replaced by a wrapper, and executes it successfully.
|
@copilot PR sous-chef triage: branch refresh was requested. Please run the
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Ran |
|
@lpcox review |
|
@copilot Please review any remaining unresolved feedback on this PR, refresh the branch if needed, then run the
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Ran |
PR TriageCategory: bug · Risk: medium · Score: 73/100 Breakdown: impact 35/50 · urgency 20/30 · quality 18/20 Recommended action: Fixes a real breakage: when the Copilot CLI toolcache is hit,
|
On a runner toolcache hit,
install_copilot_cli.shactivated the cached CLI by appending its directory toGITHUB_PATHand returned early, never creating${INSTALL_DIR}/copilot. The agent is spawned with the literal absolute path/usr/local/bin/copilot, sospawn()failed withENOENTand the run died before producing output ("Engine Failure: thecopilotengine terminated before producing output"). Because it depends on what the runner happens to have cached, the same unchanged workflow succeeded or failed non-deterministically.Changes
actions/setup/sh/install_copilot_cli.shactivate_cached_copilot_binnow exports the cached dir toGITHUB_PATHand falls through to install the exec wrapper at${INSTALL_DIR}/copilot, so the canonical path exists regardless of how the CLI was provisioned. The wrapper-install branch was previously dead code under Actions, whereGITHUB_PATHis always set.${INSTALL_DIR}/copilot, avoiding a self-exec loop.${INSTALL_DIR}/copilotis missing or non-executable, so the failure surfaces in the setup step rather than as an opaque agent crash.COPILOT_INSTALL_DIRoverride (consistent with the existingCOPILOT_COMPAT_URL/COPILOT_COMPAT_BUNDLED_PATHtest hooks) so tests can exercise the real install path without writing to/usr/local/bin.pkg/cli/install_copilot_cli_test.go— toolcache tests now assert the canonical path is materialized:--version);GH_AW_COMPILED_VERSION=dev): wrapper points at the best cached candidate;Changeset added.
The alternatives noted in the issue — emitting the resolved path into the lock file, or a
PATHfallback incopilot_harness.cjs— are larger and left out; the wrapper matches the script's own stated preference.Run: https://github.com/github/gh-aw/actions/runs/32075123011> Generated by 👨🍳 PR Sous Chef · gpt54 · 7.25 AIC · ⌖ 7.79 AIC · ⊞ 8.8K · ◷
Run: https://github.com/github/gh-aw/actions/runs/32082636829> Generated by 👨🍳 PR Sous Chef · gpt54 · 14.1 AIC · ⌖ 7.81 AIC · ⊞ 8.8K · ◷