Skip to content

fix(desktop): WSL backend starts in distros without automounted drives - #25734

Merged
juliusmarminge merged 6 commits into
mainfrom
fix/issue-8297
Nov 14, 2026
Merged

juliusmarminge merged 6 commits into
mainfrom
fix/issue-8297

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Problem

In a WSL2 distro whose /etc/wsl.conf sets [automount] enabled=false, no Windows drive is mounted, so wsl.exe -d <distro> -- wslpath -u "C:/..." exits 1 with empty stdout. The desktop app installs the WSL runtime from the packaged archive by translating the archive's Windows path with wslpath, so prepareRuntime failed with wslpath conversion failed for …. The mounted-tree fallback needs wslpath too, so preflight retried 12 times and the app reverted to the Windows backend. The WSL backend could never start in such a distro.

Change

When wslpath cannot translate the runtime archive's path, prepareRuntime now copies the archive into the distro over wsl.exe stdin instead of reading it through /mnt:

  1. The install script runs once without an archive path. If the cached runtime is already ready it returns it as before, so a warm cache never copies anything. Otherwise it creates a staging directory under ~/.t3/wsl-runtime/ and prints its path.
  2. The host streams the archive file into wsl.exe --exec dd of=<stage>/runtime.tar.gz (no shell, no quoting in argv).
  3. The unchanged install script runs on that copy, including its SHA-256 check before extraction and its lock.
  4. The staging directory is removed afterwards on success or failure. Its .tmp. name means the existing prune collects one orphaned by a crash.

When wslpath succeeds, the existing path runs unchanged. runWslShell now wraps a small runWslProcess helper so the copy shares its spawn, drain and timeout handling.

Scope and approval

Fixes #8297

Triaged via the automated issue flow. The issue also notes that a secondary-backend preflight failure has no dialog in parallel mode and that the Connections picker shows "Off" after an in-memory fallback; those are separate defects and not changed here.

Verification

  • Red test (commit 4db907d): apps/desktop/src/wsl/DesktopWslEnvironment.test.ts › "installs the runtime when wslpath cannot translate the archive's Windows path". It drives the real DesktopWslEnvironment.layer with a fake wsl.exe that runs the distro side under local bash and makes wslpath exit 1 with wslpath: <path> on stderr, as automount-off does. On main it fails:
    AssertionError: expected { ok: false, …(1) } to deeply equal { ok: true, …(1) }
    +   "ok": false,
    +   "reason": "wslpath conversion failed for /tmp/tmp.xifCyaTJTj/wsl-runtime.tar.gz",
    
    On this branch it passes, and the installed t3 --version runs.
  • vp test run src/wsl/DesktopWslEnvironment.test.ts src/backend/DesktopBackendConfiguration.test.ts: 35/35 pass.
  • During implementation, temporary assertions (not committed) checked that a missing archive fails fast with a clear reason, a wrong SHA gives the existing mismatch error, no staging directory is left behind after success or failure, and a warm cache returns without reading the archive.
  • vp run check:changed: format, lint, knip, typecheck, tests pass.
  • No visible surface changes, so there are no captures.
  • cannot-verify windows: no Windows machine was available. The fix relies on wsl.exe --exec dd receiving the host's stdin as raw bytes with EOF passed through, as the existing wsl.exe --exec sh -s script channel already does. A truncated or corrupted copy would fail the SHA-256 check with a clear error instead of installing.

Model and harness: Claude Opus 5.5 (lead, red test, implementation, review B) and Codex gpt-6.1-sol (review A), in T3 Code.

🤖 Generated with Claude Code

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WSL backend never starts in a distro with automount disabled: wslpath conversion fails and the app silently falls back to Windows

1 participant