Skip to content

fix: use python3 -m pip install for Copilot Python SDK driver - #41303

Merged
pelikhan merged 2 commits into
mainfrom
copilot/aw-failures-fix-sample-driver
Jun 24, 2026
Merged

fix: use python3 -m pip install for Copilot Python SDK driver#41303
pelikhan merged 2 commits into
mainfrom
copilot/aw-failures-fix-sample-driver

Conversation

Copilot AI commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Daily Issues Report Generator has failed 6/6 scheduled runs with ModuleNotFoundError: No module named 'copilot'. The compiled lock.yml used bare pip install github-copilot-sdk, which on the runner resolves to a different Python environment than the python3 that executes the driver inside the AWF chroot — so the package installs but is invisible at runtime.

Changes

  • pkg/workflow/copilot_engine_installation.go — replace pip install with python3 -m pip install for the Python SDK install step, ensuring the package lands in the same interpreter's site-packages that runs the driver:

    - spec.command = workspaceCommandPrefix + "pip install --disable-pip-version-check github-copilot-sdk==" + version
    + spec.command = workspaceCommandPrefix + "python3 -m pip install --disable-pip-version-check github-copilot-sdk==" + version
  • pkg/workflow/copilot_engine_test.go — update 4 test assertions to match the new install command.

  • All 251 workflow lock files recompileddaily-issues-report.lock.yml is the primary affected workflow; any future Python SDK driver workflow benefits automatically.

The Daily Issues Report Generator was failing 100% of runs with
`ModuleNotFoundError: No module named 'copilot'`. The generated lock.yml
ran `pip install github-copilot-sdk==1.0.2` but bare `pip` may resolve
to a different Python environment than the `python3` that runs the driver
inside the AWF chroot. Switching to `python3 -m pip install` ensures the
SDK is installed into the exact site-packages that `python3` uses.

- pkg/workflow/copilot_engine_installation.go: pip → python3 -m pip
- pkg/workflow/copilot_engine_test.go: update 4 test assertions
- Recompile all 251 workflows (daily-issues-report.lock.yml updated)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Copilot Python SDK sample driver crash in Daily Issues Report Generator fix: use python3 -m pip install for Copilot Python SDK driver Jun 24, 2026
Copilot AI requested a review from pelikhan June 24, 2026 21:44
@pelikhan
pelikhan marked this pull request as ready for review June 24, 2026 21:48
Copilot AI review requested due to automatic review settings June 24, 2026 21:48
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output.

Review the workflow run logs for details.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

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

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 Copilot Python SDK installation in generated agent workflows by ensuring the SDK is installed into the same Python interpreter environment that later runs the Copilot SDK driver (avoiding ModuleNotFoundError: No module named 'copilot' caused by pip resolving to a different interpreter than python3).

Changes:

  • Update Copilot SDK install step generation for Python to use python3 -m pip install ... instead of pip install ....
  • Update Copilot engine unit tests to assert the new Python install command.
  • Recompile affected workflow lock output so the generated .lock.yml uses the corrected install command (example: daily-issues-report.lock.yml).
Show a summary per file
File Description
pkg/workflow/copilot_engine_installation.go Switch Python Copilot SDK install command to python3 -m pip ... so install/runtime interpreter match.
pkg/workflow/copilot_engine_test.go Update assertions to match the new Python SDK install command.
.github/workflows/daily-issues-report.lock.yml Regenerated lock workflow now installs the Python SDK via python3 -m pip ....

Copilot's findings

Tip

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

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

@github-actions github-actions Bot mentioned this pull request Jun 24, 2026

@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.

LGTM. Fix is correct and minimal.

Review summary

What was reviewed

3 changed files: copilot_engine_installation.go, copilot_engine_test.go, daily-issues-report.lock.yml.

Fix assessment

Replacing pip install with python3 -m pip install correctly anchors package installation to the same interpreter that runs the driver. This is the canonical solution to the interpreter-mismatch problem described in the PR. The lock file regeneration is consistent with the source change.

Issues found

  • Two test case name fields still say "pip sdk install" after the fix — non-blocking, but they should be updated for clarity (comments left inline).
  • No correctness, concurrency, security, or performance issues found in the changed lines.

🔎 Code quality review by PR Code Quality Reviewer · 50.7 AIC · ⌖ 7.42 AIC · ⊞ 5.2K

@@ -2129,7 +2129,7 @@ func TestCopilotEngineInstallationWithCommandAndCopilotSDK(t *testing.T) {
name: "python command uses pip sdk install",

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.

Stale test name: "python command uses pip sdk install" no longer accurately describes the install mechanism and will mislead anyone diagnosing a future failure.

💡 Suggested rename

The test now asserts python3 -m pip install, so the name should match:

name: "python command uses python3 -m pip for sdk install",

Stale names make test failures harder to diagnose because the output says "pip" but the generated command says python3 -m pip.

@@ -2249,7 +2249,7 @@ func TestCopilotEngineInstallationWithCopilotSDKDriver(t *testing.T) {
name: "python driver uses pip sdk install",

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.

Stale test name: "python driver uses pip sdk install" is now inaccurate — the install command is python3 -m pip install, not pip install.

💡 Suggested rename
name: "python driver uses python3 -m pip for sdk install",

Consistent with fixing the sibling test name on the WithCommandAndCopilotSDK test function above.

@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 /diagnose and /tdd — approving with two minor naming nits.

📋 Key Themes & Highlights

Root Cause (Diagnose)

The fix is correct and minimal: python3 -m pip install guarantees the SDK lands in the same interpreter's site-packages as the python3 process running the driver inside the AWF chroot. This is the canonical Python pattern for avoiding interpreter-mismatch issues. The production failure rate (6/6) and the ModuleNotFoundError stack trace make the root cause clear and the fix credibly complete.

Test Coverage (TDD)

All four changed assertions now assert the right string, so they will catch a future regression that reverts to bare pip. Two test names still say "pip sdk install" (lines 2129 and 2249) — minor, but worth fixing so the test serves as living documentation.

Positive Highlights

  • ✅ One-line source change, zero scope creep
  • ✅ All affected test assertions updated in lock-step
  • ✅ Lock file recompiled, confirming the full pipeline reflects the fix
  • ✅ PR description precisely explains the interpreter-isolation root cause

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 52.8 AIC · ⌖ 7.04 AIC · ⊞ 6.5K

@@ -2129,7 +2129,7 @@ func TestCopilotEngineInstallationWithCommandAndCopilotSDK(t *testing.T) {
name: "python command uses pip sdk install",

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] Stale test name — still says "pip sdk install" but the install command is now python3 -m pip.

Updating test names to describe the actual behaviour keeps the test suite self-documenting and makes future regressions easier to diagnose.

💡 Suggested rename
name: "python command uses python3 -m pip install",

@@ -2249,7 +2249,7 @@ func TestCopilotEngineInstallationWithCopilotSDKDriver(t *testing.T) {
name: "python driver uses pip sdk install",

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] Stale test name — "python driver uses pip sdk install" no longer matches the python3 -m pip install command actually being verified.

💡 Suggested rename
name: "python driver uses python3 -m pip install",

@github-actions

Copy link
Copy Markdown
Contributor

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output.

Review the workflow run logs for details.

hello world from sentinel

🧪 Test quality analysis by Test Quality Sentinel · 91.6 AIC · ⌖ 22.6 AIC · ⊞ 8.4K ·

@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 Report

⚠️ Test Quality Score: 75/100 — Acceptable

Analyzed 4 modified test scenario(s) in pkg/workflow/copilot_engine_test.go (2 table-driven functions): 4 design tests, 0 implementation tests, 0 guideline violations.

All 4 modified rows update pip installpython3 -m pip install in existing table-driven tests that verify the exact install command generated (behavioral contract).

Metrics:

  • Design tests: 4/4 (100%)
  • Edge-case coverage: 2/4 (50%) — env-wrapper and firewall rows
  • Duplicate clusters: 0
  • Test inflation: 4:1 (false positive — comprehensive pre-existing coverage means 1 production-line fix requires 4 test-row updates)
  • Build tag: //go:build !integration
  • Mocks: none ✓
  • Assertion messages: present (t.Fatalf with context) ✓

Check passed. 0% implementation tests (threshold: 30%). No guideline violations detected.

@pelikhan
pelikhan merged commit 2a449c3 into main Jun 24, 2026
80 of 91 checks passed
@pelikhan
pelikhan deleted the copilot/aw-failures-fix-sample-driver branch June 24, 2026 22:01
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.

3 participants