Skip to content

Fix cached Copilot CLI wrapper activation - #51174

Closed
pelikhan with Copilot wants to merge 10 commits into
mainfrom
copilot/fix-copilot-cli-toolcache-issue
Closed

Fix cached Copilot CLI wrapper activation#51174
pelikhan with Copilot wants to merge 10 commits into
mainfrom
copilot/fix-copilot-cli-toolcache-issue

Conversation

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

A Copilot CLI toolcache hit only updated PATH/GITHUB_PATH, leaving /usr/local/bin/copilot absent. The compiled AWF harness invokes Copilot by absolute path, so cached installs could fail with ENOENT inside the container.

  • Installer behavior
    • Keep exporting the cached toolcache directory for later runner steps.
    • Always install the ${INSTALL_DIR}/copilot wrapper for cached Copilot CLI activations, including GitHub Actions runs where GITHUB_PATH is set.
echo "$cached_copilot_dir" >> "${GITHUB_PATH}"
# Still install wrapper for absolute-path harness invocation.
maybe_sudo install -m 0755 "$wrapper_path" "${INSTALL_DIR}/copilot"
  • Regression coverage
    • Extended the toolcache-hit test to cover the GitHub Actions path.
    • Assert that cached activation writes GITHUB_PATH and installs /usr/local/bin/copilot.

Run: https://github.com/github/gh-aw/actions/runs/31215510357> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 5.84 AIC · ⊞ 6.1K ·

Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.1 AIC · ⊞ 8.5K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 9.66 AIC · ⌖ 5.2 AIC · ⊞ 8.5K ·
Comment /souschef to run again



✨ PR Review Safe Output Test - Run 31231217508> [!WARNING]

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · sonnet46 · 74 AIC · ⌖ 18.8 AIC · ⊞ 768 ·
Comment /smoke-claude to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix absence of copilot in /usr/local/bin due to toolcache Fix cached Copilot CLI wrapper activation Aug 7, 2026
@pelikhan
pelikhan marked this pull request as ready for review August 7, 2026 20:09
Copilot AI balanced review requested due to automatic review settings August 7, 2026 20:09
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Design Decision Gate 🏗️. Review the logs for details.

No ADR enforcement needed: PR #51174 does not have the 'implementation' label and has only 42 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Test Quality Sentinel. Review the logs for details.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Matt Pocock Skills Reviewer. Review the logs for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes cached Copilot CLI activation so absolute-path harness invocations work reliably.

Changes:

  • Always installs a wrapper at the configured Copilot path.
  • Adds regression coverage for toolcache hits with GITHUB_PATH.
Show a summary per file
File Description
actions/setup/sh/install_copilot_cli.sh Installs the cached CLI wrapper unconditionally.
pkg/cli/install_copilot_cli_test.go Verifies path export and wrapper installation.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

Copilot AI requested a review from pelikhan August 7, 2026 20:11

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is correct and well-tested. Removing the early return 0 ensures the wrapper is always installed for absolute-path invocations in the containerized harness, while still exporting GITHUB_PATH for later steps. Tests are appropriately extended to assert wrapper installation in the toolcache path.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 14.8 AIC · ⊞ 5.5K

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Test Quality Analysis — PR #51174

Summary

This PR modifies existing tests in pkg/cli/install_copilot_cli_test.go to enhance coverage of the cached Copilot CLI wrapper activation feature. No new test functions were added, but all 4 existing tests received additional assertions that verify the wrapper installation behavior.

Modified Tests

Test Name Changes Quality
TestInstallCopilotCLIScriptUsesToolcacheBeforeDownload +4 assertions validating wrapper installation and content ✅ High
TestInstallCopilotCLIScriptResolvesCompatVersionBeforeToolcacheLookup Enhanced test fixture for install command simulation ✅ High
TestInstallCopilotCLIScriptRootlessModeUsesRealScriptWithToolcacheAndNoSudo Updated expected output message ✅ High
TestInstallCopilotCLIScriptFallsBackToBakedInDefaultWhenCompatUnavailable Enhanced test fixture for install command simulation ✅ High

Quality Analysis

✅ Strengths

  • Behavioral Contracts: Assertions verify observable behavior — wrapper file creation and content correctness
  • Descriptive Assertions: All added assertions include failure context (e.g., "Expected cached toolcache activation to install the absolute-path wrapper")
  • Proper Error Handling: Uses require.* for critical checks, assert.* for behavioral validation
  • Build Tag Compliance: (go/redacted):build !integration present
  • Test Fixtures: Simulated install command in fake sudo script enables realistic verification
  • Coverage: Validates both install log (command invocation) and resulting wrapper file

Test Verification

  • Install log check: Asserts install command called with correct mode (0755) and destination (/usr/local/bin/copilot)
  • Wrapper content check: Asserts copied wrapper contains proxy invocation: exec "$cachedCopilot" "$@"
  • End-to-end workflow: Validates complete wrapper installation flow

Scoring

Classification: Test Enhancement (0 new test functions; existing tests strengthened)

  • Behavioral contract tests: 4/4 ✅
  • Edge-case coverage: 4/4 ✅
  • No violations: ✅ (no mocking issues, build tag present)

Score: N/A — Infrastructure Enhancement (no new tests added)

Recommendation

APPROVE — Targeted assertion additions that strengthen existing tests. Changes demonstrate good testing discipline with no violations and minimal test inflation.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 24.7 AIC · ⊞ 7.7K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Test Quality Sentinel: Test Enhancement (0 new tests). Existing tests strengthened with targeted assertions (4/4 tests enhanced). No violations detected. Ready to merge.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd — approving.

📋 Key Themes & Highlights

Root cause & fix

The early return 0 in activate_cached_copilot_bin() prevented wrapper installation whenever GITHUB_PATH was set. The containerized AWF harness invokes Copilot by absolute path (/usr/local/bin/copilot), so cached toolcache hits silently left that path absent. The fix is minimal and correctly addresses the root cause rather than patching the symptom.

Positive Highlights

  • ✅ Root cause addressed directly — one-line removal with a clear explanatory comment
  • ✅ Regression test extended to assert both GITHUB_PATH export and wrapper installation on a cache hit
  • ✅ Test verifies wrapper content delegates to the cached binary via exec
  • ✅ Updated comment explains why the wrapper is needed even when GITHUB_PATH is set

Minor Observation (inline comment)

The sudo install stub is repeated in three test functions — extracting a helper would make future changes easier.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 29.6 AIC · ⊞ 7.1K
Comment /matt to run again

Comment thread pkg/cli/install_copilot_cli_test.go Outdated
echo "install:${mode}:${dest}" >> "`+installLog+`"
cp "$src" "`+installedWrapper+`"
chmod "$mode" "`+installedWrapper+`"
exit 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] The sudo install stub is duplicated across three test functions. Not a blocker, but a shared helper would reduce future maintenance burden if the install invocation signature changes.

💡 Suggestion

Extract a fakeSudoScript(installLog, installedWrapper string) string helper and reference it from all three tests.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 3a7203a by extracting the shared fakeSudoScript(...) helper and reusing it across the cached-install test setups.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

$
@copilot Quick triage nudge for this PR.

Please refresh the branch, address any remaining review feedback, run the pr-finisher skill, and push follow-up fixes.

Run: https://github.com/github/gh-aw/actions/runs/31215510357

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 5.84 AIC · ⊞ 6.1K ·
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

$
@copilot Quick triage nudge for this PR.
...

Addressed in 3a7203a. I extracted the duplicated sudo-install test helper and fixed the unrelated pkg/workflow/engine_definition.go lint violations that were failing lint-go. Local targeted tests pass; CI on this new HEAD is still stale until a maintainer re-triggers it.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (Entra) is now investigating this pull request. Sources say the story is developing...

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Smoke OTEL completed successfully!

Generated by Smoke OTEL

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot MAI completed successfully!

Generated by Smoke Copilot MAI

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Cached path forgets
Wrapper missing, still it calls—
Absolute bin found

Inspired by the fix ensuring the Copilot CLI wrapper installs at an absolute path even on cached toolcache hits.

Generated by 🌸 Smoke Copilot Auto for #51174 · auto · 10.7 AIC · ⌖ 7.21 AIC · ⊞ 5.8K ·
Add label smoke to run again

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.54.0
jq 1.7
yq 4.53.3
curl 8.5.0
gh 2.96.0
node 24.18.0
python3 3.11.15
go 1.24.13
java 21.0.11
dotnet 10.0.302

Result: 12/12 tools available ✅ — PASS

🔧 Tool validation by Agent Container Smoke Test · auto · 16.5 AIC · ⌖ 3.4 AIC · ⊞ 8.3K ·
Comment /smoke-test-tools to run again

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Gemini - 31231217590

  1. GitHub MCP: ✅
  2. Web Fetch: ✅
  3. File Writing: ✅
  4. Bash Tool: ✅
  5. Build gh-aw: ❌

Overall Status: FAIL

Smoke Gemini — Powered by Gemini · agent · 10 AIC · ⊞ 9.4K ·
Comment /smoke-gemini to run again

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Smoke test: PR ✅ Web ❌ File ✅ Bash ✅ Build ❌
Overall: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • proxy.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"

See Network Configuration for more information.

🥧 Smoke Pi — Powered by Pi · gpt54 · 2.78 AIC · ⌖ 5.62 AIC · ⊞ 3.2K ·
Comment /smoke-pi to run again

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Smoke test summary: workflow and engine improvements, docs/tests, and dependency updates dominated the last 24h.
Overall status: PASS
Run: https://github.com/github/gh-aw/actions/runs/31231539109

Generated by ⚡ Smoke Copilot MAI · mai10 · 3.7 AIC · ⌖ 1.39 AIC · ⊞ 18.7K ·
Comment /smoke-copilot-mai to run again
Add label smoke to run again

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Terminal dawn holds still
Cache remembers one short run
Quiet tools prove smoke

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex · gpt54 · 21.1 AIC · ⊞ 12K ·
Comment /smoke-codex to run again

@pelikhan pelikhan closed this Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Commit pushed: ee40058

Generated by Changeset Generator · gpt54 · 57.1 AIC · ⌖ 20.3 AIC · ⊞ 12.7K

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🤖 Smoke Test Results — Run 31231217508

Core Tests:
#1 GitHub MCP | ✅ #2 GH CLI | ✅ #3 Make Build | ✅ #4 Playwright | ✅ #5 Tavily | ✅ #6 File Write | ✅ #7 Bash | ✅ #8 Discussion | ✅ #9 AgenticWorkflows MCP | ✅ #10 Slack | ✅ #11 Code Scan | ✅ #12 Check Run

PR Review Tests:
#13 Update PR | ✅ #14 Review Comments | ✅ #15 Submit Review | ⚠️ #16 Resolve Thread (GraphQL timeout) | ✅ #17 Add Reviewer | ❌ #18 Push (allowed-files policy) | ⚠️ #19 Close PR (skipped)

Overall: PARTIAL

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · sonnet46 · 74 AIC · ⌖ 18.8 AIC · ⊞ 768 ·
Comment /smoke-claude to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥 Automated smoke test review - all systems nominal! Run 31231217508

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · sonnet46 · 74 AIC · ⌖ 18.8 AIC · ⊞ 768
Comment /smoke-claude to run again

Comments that could not be inline-anchored

pkg/cli/install_copilot_cli_test.go:55

🤖 Smoke Test Review Comment #1 — The test coverage here looks solid. Consider adding edge cases for concurrent toolcache access. (Run 31231217508)

actions/setup/sh/install_copilot_cli.sh:10

🤖 Smoke Test Review Comment #2 — Good defensive coding here. The ENOENT fix ensures absolute-path invocations work after a toolcache hit. (Run 31231217508)

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Summary

PR: Fix cached Copilot CLI wrapper activation

1 gh-proxy OK | 2 mcpscripts-gh OK | 3 serena FAIL(timeout) | 4 playwright OK | 5 web-fetch OK | 6 file+bash OK | 7 discussion OK | 8 build OK | 9 artifact OK | 10 discussion-create OK | 11 dispatch OK | 12 PR review OK | 13 comment-memory OK | 14 file-summarizer FAIL | 15 check-run OK | 16 LSP OK

Overall: FAIL (tests 3, 14 failed)

Author: app/copilot-swe-agent - Assignees: pelikhan, Copilot

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot · auto · 43.6 AIC · ⌖ 3 AIC · ⊞ 8.7K ·
Comment /smoke-copilot to run again
Add label smoke to run again

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Caveman code run fast
Rocks compile into program
Fire burns bugs away

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot · auto · 43.6 AIC · ⌖ 3 AIC · ⊞ 8.7K ·
Comment /smoke-copilot to run again
Add label smoke to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smoke test: no diff hunks available for inline comments in this PR context.

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot · auto · 43.6 AIC · ⌖ 3 AIC · ⊞ 8.7K
Comment /smoke-copilot to run again
Add label smoke to run again

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copilot CLI toolcache hit leaves /usr/local/bin/copilot absent, so the containerized harness fails with ENOENT

5 participants