fix: use python3 -m pip install for Copilot Python SDK driver - #41303
Conversation
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>
python3 -m pip install for Copilot Python SDK driver
|
✅ Test Quality Sentinel completed test quality analysis. Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Review the workflow run logs for details. |
|
✅ PR Code Quality Reviewer completed the code quality review. |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
✅ 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). |
There was a problem hiding this comment.
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 ofpip install .... - Update Copilot engine unit tests to assert the new Python install command.
- Recompile affected workflow lock output so the generated
.lock.ymluses 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
There was a problem hiding this comment.
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
namefields 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", | |||
There was a problem hiding this comment.
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", | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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", | |||
There was a problem hiding this comment.
[/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", | |||
There was a problem hiding this comment.
[/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",|
Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Review the workflow run logs for details. hello world from sentinel
|
There was a problem hiding this comment.
🧪 Test Quality Sentinel Report
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 install → python3 -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.
Daily Issues Report Generatorhas failed 6/6 scheduled runs withModuleNotFoundError: No module named 'copilot'. The compiled lock.yml used barepip install github-copilot-sdk, which on the runner resolves to a different Python environment than thepython3that executes the driver inside the AWF chroot — so the package installs but is invisible at runtime.Changes
pkg/workflow/copilot_engine_installation.go— replacepip installwithpython3 -m pip installfor the Python SDK install step, ensuring the package lands in the same interpreter's site-packages that runs the driver:pkg/workflow/copilot_engine_test.go— update 4 test assertions to match the new install command.All 251 workflow lock files recompiled —
daily-issues-report.lock.ymlis the primary affected workflow; any future Python SDK driver workflow benefits automatically.