Repository navigation
fix(sandbox): deliver the WSL boot script over stdin, not argv - #226
Merged
Merged
Conversation
quickbeard
force-pushed
the
fix/wsl-broker-bridge
branch
from
August 13, 2026 15:31
4b0a765 to
8a48e97
Compare
wsl.exe reassembles its command line from Windows argv and drops the backslash-escaped quotes node spawn produces, which corrupted the one quoted space in the boot script: `cut -d" " -f3` reached the guest with a broken delimiter, HOST_IP computed empty, and the socat broker bridge dialed an empty host - every model request from a WSL sandbox failed with "other side closed". Feed /bin/sh the script over stdin (no quoting layer to corrupt), poll for the default route on cold VM boots, and run the provider test suite's project dir through tmpdir() so it also passes on Windows machines. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
Every model request from a WSL sandbox failed with
Cannot connect to API: other side closed, retrying forever. First live exercise of the WSL broker transport (the vz path was verified; WSL egress had only unit coverage).Diagnosis (verified live on Windows 11 / WSL 2.7.11)
The provider passed the guest boot script as one argv element:
wsl.exe -d <distro> -u root -- /bin/sh -c <script>. wsl.exe reassembles its command line from Windows argv and mishandles the backslash-escaped quotes node'sspawnproduces. The script's only quoted space —cut -d" " -f3in theHOST_IPcomputation — reached the guest corrupted (cut errored with "the delimiter must be a single character"),HOST_IPcame out empty, and the socat bridge ran assocat TCP-LISTEN:8788,... TCP::52714, dialing an empty host. Every other quoted string in the script happened to survive quote-stripping because nothing else quotes a space.Reproduced deterministically: the same line run from a file inside the guest prints the gateway IP; run through wsl.exe argv it prints empty.
Fix
/bin/shover stdin — no Windows argv quoting layer exists to corrupt it.tmpdir()instead of a literal/tmp, so the WSL backend's tests also pass on the Windows machines it targets.Verification
bun test src/wsl/frompackages/codev-sandbox: 17 pass (fake wsl now serves the boot script over stdin).TCP:172.30.48.1:<brokerPort>; a sandbox chat round-trip through the broker produced a model response, ran the Write tool with no permission prompt, and the file landed in the host project folder.🤖 Generated with Claude Code