Repository navigation
[WSLC] Give spawn a writable stdin and remove the WithStdin APIs - #1762
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Soham Das (SohamDas2021)
requested review from
a team
and
a balanced review from Copilot
November 13, 2026 07:09
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Existing V1 spawn APIs introduce breaking stdin and cancellation behavior that can hang callers or delete caller-owned containers, alongside missing WSLC regression coverage and overstated EOF guarantees.
4 open issues
What changed in this PR
This PR makes ordinary WSLC spawn operations expose writable stdin across the Rust, .NET, and Node SDKs, replacing the unreleased WithStdin APIs introduced for #1258.
Changes:
- Enables writable stdin for ordinary spawn operations while preserving immediate end-of-file for run-to-completion helpers.
- Updates native routing and SDK tests for input forwarding, stdin closure, and output collection.
- Refreshes SDK references and backend guides, including the WSLC lifecycle cancellation limitation.
| File | Description |
|---|---|
src/mxc-sdk/tests/state_aware.rs |
Removes the retired lifecycle API signature check. |
src/mxc-sdk/tests/pty_options_api.rs |
Updates spawn signature coverage. |
src/mxc-sdk/src/sandbox.rs |
Consolidates lifecycle spawning and updates stdin documentation. |
src/mxc-sdk/src/lib.rs |
Separates spawn and run stdin behavior; removes redundant APIs. |
src/mxc-sdk/src/core/mxc_engine/state_aware.rs |
Scopes the stdin setting to WSLC lifecycle execution. |
src/mxc-sdk/src/core/mxc_engine/mod.rs |
Enables stdin for ordinary JSON spawning. |
src/mxc-sdk/src/core/mxc_engine/dispatch.rs |
Keeps stdin selection WSLC-specific and preserves MicroVM settings. |
src/mxc-sdk/README.md |
Explains Rust spawn and run stdin behavior. |
src/ffi/mxc_ffi/src/streaming.rs |
Removes the separate stdin spawn export. |
src/ffi/mxc_ffi/src/state_aware.rs |
Adds the lifecycle run-helper export and updates validation tests. |
sdk/node/tests/unit/v1-dev.test.ts |
Checks Dev lifecycle run routing. |
sdk/node/tests/unit/streaming-binding.test.ts |
Tests ordinary stdin access and run-specific native routing. |
sdk/node/tests/unit/state-aware.test.ts |
Updates lifecycle routing assertions. |
sdk/node/tests/unit/inprocess-run.test.ts |
Removes retired API expectations. |
sdk/node/tests/integration/wslc-state-aware.test.ts |
Tests lifecycle stdin forwarding and run-mode /dev/null. |
sdk/node/tests/integration/wslc-e2e.test.ts |
Tests ordinary spawn input and EOF handling. |
sdk/node/src/v1/lifecycle.ts |
Separates lifecycle run routing from ordinary spawning. |
sdk/node/src/v1/index.ts |
Removes WithStdin exports. |
sdk/node/src/v1/dev/index.ts |
Routes Dev lifecycle runs through run-specific settings. |
sdk/node/src/v1/container.ts |
Removes the separate stdin spawn helper. |
sdk/node/src/v1/container-process.ts |
Updates stdin ownership documentation. |
sdk/node/src/bindings/streaming.ts |
Consolidates spawn bindings and adds lifecycle run routing. |
sdk/node/README.md |
Documents writable stdin on ordinary WSLC spawns. |
sdk/node/CHANGELOG.md |
Records changed defaults and lifecycle cancellation limits. |
sdk/dotnet/README.md |
Explains stdin disposal and wait behavior. |
sdk/dotnet/Microsoft.Mxc.Sdk/V1/MxcProcess.cs |
Clarifies when stdin can be unavailable. |
sdk/dotnet/Microsoft.Mxc.Sdk/V1/MxcLifecycle.cs |
Separates lifecycle run routing and enables WSLC stdin cleanup. |
sdk/dotnet/Microsoft.Mxc.Sdk/V1/MxcContainer.cs |
Consolidates spawn APIs and configures WSLC wait behavior. |
sdk/dotnet/Microsoft.Mxc.Sdk/V1/Dev/MxcLifecycle.cs |
Updates Dev lifecycle routing and stdin cleanup. |
sdk/dotnet/Microsoft.Mxc.Sdk/V1/Dev/MxcContainer.cs |
Enables WSLC stdin cleanup for Dev spawning. |
sdk/dotnet/Microsoft.Mxc.Sdk/V1/Dev/DevJsonRequest.cs |
Identifies requests targeting WSLC. |
sdk/dotnet/Microsoft.Mxc.Sdk/V1/ContainerAdapters.cs |
Removes retired stdin-specific adapter methods. |
sdk/dotnet/Microsoft.Mxc.Sdk.Tests/V1/SandboxAdapterTests.cs |
Removes the retired adapter-method test. |
sdk/dotnet/Microsoft.Mxc.Sdk.Tests/V1/MxcLifecycleWslcE2ETests.cs |
Tests ordinary lifecycle stdin and run-mode EOF behavior. |
sdk/dotnet/Microsoft.Mxc.Sdk.Tests/V1/MxcContainerWslcE2ETests.cs |
Migrates stdin scenarios to ordinary spawn operations. |
sdk/dotnet/Microsoft.Mxc.Sdk.Tests/DevEntryPointTests.cs |
Tests WSLC request identification. |
sdk/dotnet/CHANGELOG.md |
Records changed stdin defaults and lifecycle limits. |
docs/development/architecture/container-lifecycle.md |
Updates lifecycle API inventory and stream descriptions. |
docs/backends/wslc/wslc-state-aware.md |
Documents lifecycle stdin and cancellation consequences. |
docs/backends/wslc/wsl-container-getting-started.md |
Updates stdin guidance to use ordinary spawn APIs. |
docs/api-reference/rust/v1/types.md |
Removes retired process-producing API references. |
docs/api-reference/rust/v1/dev.md |
Documents Dev stdin behavior and lifecycle limits. |
docs/api-reference/rust/v1/api.md |
Updates spawn contracts and removes retired signatures. |
docs/api-reference/node/v1/dev.md |
Documents Dev stdin behavior and lifecycle limits. |
docs/api-reference/node/v1/api.md |
Updates spawn contracts and removes retired signatures. |
docs/api-reference/dotnet/v1/types.md |
Removes retired stdin-specific method signatures. |
docs/api-reference/dotnet/v1/dev.md |
Documents Dev stdin behavior and lifecycle limits. |
docs/api-reference/dotnet/v1/api.md |
Updates spawn contracts and removes retired methods. |
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Elliot (theelliotm)
previously approved these changes
Nov 14, 2026
Branden Bonaby (bbonaby)
previously approved these changes
Nov 14, 2026
Resolve the conflicts with spawn_with_extended_options (#1761) and the WSLC proxy tests (#1753): - SpawnStdio::Pipes gives a WSLC command a writable stdin, as spawn does, and the .NET extended spawns close an untaken WSLC stdin on wait. - Remove the WithStdin bindings and calls that came with #1761 and #1753; the stdin proxy tests use Spawn and spawn. - Keep createStreamingDriverWith calling its spawn argument, so inherited-stdio spawns do not fall back to pipes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve the conflicts with the NVX SDK support (#1752): - Keep both run entry points: the Node V1.Dev runInContainerJson uses mxc_exec_state_aware_capture_json, and the other run helpers keep mxc_exec_state_aware_for_run_json. Both give a WSLC command end-of-file. - Remove the stdin exec option from #1752's Node binding changes, and rename the Node run flag from capture to forRun so it does not read as the capture output mode. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Soham Das (SohamDas2021)
dismissed stale reviews from Branden Bonaby (bbonaby) and Elliot (theelliotm)
via
November 14, 2026 02:20
7cd4405
Branden Bonaby (bbonaby)
approved these changes
Nov 14, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The documentation overstates captured-stdin EOF guarantees for IsolationSession and omits the accepted WSLC V1 compatibility exception covering stdin handling and lifecycle timeout/kill behavior.
2 open issues
Review effort: Balanced
| stderr; only `spawnInContainerWithStdin` also gives it a writable stdin, as | ||
| `spawnWithStdin` does for create-and-run execution. | ||
| IsolationSession and WSLC provide stdin, stdout, and stderr for live piped | ||
| execution. Captured execution gives the workload end-of-file on stdin. |
| accepts or rejects, instead of a backend-specific field. | ||
| - Mark every Rust SDK options struct `#[non_exhaustive]` so options can gain | ||
| fields without a new operation, and fold `spawn` and `spawn_with_stdin` into | ||
| fields without a new operation, and fold `spawn` into |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



📖 Description
On WSLC,
spawnandspawn_in_containerstarted the command with stdin already at end-of-file, unlike the other backends with piped stdio. To give a WSLC command input, callers had to use separateWithStdinmethods.WSLC's ordinary spawn methods now return a writable stdin in all three SDKs, and the
WithStdinmethods are removed.spawnandspawn_in_containerin Rust,SpawnandSpawnInContainerin .NET, andspawnandspawnInContainerin Node, plus their V1.Dev JSON forms, give a WSLC command a writable stdin. Closing it, or waiting without taking it, gives the command end-of-file.runandrun_in_container, and their .NET, Node and V1.Dev forms, still start a WSLC command with stdin at end-of-file. The .NET and Node container run helpers now use a new native entry point,mxc_exec_state_aware_for_run_json, rather than the spawn entry point.spawn_with_stdinandspawn_in_container_with_stdin(Rust),SpawnWithStdin(Async)andSpawnInContainerWithStdin(Async)(.NET),spawnWithStdinandspawnInContainerWithStdin(Node), and the nativemxc_spawn_with_stdin_jsonandmxc_exec_state_aware_with_stdin_json. They were added in [WSLC] (1/2) Forward host stdin to state-aware exec #1562 and [WSLC] (2/2) Forward host stdin to create-and-run execution #1564 and only ever appeared under[Unreleased].Waitcloses a stdin the caller never took only for WSLC processes.Breaking change: v1.0.1 documented that WSLC gives a command no stdin, so a WSLC command started by
spawnorspawn_in_containerread end-of-file at once. Now a command that reads stdin waits until the caller closes stdin or waits for the process, so a caller that reads all output before waiting must close stdin first. A timeout or kill in an existing container changes too; see Limitation. This changes documented V1 behavior in place instead of adding a V2 API. Before merge, it still needs a V1 exception inversioning.mdand a breaking-change mark on the changelog entries.Limitation: killing a still-running WSLC
spawn_in_containercommand, or reaching its timeout, deletes its container about a minute later, because MXC does not signal a WSLC process that has stdin. This is documented in the WSLC guide, the API references and the changelogs. Separately, and before this change, on WSL 3.0.5WslcSignalProcess(SIGKILL)fails with0x80070032even for a command without stdin, so a timed-outrun_in_containerloses its container too. A follow-up issue will cover both.No spec: this makes WSLC's existing spawn methods behave like the other backends and removes methods that never shipped. There is no schema or MXC request JSON change.
🔗 References
Refs #1258
Follows #1562 and #1564, which added the
WithStdinmethods this PR replaces.Follow-up for the WSLC kill limitation: issue to be filed.
🔍 Validation
PR CI passes on
5ddeed829.PR CI doesn't run the WSLC tests, so they ran locally on
5ddeed829, on Windows build 26300 with WSL 3.0.5. They usedalpine:latestfrom the image store and native files built fromsrc/withcargo build -p mxc-sdk --bin wxc-wslc-daemon --features wslcandcargo build -p mxc_ffi --features "dotnetsdk wslc test-support"(both passed).src/:cargo test -p mxc-sdk --features wslc --test streaming_wslc -- --ignored --test-threads=1: 3/3 passednet8.0, built with the .NET 9MSBuild.dlland-p:TargetFramework=net8.0 -p:TargetFrameworks=net8.0 -p:MxcWithWslc=true -p:MxcPrebuiltNativeDir=<native files> -p:MxcTestPrebuiltNativeLibrary=<native files>\mxc_ffi.dll, because .NET SDK 10 isn't installed on this host. WithMXC_ENABLE_WSLC_TESTS=1,Microsoft.Mxc.Sdk.Tests.exe -class *.MxcContainerWslcE2ETests -class *.MxcLifecycleWslcE2ETests -parallelMode none: 20/20 passed, none skippednpm run buildinsdk/node/, thennpm ciandnpm run buildinsdk/node/tests/integration/, run there withMXC_ENABLE_WSLC_TESTS=1andMXC_FFI_DIRset to the native files:node --test dist/wslc-e2e.test.js: 9/9 passednode --test dist/wslc-state-aware.test.js: 2/2 passedThe WSLC tests cover:
runandrun_in_containerseeing/dev/nullas stdin, in Rust and in the .NET and Node typed and V1.Dev run helpersScheduled Validation Tests now build the Rust WSLC tests into the Windows SDK test bundle and run them in the WSLC lane. Building the bundle fails if a required WSLC stdin test is missing, and the lane fails if one is skipped or fails.
Not run: the Windows SDK test bundle build (needs .NET SDK 10), Scheduled Validation Tests on this branch, the WSLC tests on
net10.0,nvx_e2e(needs a MicroVM host), and thetests/scriptshost suites.✅ Checklist
feature-acceptedCargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 Issue Type
Microsoft Reviewers: Open in CodeFlow