Repository navigation
Isolate Copilot SDK bootstrap from repository package policy - #78621
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
This comment has been minimized.
This comment has been minimized.
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ Matt Pocock Skills ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
🏗️ Design Decision Gate: ADR RequiredThis PR adds ~210 lines in business-logic directories ( Decision captured: install Copilot SDK dependencies into Next step: review the draft, fill in the
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Found 1 correctness issue: the SDK NODE_PATH ordering allows globally installed packages to shadow the pinned isolated SDK dependencies. Please address the inline comment and add a conflicting-global-package regression fixture.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
| const nodePathSetupCommand = `GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi` | ||
| const nodeRuntimeResolutionCommand = `GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; ` + nodePathSetupCommand + `; "$GH_AW_NODE_EXEC"` | ||
| const nodePathSetupCommandForCopilotSDK = `GH_AW_WORKSPACE_NODE_MODULES="${GITHUB_WORKSPACE:-$PWD}/node_modules"; if [ -d "$GH_AW_WORKSPACE_NODE_MODULES" ]; then export NODE_PATH="${GH_AW_WORKSPACE_NODE_MODULES}${NODE_PATH:+:${NODE_PATH}}"; fi; ` + nodePathSetupCommand | ||
| const nodePathSetupCommandForCopilotSDK = nodePathSetupCommand + `; GH_AW_COPILOT_SDK_NODE_MODULES="` + copilotSDKNodeTargetDir + `/node_modules"; if [ -d "$GH_AW_COPILOT_SDK_NODE_MODULES" ]; then export NODE_PATH="${GH_AW_COPILOT_SDK_NODE_MODULES}${NODE_PATH:+:${NODE_PATH}}"; fi` |
There was a problem hiding this comment.
The isolated SDK directory is appended after the global npm root, so a globally installed @github/copilot-sdk or undici can shadow the pinned packages just installed under ${RUNNER_TEMP}/gh-aw/engine-cli/copilot-sdk, making runs use an arbitrary version.
💡 Prefer the isolated SDK modules for SDK imports
Put the isolated node_modules before the global root in NODE_PATH, or otherwise resolve these SDK packages explicitly from the prefix while retaining application-local resolution. Add a fixture where the global root contains a conflicting package and assert the isolated package wins.
There was a problem hiding this comment.
The isolated SDK node_modules path is already prepended before the global NODE_PATH. I added a conflicting-global-package fixture that verifies both SDK imports resolve from the isolated prefix; the bootstrap regression test passes. Commit: b41e06b.
Comment MemoryPeek at saved memory (review-history)History |
Comment MemoryPeek at saved memory (spec-review-history)History |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs, /tdd, and /improve-codebase-architecture. Overall this is a clean isolation: the install moves to a --prefix under RUNNER_TEMP, the --import resolver is gated on the driver argument, and the Go suite passes (go test ./pkg/workflow for the Copilot SDK tests, exit 0).
📋 Key Themes & Highlights
Key Themes
- Silent fallback: the resolver base path falls back to
""whenRUNNER_TEMPis unset, which fails in a confusing way. - Duplicated hook logic: the sync and async resolve hooks repeat the same fallback body.
- Silent test skips: the bootstrap test skips on missing tools, which can hide the only end-to-end coverage in CI.
Positive Highlights
- ✅ The
--importinjection is gated on the driver argument, so arbitrary-command drivers are not affected. - ✅ Tests were updated for the new install strings.
- ✅ The
legacy-nodesubtest covers theregister()fallback path.
Notes
NODE_PATHno longer includes the workspacenode_modulesfor the SDK driver. This is intentional, but it should be called out in the PR description.- Lock files were not regenerated in this checkout. Run
make recompilebefore merge if they are stale.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
|
|
||
| // ESM imports do not consult NODE_PATH. Use Node's package resolver so SDK | ||
| // export conditions and subpaths still apply to the isolated installation. | ||
| const parentURL = pathToFileURL(path.join(process.env.RUNNER_TEMP || "", "gh-aw", "engine-cli", "copilot-sdk", "package.json")).href; |
There was a problem hiding this comment.
[/diagnosing-bugs] When RUNNER_TEMP is unset, process.env.RUNNER_TEMP || "" makes path.join return a relative path, and pathToFileURL resolves it against the current working directory. Fallback resolution then searches the wrong tree, and the failure shows up as a confusing module-not-found error far from the cause.
💡 Suggested fix
Fail fast when the variable is missing, or derive the base from __dirname so the result does not depend on the environment:
const runnerTemp = process.env.RUNNER_TEMP;
if (!runnerTemp) throw new Error("RUNNER_TEMP must be set for Copilot SDK module resolution");@copilot please address this.
There was a problem hiding this comment.
The resolver now fails immediately with a clear error when RUNNER_TEMP is unset, and the bootstrap test checks that case. Commit: b41e06b.
| } | ||
|
|
||
| /** @type {import("node:module").ResolveHookSync} */ | ||
| exports.resolveSync = (specifier, context, nextResolve) => { |
There was a problem hiding this comment.
[/improve-codebase-architecture] The resolveSync hook and the async resolve hook repeat the same catch, shouldFallback, and nextResolve logic. Two copies can drift, for example if one gets a new specifier or fallback condition.
💡 Suggested fix
Move the shared body into one helper and have both exports call it, with the sync and async paths differing only in how nextResolve is awaited.
@copilot please address this.
There was a problem hiding this comment.
Both hook exports now delegate to a shared fallback resolver, with the async hook handling the returned promise. Commit: b41e06b.
|
|
||
| func TestCopilotSDKNodeBootstrapIsolatedFromRepository(t *testing.T) { | ||
| for _, tool := range []string{"npm", "node", "bash"} { | ||
| if _, err := exec.LookPath(tool); err != nil { |
There was a problem hiding this comment.
[/tdd] This test skips when npm, node, or bash is missing. In CI that can silently remove the only end-to-end coverage of the bootstrap, and the job still reports green.
💡 Suggested fix
Keep the skip for local runs, but fail when a CI environment variable such as CI=true is set, so a missing tool breaks the build rather than passing quietly.
@copilot please address this.
There was a problem hiding this comment.
The bootstrap test still skips locally when tools are unavailable, but now fails with a clear message when CI=true. Commit: b41e06b.
There was a problem hiding this comment.
🔵 Needs a closer look
SDK isolation changes interdependent resolution and runtime-path contracts across CommonJS/ESM hooks, drivers, and sandbox/NVX handoffs, while the offline resolver probe does not validate those deployment paths.
No open issues 🎉
What changed in this PR
This PR isolates gh-aw’s Copilot SDK bootstrap from repository package-manager policies, addressing #77386 without relaxing pnpm restrictions or installing application dependencies.
Changes:
- Move Node SDK installation into a dedicated, sandbox-visible gh-aw prefix.
- Update module resolution through
NODE_PATHand scoped fallback hooks. - Adjust installation expectations, document the design, and refresh generated workflows.
| File | Description |
|---|---|
pkg/workflow/copilot_inline_driver.go |
Preloads module resolution for inline Node drivers. |
pkg/workflow/copilot_inline_driver_test.go |
Updates isolated installation expectations. |
pkg/workflow/copilot_engine_sdk_test.go |
Checks the isolated SDK module path. |
pkg/workflow/copilot_engine_installation.go |
Installs Node SDK dependencies outside the checkout. |
pkg/workflow/copilot_engine_execution.go |
Exports the isolated SDK module path. |
pkg/workflow/copilot_engine_basic_test.go |
Updates installation and dependency-pin assertions. |
docs/adr/78621-isolate-copilot-sdk-bootstrap-from-repository-package-policy.md |
Records the isolation design and tradeoffs. |
actions/setup/js/copilot_sdk_module_resolution.cjs |
Registers compatible Node resolution hooks. |
actions/setup/js/copilot_sdk_module_resolution_hooks.cjs |
Adds scoped SDK and undici resolution fallback. |
actions/setup/js/copilot_harness.cjs |
Preloads resolution hooks for Node script drivers. |
.github/workflows/workflow-skill-extractor.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/weekly-editors-health-check.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/visual-regression-checker.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/tidy.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/stale-pr-cleanup.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/spec-extractor.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/smoke-copilot-sub-agents.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/smoke-copilot-sdk.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/smoke-copilot-sdk-routed.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/slide-deck-maintainer.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/refiner.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/q.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/pr-triage-agent.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/pr-nitpick-reviewer.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/plan.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/mcp-inspector.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/linter-miner.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/jsweep.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/firewall.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/eslint-factory-dispatcher.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/draft-pr-cleanup.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/docs-noob-tester.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/dev-hawk.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/delight.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/dead-code-remover.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-work-queue-formal-verification.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-trajectory-grader-implementer.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-syntax-error-quality.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-squid-image-scan.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-spec-coverage-kiro.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-schema-audit-cursor.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-report-dispatcher.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-regression-audit-kiro.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-pr-review-cursor.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-model-inventory.lock.yml |
Refreshes SDK paths for its custom Node driver. |
.github/workflows/daily-malicious-code-scan.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-github-docs-seo-optimizer.lock.yml |
Refreshes SDK paths for its TypeScript driver. |
.github/workflows/daily-ecosystem-explorer.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-compiler-threat-spec-optimizer.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-compiler-quality.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-community-attribution.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-code-metrics.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-assign-issue-to-user.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-ambient-context-optimizer.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-agent-of-the-day-blog-writer.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/daily-action-setup-security-audit.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/craft.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/copilot-pr-prompt-analysis.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/copilot-pr-nlp-analysis.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/copilot-pr-merged-report.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/code-simplifier.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/code-scanning-fixer.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/cli-consistency-checker.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/ci-front-door-researcher.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/ci-coach.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/breaking-change-checker.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/architecture-guardian.lock.yml |
Refreshes SDK install and resolution paths. |
.github/workflows/agent-performance-analyzer.lock.yml |
Refreshes SDK install and resolution paths. |
Review effort: Balanced (adaptive)
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "04876e2a814fba0797a46823355a7c7f67b4b6d4",
"kind": "requested",
"schema_version": "1",
"state": "e671c4f1a8488a467c3f5066474f996a560d69978a49675d446cf3b159d7771f",
"work": [
"31f55b48655d9bb8e13b9fb6a4b5aa9d6ab239ff7e415ba0d09dba4d3bc57b23",
"423cca3e8e457f1156069ea8b7a99f24e042e215e7ea2cc1916942b440a80571",
"7481095cd92d21de2d3843d2b9fc8070df6fcf150b2b6126986fdc178e3480f4",
"e3561209794bb6b67ab35b27e9bfc000e7d3b9570350afe591c8670a4f4fd50b"
],
"workflow": "pr-sous-chef"
}
|
…dk-npm-bootstrap Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…dk-npm-bootstrap Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Merged |
|
🍳 The prep is done, but CI needs another taste test. Copilot's assigned task has finished; these checks are still failing: Completed task
Please address the remaining CI failures on this PR's existing branch. No merging or CI triggering. Structured data{
"completed_task": 44043717645,
"head": "5c15d4ebe4f439d9af34244eb761d8ff4b8cdcc5",
"kind": "ci-follow-up",
"schema_version": "1",
"state": "76e510c777bf4bbfac3d2fe781c515dcc992cc1ed9b1bb50dd87638a9e932ea6",
"work": [
"42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
],
"workflow": "pr-sous-chef"
}
|
…dk-npm-bootstrap Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
🍳 The prep is done, but CI needs another taste test. Copilot's assigned task has finished; these checks are still failing: Completed task
Please address the remaining CI failures on this PR's existing branch. No merging or CI triggering. Structured data{
"completed_task": 44051483019,
"head": "ff4d25bafe77361e6f874db013a9cefd14039553",
"kind": "ci-follow-up",
"schema_version": "1",
"state": "bc91a548dd77818e228945f395085f6abeb7265de793267fa3648a4ea64c9a79",
"work": [
"42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
],
"workflow": "pr-sous-chef"
}
|
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Fixed in |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "ac20e64166a7eba417c4ed506f73890c9951f9d0",
"kind": "requested",
"schema_version": "1",
"state": "6a71cab97160f4488b15dc267cfadbc993ca250e4ed8f58d22f3800e5266dc53",
"work": [],
"workflow": "pr-sous-chef"
}
|
…dk-npm-bootstrap # Conflicts: # pkg/workflow/type_conversion_test.go Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Merged |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "c70c63d507535c1e64459e70781c688203a51c16",
"kind": "requested",
"schema_version": "1",
"state": "e04090033415362a1fdda01a3bf5c82e105f4db5b6064f4ff8660c7313898330",
"work": [],
"workflow": "pr-sous-chef"
}
|
…dk-npm-bootstrap # Conflicts: # pkg/workflow/agy_harness_test.go Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Merged |
|
🎉 This pull request is included in a new release. Release: |
SDK bootstrap runs npm against the checkout, where strict pnpm
devEnginesandcatalog:/workspace:dependencies can reject installation.npm install --prefix "${RUNNER_TEMP}/gh-aw/engine-cli/copilot-sdk" \ --ignore-scripts --no-save @github/copilot-sdk@1.0.16 undici@6.28.0