Launch managed SDK servers through the Rust runtime wrapper - #2395
Conversation
|
The hostless wrapper direction looks right, but this is not complete yet because I manually tested all 48 combinations: 6 SDKs × stdio/TCP/in-process/existing URL × source/published consumption, using The missing piece is preserving the hostless runtime assets relative to Node-only and delivery-only content can be excluded: I validated this approach on .NET in both development and after Before merging, I think this PR needs to:
|
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
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
Preserve the explicit .NET single-binary override, refresh stale Rust runtime bundles safely, and document the Python npm registry override. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Stage the managed wrapper under the platform user cache instead of the temporary directory so noexec temp mounts do not prevent startup. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Document PR #2395 and the Rust-only out-of-process transition on Node extension-authored factory coverage, the real-host extension environment test, and .NET extension lifecycle tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
805e7cb to
455f17b
Compare
There was a problem hiding this comment.
Pull request overview
Routes managed subprocess SDK connections through the coherent copilot-runtime/runtime.node distribution while preserving explicit and in-process launch modes.
Changes:
- Updates all six SDK launch paths and packaging.
- Retains auxiliary runtime assets with cache and integrity handling.
- Expands tests and documentation for runtime resolution.
Show a summary per file
| File | Description |
|---|---|
rust/tests/e2e/support.rs |
Preserves explicit CLI environment paths. |
rust/tests/cli_resolution_test.rs |
Tests wrapper resolution and extraction. |
rust/src/startup_timings.rs |
Updates resolution timing documentation. |
rust/src/resolve.rs |
Resolves and validates runtime pairs. |
rust/src/lib.rs |
Exposes bundled runtime installation. |
rust/src/ffi.rs |
Supports adjacent runtime libraries and musl. |
rust/src/embeddedcli.rs |
Extracts coherent runtime bundles. |
rust/README.md |
Documents bundled runtime behavior. |
rust/build/in_process.rs |
Builds and caches runtime distributions. |
rust/build.rs |
Unifies build implementation. |
python/test_client.py |
Tests explicit launch overrides. |
python/test_cli_download.py |
Tests runtime bundle provisioning. |
python/README.md |
Documents runtime downloads and paths. |
python/copilot/client.py |
Selects the managed wrapper. |
python/copilot/_cli_download.py |
Downloads and stages runtime assets. |
nodejs/test/runtimeArtifacts.test.ts |
Tests runtime materialization. |
nodejs/test/e2e/factory.e2e.test.ts |
Disables factory E2E coverage. |
nodejs/test/e2e/extension_env_access.e2e.test.ts |
Disables extension-host coverage. |
nodejs/test/e2e/builtin_tools.e2e.test.ts |
Adds grep runtime validation. |
nodejs/test/client.test.ts |
Tests explicit path precedence. |
nodejs/src/runtimeArtifacts.ts |
Materializes platform runtime assets. |
nodejs/src/client.ts |
Launches the bundled runtime wrapper. |
nodejs/README.md |
Documents managed wrapper launches. |
java/sdk/src/test/java/com/github/copilot/ffi/NativeRuntimeLoaderTest.java |
Tests classifier runtime extraction. |
java/sdk/src/test/java/com/github/copilot/CliServerManagerTest.java |
Tests explicit CLI paths. |
java/sdk/src/main/java/com/github/copilot/ffi/NativeRuntimeLoader.java |
Extracts wrapper and retained assets. |
java/sdk/src/main/java/com/github/copilot/CliServerManager.java |
Launches the resolved wrapper. |
java/README.md |
Documents Java runtime provisioning. |
java/copilot-native/scripts/fetch-native.test.mjs |
Tests native asset staging. |
java/copilot-native/scripts/fetch-native.mjs |
Builds classifier runtime trees. |
java/copilot-native/pom.xml |
Verifies packaged wrappers. |
go/README.md |
Documents embedded runtime resolution. |
go/internal/ffihost/resolve.go |
Supports adjacent runtime.node. |
go/internal/embeddedcli/embeddedcli.go |
Installs wrapper pairs and assets. |
go/internal/embeddedcli/embeddedcli_test.go |
Tests runtime installation. |
go/cmd/bundler/main.go |
Bundles coherent runtime artifacts. |
go/cmd/bundler/main_test.go |
Tests filtering and generated embeds. |
go/client.go |
Selects the managed runtime executable. |
go/client_test.go |
Tests runtime selection failures. |
dotnet/test/Unit/RuntimeWrapperTests.cs |
Tests wrapper resolution behavior. |
dotnet/test/Unit/MSBuildTargetsTests.cs |
Tests runtime asset copying. |
dotnet/test/E2E/RpcExtensionsLoadedE2ETests.cs |
Disables extension lifecycle tests. |
dotnet/test/E2E/BuiltinToolsE2ETests.cs |
Re-enables ripgrep tool tests. |
dotnet/src/Client.cs |
Resolves and validates runtime pairs. |
dotnet/src/build/GitHub.Copilot.SDK.targets |
Packages filtered runtime assets. |
dotnet/README.md |
Documents managed runtime launches. |
Review details
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Suppressed comments (1)
rust/build/in_process.rs:136
- Removing the shared install directory is not coordinated across build processes. Two concurrent Cargo builds can both observe an incomplete cache, then one can delete the directory while the other is publishing its file-level staging entries, causing a panic or a mixed/incomplete cache. Serialize refreshes with a cross-process lock, or stage a complete unique directory and publish it atomically without deleting another writer's live directory.
- Files reviewed: 46/46 changed files
- Comments generated: 9
- Review effort level: Balanced
Match the successful grep completion to the grep tool invocation and document Java's bundled runtime-wrapper default. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f5c3c30-0cf7-4b9a-9a3b-2b01ca073015
Cross-SDK Consistency Review ✅This PR updates the managed launch path from the root
Behavioral parity: All six SDKs now error instead of silently falling back to a PATH-based One .NET-specific mechanism: The No cross-SDK consistency issues found.
|
|
Here's some output from a review agent. Sorry the formatting is a bit weird after the paste. Hopefully your agent can make sense of it even though the tables are misaligned. Manual validation. I rebuilt minimal consumers and reran all 48 combinations: six languages × stdio/TCP/in-process/existing URL × source/published. I required successful grep tool events and physically removed the SEA where possible. 23/48 satisfy both gates.
Minimal reproduction of the common defect: File.Delete("runtimes/linux-x64/native/copilot");
await StartAsync(RuntimeConnection.ForStdio()); // passes
await StartAsync(RuntimeConnection.ForInProcess()); // currently failsAdditional blockers. The PR disables real extension and factory E2Es because the new default loses the Node extension lifecycle (Node, .NET). That requires an explicit product decision or implementation, not skipped coverage. Also rather than disabling the e2e tests for extensions/factories, could we leave them there but have the test supply an external Node binary since we now support configuring that? |
Managed out-of-process SDK connections currently launch the root Copilot SEA directly. The runtime now provides a dedicated
copilot-runtimeexecutable that loads the adjacentruntime.node, so SDK-managed subprocess connections should use that coherent wrapper/addon pair while preserving explicit external server and in-process modes.What changed
copilot-runtime(copilot-runtime.exeon Windows).runtime.node, retaining the rootcopilotexecutable only for residual and in-process compatibility.cwdserialization issue discovered during end-to-end validation.Validation
Validated all six SDKs against the immutable same-tip runtime release candidate
adce886fd1across 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], selectedprebuilds/<platform>/runtime.nodeandcopilot-runtime[.exe], and retained package-relative runtime assets are staged as one coherent version. Mixed or incomplete artifact sets are rejected.