Skip to content

Fix copilot-sdk harness stdin wiring, SDK installation/resolution, custom-provider setup from /reflect, and remove duplicate harness timestamps#36358

Merged
pelikhan merged 19 commits into
mainfrom
copilot/fix-copilot-sdk-integration
Jun 2, 2026
Merged

Fix copilot-sdk harness stdin wiring, SDK installation/resolution, custom-provider setup from /reflect, and remove duplicate harness timestamps#36358
pelikhan merged 19 commits into
mainfrom
copilot/fix-copilot-sdk-integration

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

The Copilot SDK smoke workflow was failing in the Execute GitHub Copilot CLI step because the SDK options payload (promptFile, serverArgs) was not reliably reaching copilot_harness.cjs stdin. This change also removes harness-level timestamp rendering, since GitHub Actions already timestamps each log line, ensures the SDK package is installed and resolvable at runtime when SDK mode is enabled, and configures SDK BYOK custom-provider settings from AWF /reflect data.

  • SDK stdin delivery (workflow command generation)

    • Updated Copilot SDK command composition to pipe JSON into a grouped RHS command, ensuring stdin reaches the harness after node runtime resolution logic.
    • Prevents the harness from entering the no prompt found path when SDK mode is enabled.
  • Copilot SDK installation for SDK mode

    • Updated compiler-generated Copilot installation steps to install @github/copilot-sdk in the workspace root (${GITHUB_WORKSPACE}) using npm install --ignore-scripts --no-save before running the agent when engine.copilot-sdk: true.
    • Added DefaultCopilotSDKVersion in pkg/constants/version_constants.go so the SDK install version is pinned from constants.
    • Recompiled smoke-copilot-sdk.lock.yml to include the generated SDK install step.
  • SDK package resolution fix (runtime)

    • Updated SDK-mode node runtime command generation to export NODE_PATH with both:
      • workspace-local modules (${GITHUB_WORKSPACE:-$PWD}/node_modules), and
      • npm global root (npm root -g).
    • This ensures @github/copilot-sdk is resolvable by harness scripts running from ${RUNNER_TEMP} after local workspace installation.
  • SDK custom provider configuration from AWF /reflect

    • Added harness logic to read saved AWF reflect endpoint data and derive a custom provider configuration (baseUrl) plus model selection for Copilot SDK sessions.
    • Passed derived provider and model through SDK driver session creation (createSession) so SDK mode works in BYOK/offline proxy scenarios instead of failing with Session was not created with authentication info or custom provider.
    • Added targeted regression coverage for reflect-based provider/model resolution and provider propagation into SDK session config.
  • Harness logging cleanup

    • Simplified harness log output to [copilot-harness] <message> (no inline ISO timestamp).
    • Keeps log output cleaner and avoids double timestamping in Actions logs.
  • Targeted regression coverage

    • Updated workflow generation assertions for SDK mode command shape.
    • Updated harness log format expectations to match non-timestamped output.
    • Added coverage validating the SDK installation step is emitted in SDK mode.
    • Added assertions validating SDK mode command includes NODE_PATH setup for workspace node_modules and npm global root.
    • Updated SDK install assertion to validate the workspace-root --no-save installation command shape.
    • Restored the Buffer JSDoc cast form in stdin parsing to preserve type-checking behavior.
// SDK mode command now groups RHS so stdin from the pipe reaches the harness
copilotCommand = fmt.Sprintf(`printf '%%s' '%s' | { %s; }`, jsonStr, execPrefix)

Changeset\n\n- Type: patch\n- Description: Fix Copilot SDK stdin wiring for the harness, install the Copilot SDK in SDK mode in workspace root without modifying package manifests (--no-save), improve runtime SDK resolution behavior (including workspace-local module resolution), configure Copilot SDK custom-provider/model from AWF /reflect for BYOK runs, and remove duplicate harness timestamps.

> Generated by 📋 Changeset Generator for issue #36358 · gpt54 796.7K ·

Copilot AI and others added 2 commits June 1, 2026 23:03
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Fix copilot-sdk harness stdin handoff and drop duplicate timestamping Fix copilot-sdk harness stdin wiring and remove duplicate harness timestamps Jun 1, 2026
Copilot AI requested a review from pelikhan June 1, 2026 23:07
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Jun 1, 2026

@copilot Merge main and recompile.

Copilot AI and others added 3 commits June 1, 2026 23:25
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…dk-integration

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 1, 2026

@copilot Merge main and recompile.

Done in 2a262ea (after merging main in ab2fa6f): merged latest main into this branch and recompiled workflows.

@pelikhan pelikhan marked this pull request as ready for review June 1, 2026 23:42
Copilot AI review requested due to automatic review settings June 1, 2026 23:42
@pelikhan pelikhan added the smoke label Jun 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🧪 Test Quality Sentinel completed test quality analysis.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🚀 Smoke Antigravity MISSION COMPLETE! Antigravity has spoken. ✨

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

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

No ADR enforcement needed: PR #36358 does not have the 'implementation' label (has_implementation_label=false) and has only 6 new lines of code in business logic directories, well below the 100-line threshold (requires_adr_by_default_volume=false). Neither enforcement condition is met.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

PR Code Quality Reviewer completed the code quality review.

@github-actions github-actions Bot removed the smoke label Jun 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🌑 The shadows whisper... Smoke Codex failed to deliver outputs. The oracle requires further meditation...

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🚀 Smoke Gemini MISSION COMPLETE! Gemini has spoken. ✨

Verifying tool access

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🚀 Smoke Pi MISSION COMPLETE! Pi delivered. 🥧

Copilot AI requested a review from pelikhan June 2, 2026 02:58
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Jun 2, 2026

@copilot it is finding to load the module.

https://github.com/github/gh-aw/actions/runs/26795908399/job/78992142688#step:27:1

Make sure this is not a CommonJS vs ESM problem with the @github/copilot-sdk package. Investigate.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 2, 2026

@copilot it is finding to load the module.

...

Addressed in 9ff2ba4.

I investigated run 26795908399 / job 78992142688: the failure is a module resolution path issue, not CommonJS-vs-ESM interop. The log shows Cannot find module '@github/copilot-sdk' (no ERR_REQUIRE_ESM), and the require stack points to copilot_sdk_driver.cjs.

Fix: in SDK mode, the generated node runtime command now prepends ${GITHUB_WORKSPACE:-$PWD}/node_modules to NODE_PATH (while still preserving the global npm root -g path). This makes the locally installed @github/copilot-sdk resolvable from harness scripts under ${RUNNER_TEMP}.

I also recompiled smoke-copilot-sdk.lock.yml and updated test coverage for this command shape.

@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Jun 2, 2026

@copilot configure sdk for custom provider using /reflect info

https://github.com/github/gh-aw/actions/runs/26797319253/job/78996479286#step:27:1

Copilot AI and others added 2 commits June 2, 2026 04:22
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 2, 2026

@copilot configure sdk for custom provider using /reflect info

https://github.com/github/gh-aw/actions/runs/26797319253/job/78996479286#step:27:1

Fixed in d07e807.

SDK mode now derives a custom provider config from /reflect (configured endpoint + base URL + model) and passes it into createSession, which resolves the Session was not created with authentication info or custom provider failure. I also kept the stdin Buffer cast valid for type checking and added focused tests for provider propagation and reflect-based resolution.

Copilot AI changed the title Fix copilot-sdk harness stdin wiring, SDK installation/resolution, and remove duplicate harness timestamps Fix copilot-sdk harness stdin wiring, SDK installation/resolution, custom-provider setup from /reflect, and remove duplicate harness timestamps Jun 2, 2026
@pelikhan pelikhan requested a review from Copilot June 2, 2026 04:54
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Jun 2, 2026

@copilot merge main and recompile

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 127/240 changed files
  • Comments generated: 0 new

…dk-integration

# Conflicts:
#	.github/workflows/agentic-token-audit.lock.yml
#	.github/workflows/agentic-token-optimizer.lock.yml
#	.github/workflows/daily-cache-strategy-analyzer.lock.yml
#	.github/workflows/daily-fact.lock.yml
#	.github/workflows/daily-observability-report.lock.yml
#	.github/workflows/dev.lock.yml
#	.github/workflows/duplicate-code-detector.lock.yml
#	.github/workflows/grumpy-reviewer.lock.yml
#	.github/workflows/issue-arborist.lock.yml
#	.github/workflows/necromancer.lock.yml
#	.github/workflows/schema-feature-coverage.lock.yml
#	.github/workflows/smoke-call-workflow.lock.yml
#	.github/workflows/smoke-codex.lock.yml

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 2, 2026

@copilot merge main and recompile

Done in 9c70001: merged latest main into this branch and recompiled workflow lock files (including smoke-copilot-sdk.lock.yml).

@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Jun 2, 2026

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 2, 2026

@copilot lint js https://github.com/github/gh-aw/actions/runs/26799703294/job/79004948151?pr=36358 and update wasm

Done in 6381022: fixed the JS lint failure (formatted copilot_harness.cjs and copilot_sdk_driver.cjs) and updated wasm golden outputs (make update-wasm-golden).

@pelikhan pelikhan merged commit cf5be42 into main Jun 2, 2026
@pelikhan pelikhan deleted the copilot/fix-copilot-sdk-integration branch June 2, 2026 05:36
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