Repository navigation
[WSLC] Proxy Pt. 2: Enable session host loopback - #1714
Draft
Elliot (theelliotm) wants to merge 1 commit into
Draft
Elliot (theelliotm) wants to merge 1 commit into
Elliot (theelliotm) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
5 of 11 tasks
Elliot (theelliotm)
force-pushed
the
user/emichlin/wslc-proxy-2-host-loopback
branch
from
November 10, 2026 22:17
7cbd0d1 to
30303eb
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The tests can miss shared-session relay exposure, incorrectly fail supported older WSL runtimes, and lack passing regression coverage for the non-loopback retry.
3 open issues
What changed in this PR
This PR adds Windows host-loopback access to WSLC workload sessions, advancing the built-in proxy stack. Bridged containers can reach Windows loopback services through host.wslc.internal on WSL 3.0.5+.
Changes:
- Shares session-creation logic across create-and-run execution and the lifecycle daemon, with a fallback for older runtimes.
- Adds token-based loopback reachability and isolation tests.
- Documents runtime requirements and the expanded access granted to existing all-
allowconfigurations.
| File | Description |
|---|---|
tests/scripts/wslc_loopback_token_server.ps1 |
Provides a Windows loopback listener with a per-run token. |
tests/scripts/run_wslc_state_aware_tests.ps1 |
Adds lifecycle loopback reachability and isolation checks. |
tests/scripts/run_wslc_host_loopback_test.ps1 |
Drives create-and-run loopback tests. |
tests/scripts/run_wslc_all_tests.ps1 |
Includes loopback tests in the full WSLC suite. |
tests/configs/wslc_network_host_loopback.json |
Defines the bridged loopback probe. |
tests/configs/wslc_network_host_loopback_isolated.json |
Defines isolated probes by hostname and relay address. |
src/mxc-sdk/src/backends/wslc/common/wslc_bindings.rs |
Loads the loopback-setting API and defines the runtime-update error. |
src/mxc-sdk/src/backends/wslc/common/wsl_container_runner.rs |
Uses shared session creation for create-and-run execution. |
src/mxc-sdk/src/backends/wslc/common/container_steps.rs |
Enables session loopback and retries without it on older runtimes. |
docs/backends/wslc/wslc-state-aware.md |
Documents loopback access through daemon sessions. |
docs/backends/wslc/wsl-container-getting-started.md |
Explains prerequisites, usage, and networking behavior changes. |
Review effort: Balanced
| let mut session: WslcSession = ptr::null_mut(); | ||
| let mut err_msg = CoTaskMemPWSTR::null(); | ||
| let mut hr = sdk.WslcCreateSession(settings, &mut session, err_msg.as_mut_ptr()); | ||
| if hr == WSLC_E_RUNTIME_UPDATE_NEEDED { |
Comment on lines
+66
to
+68
| } elseif ($bridged.Output -notmatch [regex]::Escape("HOST_LOOPBACK_GOT=[$($server.Token)]")) { | ||
| Write-Host "FAIL: bridged container did not reach the Windows 127.0.0.1:$port listener through host.wslc.internal" -ForegroundColor Red | ||
| $failed = $true |
Comment on lines
+1756
to
+1758
| if ($edgeStartedOk) { | ||
| Run-StateAwareTest "F: isolated exec cannot reach Windows loopback" { | ||
| Assert-True ([bool]$script:hostLoopbackAddr) "Lifecycle C resolved the host loopback address" |
This branch has not been deployed
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
Second PR in the WSLC built-in proxy stack (#1625). Turns on WSL host loopback, so
hostLoopback: allowreaches Windows127.0.0.1. Before this, it was accepted but had no effect.host.wslc.internal, which WSL's CLI also uses.WSLC_E_RUNTIME_UPDATE_NEEDED; MXC logs it and creates the session without host loopback.NONE) containers in a session with host loopback still can't reach Windows loopback, by name or by the relay address.Behavior change: on WSL 3.0.5+, existing all-
allowconfigs gain outbound access to every Windows loopback TCP port. There's no per-port filter; that comes with the controller later in the stack.🔗 References
Refs #1462
Spec: #1625
Stacked on #1679
🔍 Validation
On ARM64 with WSL 3.0.5.0 and
WSLC_SDK_PATHset to the local 3.0.5 SDK build:cargo build -p wxc --features wslc --releaseandcargo build -p mxc-sdk --bin wxc-wslc-daemon --features wslc --release: passedcargo fmt --all -- --check: passedcargo clippy -p mxc-sdk --features wslc --all-targets -- -D warnings: passedcargo test -p mxc-sdk --features wslc --lib wslc: passed (434 passed, 7 ignored)tests/scripts/run_wslc_host_loopback_test.ps1(new): passed. A bridged container gets a per-run token from a listener bound to Windows127.0.0.1; an isolated container doesn't get it throughhost.wslc.internalor169.254.73.254.tests/scripts/run_wslc_state_aware_tests.ps1: passed (141/141), including new checks that a bridged sandbox reaches the listener and an isolated sandbox in the same daemon session doesn't.Not run: x64, the full
run_wslc_all_tests.ps1after the final test changes, and WSL older than 3.0.5 (the fallback). CI WSLC builds fail on this stack until 3.0.5 is published.✅ Checklist
feature-acceptedCargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 Issue Type
Microsoft Reviewers: Open in CodeFlow