Skip to content

Launch managed SDK servers through the Rust runtime wrapper - #2395

Draft
roji wants to merge 19 commits into
mainfrom
roji-integrate-local-rust-runtime
Draft

Launch managed SDK servers through the Rust runtime wrapper#2395
roji wants to merge 19 commits into
mainfrom
roji-integrate-local-rust-runtime

Conversation

@roji

@roji roji commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Managed out-of-process SDK connections currently launch the root Copilot SEA directly. The runtime now provides a dedicated copilot-runtime executable that loads the adjacent runtime.node, so SDK-managed subprocess connections should use that coherent wrapper/addon pair while preserving explicit external server and in-process modes.

What changed

  • Update Node.js, Python, Go, .NET, Rust, and Java managed launch paths to resolve and spawn copilot-runtime (copilot-runtime.exe on Windows).
  • Materialize and validate the wrapper beside runtime.node, retaining the root copilot executable only for residual and in-process compatibility.
  • Preserve auxiliary runtime assets such as ripgrep, tgrep, built-in definitions, skills, and future package additions. Each SDK keeps unknown npm package entries by default while excluding known CLI/UI-only content.
  • Preserve explicit CLI path, process, and server URL overrides without silently falling back to the SEA when managed wrapper artifacts are incomplete.
  • Extend language-specific packaging, extraction, permissions, cache, and test coverage for the coherent runtime distribution.
  • Fix a Python subprocess stderr-reader race and Java MCP stdio cwd serialization issue discovered during end-to-end validation.

Validation

Validated all six SDKs against the immutable same-tip runtime release candidate adce886fd1 across supported root SEA, in-process, and hostless wrapper transports. The final focused cache/resume gates and supported full-suite cells passed with exact artifact hash checks and no leaked runtime processes.

The auxiliary-asset follow-up adds focused staging, cache-migration, filtering, permission, and path-safety tests in all six SDKs. A real Node hostless-wrapper integration test also confirms built-in grep completes successfully through the staged ripgrep binary.

Known non-runtime exclusions remain documented from validation: hostless Node extension/factory lifecycle behavior (including the corresponding .NET extension tests), the Go invalid-model fixture, the Java literal-YAML fixture and order-dependent socket-helper contamination, and Rust forced-environment unit-test contamination.

Review notes

This is a draft while the runtime platform packages and Java classifier publication complete. The production platform package is treated as the runtime distribution source: the root copilot[.exe], selected prebuilds/<platform>/runtime.node and copilot-runtime[.exe], and retained package-relative runtime assets are staged as one coherent version. Mixed or incomplete artifact sets are rejected.

roji and others added 17 commits August 21, 2026 13:48
Stage and launch copilot-runtime beside runtime.node across all SDKs, with an opt-in local runtime-worktree override until published packages include the wrapper.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Route out-of-process E2E harnesses through the local runtime override while preserving the residual CLI for in-process execution. Keep Java bundled residual injection intact and surface Python fast-exit diagnostics reliably.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Ensure managed wrapper launches materialize and hand off the compatible host, and expose the same launch descriptor for health checks and intermediate launchers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2455380f-4747-4900-89ca-93b30399de03
Extract the bundled CLI beside copilot-runtime and runtime.node so managed and intermediate launches retain compatibility through the wrapper's sibling fallback.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Ensure a clean bundled runtime cache can publish runtime.node, the wrapper, and sibling CLI before any artifact path exists.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Keep the root CLI artifact bundled for direct and in-process use, while managed out-of-process caches materialize only copilot-runtime and runtime.node.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Wait for the bounded stderr reader to drain before failing pending JSON-RPC requests so startup diagnostics are preserved.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Serialize the MCP stdio server working directory using the protocol's cwd field and cover the wire shape with a focused regression test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
@SteveSandersonMS

SteveSandersonMS commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

The hostless wrapper direction looks right, but this is not complete yet because runtime.node is not self-contained.

I manually tested all 48 combinations: 6 SDKs × stdio/TCP/in-process/existing URL × source/published consumption, using @github/copilot@1.0.81-9. Startup succeeded without launching the SEA in every case. However, built-in grep failed with ENOENT in every stdio/TCP case and in 10 of 12 in-process cases. Existing-URL cases passed because that runtime used the intact npm package layout.

The missing piece is preserving the hostless runtime assets relative to runtime.node. A reasonable minimal payload is:

prebuilds/<platform>/runtime.node
prebuilds/<platform>/copilot-runtime[.exe]
ripgrep/
tgrep/
definitions/
builtin/
builtin-skills/

Node-only and delivery-only content can be excluded: copilot, app.js, index.js, npm-loader.js, sea-loader.js, copilot-sdk/, sdk/, cli-native.node, preloads/, foundry-local-sdk/, pvrecorder/, voice-*.js, webview/, tree-sitter*.wasm, queries/, UI assets, metadata, and the duplicate copilot-runtime-bin.

I validated this approach on .NET in both development and after dotnet publish. Preserving ripgrep/bin/<platform>/rg fixed built-in grep for stdio, TCP, and in-process. Adding tgrep/bin/<platform>/tgrep also worked with USE_TGREP=true. I repeated the runs after deleting the SEA; all passed. In-process worked using adjacent runtime.node as the entrypoint/root hint.

Before merging, I think this PR needs to:

  1. Materialize the complete hostless asset set in all six SDKs while preserving npm-relative paths.
  2. Remove the SEA from published outputs and embedded bundles.
  3. Make in-process resolution use the hostless runtime layout rather than retaining the SEA.
  4. Add E2E coverage that asserts successful tool.execution_complete events for built-in grep/tgrep in source and published consumers. Checking startup or final assistant text is insufficient because the model can silently fall back to another tool.
  5. Future enhancement: Ideally define this asset set once upstream as a manifest/archive so six SDK implementations do not drift.

roji added 2 commits August 25, 2026 19:08
Preserve unknown package assets by default while filtering known CLI-only content in each SDK's existing staging path. Keep wrapper companions adjacent, migrate caches safely, and retain executable metadata for external runtime tools.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants