You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moves mxc_spawn_request onto koffi .async so a slow native spawn can't block Node's event loop.
LXC preparation downloads a container image and waits for a DHCP lease, so with LXC streaming now merged (#1333) that call can occupy the JavaScript thread for tens of seconds. wait and free already used .async; spawn did not.
Scope reduced after review. This PR originally also added a containment option to spawnSandbox/spawnSandboxAsync. Per Branden Bonaby (@bbonaby), those APIs are being replaced by the new public surface and callers will pass the config directly, so that half was dropped rather than churn an API that is going away. What remains is the internal FFI binding, which the new spawn/spawnWithPty entry points will route through.
Also corrects a stale README claim that the abstract process intent resolves to lxc on Linux; it resolves to Bubblewrap.
Testing: no CI lane exercises this path — MXC_SKIP_OS_BUILD_DEPENDENT_TESTS skips the native-streaming suite on all four sdk-integration-tests lanes, and the unit tests run against a fake native layer. Validated locally against a real mxc_ffi build on Windows/Node 24 (both native-streaming cases pass), plus unit coverage for off-thread dispatch, out-of-order concurrent spawns, and error mapping.
This can merge independently. It targets main and no longer shares any file with the rest of the stack beyond the await fixups in sdk/node/tests/integration/native-streaming.test.ts, which sit on top of #1333 as merged.
This test does not verify that each completion adopts its own handle: FakeNative.id() always returns 23 and free() only increments a counter, so both promises could accidentally adopt the first handle and every assertion would still pass. Make the fake return a handle-specific ID so this test actually catches shared/out-of-order out-parameter bugs.
Document microvm exception in spawnSandboxAsync containment contract
sdk/node/src/sandbox.ts:655
This IntelliSense contract overstates parity: spawnSandboxAsync still rejects microvm, while spawnSandbox can launch the generated MicroVM config through the executor (the README now documents this exception at lines 307–313). Please include that exception here so callers do not infer that every typed containment value behaves identically on both APIs.
Soham Das (SohamDas2021)
changed the title
[LXC] (5/5) Let the Node SDK select a containment backend in-process
[LXC] (5/5) Enable Node SDK select a containment backend in-process
Sep 30, 2026
Add Linux/LXC integration coverage for public spawnSandboxAsync API
sdk/node/tests/unit/inprocess-run.test.ts:150
This only verifies request projection because capture replaces the native implementation. The existing Linux LXC integration helper (tests/integration/linux-process-container.test.ts:39-47) still executes through spawnSandboxFromConfig, so the PR's main behavior—spawnSandboxAsync(..., { containment: 'lxc' }) actually reaching and running LXC in-process—has no integration coverage. Add a Linux/LXC-gated integration case that invokes this public API and asserts the backend identity.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
The advertised in-process LXC path lacks native integration coverage.
Review effort: Balanced Findings: None
Previously missed (1)
In code that hasn't changed since last review
Add LXC integration coverage for in-process spawn routing
sdk/node/src/sandbox.ts:780
The new in-process LXC path is only covered with _setBindingRunAsyncImplementation, so the native call is replaced before mxc_run_request or LXC runs. The existing LXC integration suite still uses spawnSandboxFromConfig through the executor, leaving the PR's main routing path unverified. Add a Linux integration case that calls spawnSandboxAsync(..., { containment: 'lxc' }) and checks the backend fingerprint.
Soham Das (SohamDas2021)
changed the title
[LXC] (5/5) Enable Node SDK select a containment backend in-process
[Node] Spawn the native sandbox off the JavaScript thread
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves
mxc_spawn_requestonto koffi.asyncso a slow native spawn can't block Node's event loop.LXC preparation downloads a container image and waits for a DHCP lease, so with LXC streaming now merged (#1333) that call can occupy the JavaScript thread for tens of seconds.
waitandfreealready used.async; spawn did not.Scope reduced after review. This PR originally also added a
containmentoption tospawnSandbox/spawnSandboxAsync. Per Branden Bonaby (@bbonaby), those APIs are being replaced by the new public surface and callers will pass the config directly, so that half was dropped rather than churn an API that is going away. What remains is the internal FFI binding, which the newspawn/spawnWithPtyentry points will route through.Also corrects a stale README claim that the abstract
processintent resolves tolxcon Linux; it resolves to Bubblewrap.Testing: no CI lane exercises this path —
MXC_SKIP_OS_BUILD_DEPENDENT_TESTSskips the native-streaming suite on all foursdk-integration-testslanes, and the unit tests run against a fake native layer. Validated locally against a realmxc_ffibuild on Windows/Node 24 (both native-streaming cases pass), plus unit coverage for off-thread dispatch, out-of-order concurrent spawns, and error mapping.This can merge independently. It targets
mainand no longer shares any file with the rest of the stack beyond theawaitfixups insdk/node/tests/integration/native-streaming.test.ts, which sit on top of #1333 as merged.Microsoft Reviewers: Open in CodeFlow