Skip to content

fix(desktop): WSL is not offered or started when only the Windows install stub exists - #40918

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-40910
Nov 22, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-40910

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

On Windows without WSL, the install stub System32\wsl.exe that Windows always ships made T3 Code treat WSL as installed. Settings offered WSL-only, and with it on, every launch spent about 80 seconds retrying a WSL backend that could never start, opening Windows' 'install WSL' prompt each time. makeIsAvailable now also requires a registered WSL service (WSLService for Store/MSI WSL, LxssManager for the inbox feature), read with reg.exe query without running wsl.exe. On a machine without WSL, the app hides the WSL option and starts on Windows straight away.

Fixes #40910

Reproduction on main

Commit f10e1eb (origin/main), on a pool Windows Server 2025 machine. Ran wsl.exe --uninstall so only the System32\wsl.exe stub remained; it prints 'The Windows Subsystem for Linux is not installed' and exits 1. Built the desktop app (vp i, vp run build:desktop) and saved <T3CODE_HOME>\userdata\desktop-settings.json as {"wslBackendEnabled":true,"wslOnly":true}, the state the Settings WSL toggles persist. Launched node scripts\start-electron.mjs on the interactive desktop. Seen: the primary backend failed preflight 12 times between 15:26:03 and 15:27:20 (about 77 s, backoff up to 10 s), each time with 'Unable to list WSL distributions: wsl.exe --list --verbose exited with code 1'. Every attempt opened a Windows Terminal: 'Windows Subsystem for Linux must be updated ... Press any key to install Windows Subsystem for Linux'. The 'T3 Code could not start' recovery window showed only Open releases / Copy details / Quit, with no option to start without WSL. After attempt 12 the log said 'primary WSL preflight retry window exhausted; using Windows for this launch' and a modal 'WSL backend is still unavailable ... T3 Code will use the Windows backend for this launch and retry WSL the next time the app starts' dialog appeared. After it was dismissed, the Windows backend became ready and the main window opened. Afterwards desktop-settings.json held only mainWindowBounds: the in-memory fallback was written to disk by the window-bounds save (the leak PR #26063 describes), not by an explicit choice. Captures: https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/98578fc473b8313e/crop-recovery.png https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/6c74c8229f81630b/crop-wslprompt.png https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/f4b5100d10455dc6/crop-dialog.png

Evidence

On Windows Server 2025, uninstall WSL while retaining the System32 stub, save both WSL flags as true in fresh app data, and launch each built desktop app without further input. Both recordings use the same 1920x1080 desktop, light theme, and 110-second observation window.

Before After
2c4310eb06 3f77e41224
Before: recovery window with no Windows fallback option After: normal welcome screen
Repeated installer prompts; 12 failed preflights over about 79 seconds, followed by a fallback modal. Windows primary selected immediately; welcome screen visible at about six seconds, with no WSL prompts.
Before recording After recording

Stills are unobscured app-window captures, stable across a 500 ms pair. Videos retain real-time playback; machine names and local log paths are masked.

Reproduction and capture driver · Export and privacy-mask script · Runtime transcript · Base log · Head log

Not shown:

  • Settings toggle availability and machines with working Store or inbox WSL installations were not exercised; this proof covers startup from persisted WSL-only settings with WSL absent.
  • The base fallback modal was not dismissed, so subsequent fallback settings persistence was not evaluated.

Tests

  • vp test run src/wsl/DesktopWslEnvironment.test.ts (apps/desktop): 21 passed; the new stub-only case fails against main's makeIsAvailable
  • vp run check:changed: format, lint, knip, typecheck (2 packages) and the test file all pass
  • Manual on Windows Server 2025: reg.exe query for the WSLService key gives 0 with WSL installed; after wsl.exe --uninstall both WSL service keys give 1 while System32\wsl.exe remains; Node's spawnSync of reg.exe query returns the same exit codes
  • CI on fix(desktop): WSL is not offered or started when only the Windows install stub exists #40918: all 8 required checks passed; CodeRabbit review had no actionable comments

Not in this change

  • runWslPreflight still marks a non-zero exit from wsl.exe --list --verbose as retryable (fatal: false), so WSL that breaks after the app starts still goes through the retry window.
  • The startup recovery window has no 'start without WSL' action while the WSL primary is retrying.
  • isAvailable is cached when the app starts, so installing or removing WSL while the app is open takes effect only after a restart.
  • The in-memory Windows fallback leaking into desktop-settings.json through the window-bounds save (described in fix(desktop): WSL-only falls back to Windows when the WSL backend keeps crashing #26063).

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

juliusmarminge and others added 2 commits November 22, 2026 15:36
…tall stub exists

System32\wsl.exe ships on Windows without WSL and only prompts to install
it, so detecting WSL by that file let Settings offer WSL-only and made
startup retry a WSL primary that could never start. Detect the Store WSL
package or the inbox WSL service instead.

Fixes #40910

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…still count

Probing Program Files\WSL and System32\lxss missed Store-packaged WSL,
whose binaries live under WindowsApps. Keep main's System32\wsl.exe check
and additionally require the WSLService (Store/MSI) or LxssManager (inbox)
service key, which the install stub alone does not have.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

WSL availability detection now checks the Windows registry for a registered WSL service after confirming that the platform is Windows and wsl.exe exists. Tests cover successful and unsuccessful service-key matches.

Changes: WSL availability detection

Layer / File(s) Summary
Registry-backed availability check
apps/desktop/src/wsl/DesktopWslEnvironment.ts, apps/desktop/src/wsl/DesktopWslEnvironment.test.ts
The availability check queries for the WSLService and LxssManager registry keys in parallel, with a five-second timeout. It returns unavailable if neither query succeeds. The tests simulate registry results and check both matching and non-matching keys.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • pingdotgg/t3code#27723 — This issue describes the same availability gap: the wsl.exe stub can exist without an installed WSL service.

Possibly related PRs

  • pingdotgg/t3code#27734 — Both PRs change WSL availability behavior on Windows hosts without WSL, using different detection mechanisms.

Suggested labels: bugfix

Suggested reviewers: macroscopeapp

Merge Risk: Minimal · up to 3f77e

This change stops the Windows wsl.exe install stub from being treated as an installed WSL, so the app hides the WSL option and starts normally when WSL is absent. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix (WSL is not offered or started when only the Windows install stub exists), and the changeset adds a registry check for WSLService or LxssManager to makeIsAvailable so that Syst…
Linked Issues check Passed Issue #40910 requires that T3 Code either prevent enabling WSL when WSL is not installed, or offer a startup option to start without WSL. The PR takes the prevention route. In apps/desktop/src/wsl/Des…
Out of Scope Changes check Passed The whole-PR diff against merge base 2c4310e touches DesktopWslEnvironment.ts (new WSL_SERVICE_KEYS, wslServiceRegistered, makeIsAvailable service check, and the ChildProcessSpawner provision in laye…
Description check Passed The description covers every required template section. Problem: On Windows without WSL, the System32\wsl.exe install stub made the app treat WSL as installed, which led to repeated retries of a WSL b…
Full details: Title check

Explanation

The title names the fix (WSL is not offered or started when only the Windows install stub exists), and the changeset adds a registry check for WSLService or LxssManager to makeIsAvailable so that System32\wsl.exe alone no longer counts as installed. The title is specific and matches the main change. It uses a conventional commit prefix and is 85 characters long, which is slightly above the typical length but still readable.

Full details: Linked Issues check

Explanation

Issue #40910 requires that T3 Code either prevent enabling WSL when WSL is not installed, or offer a startup option to start without WSL. The PR takes the prevention route. In apps/desktop/src/wsl/DesktopWslEnvironment.ts, makeIsAvailable still checks System32\wsl.exe, then requires a successful reg.exe query for HKLM\SYSTEM\CurrentControlSet\Services\WSLService or ...\LxssManager (run in parallel, 5 s timeout, errors resolve to false). The layer caches this result. When only the install stub exists, availability is false, so the WSL option is hidden and the app starts on Windows. The new test case covers the stub-only state and the inbox-key match. The retry-after-start path, the lack of a start-without-WSL action, cached availability, and the window-bounds leak are not part of #40910's stated not-installed case. The PR description lists them as deferred, so they do not fail this check. Reproduction and manual evidence claims come from the PR text and were not re-run here.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against merge base 2c4310e touches DesktopWslEnvironment.ts (new WSL_SERVICE_KEYS, wslServiceRegistered, makeIsAvailable service check, and the ChildProcessSpawner provision in layer) and DesktopWslEnvironment.test.ts (simulated reg.exe results and a new availability test). Each change supports the availability requirement for #40910. The spawner is needed for reg.exe, and the test support is needed to verify the change. No unrelated code changes were found in the reviewed diff.

Full details: Description check

Explanation

The description covers every required template section. Problem: On Windows without WSL, the System32\wsl.exe install stub made the app treat WSL as installed, which led to repeated retries of a WSL backend that could not start. Change: makeIsAvailable now also requires a registered WSL service (WSLService or LxssManager), read with reg.exe query, without running wsl.exe. Scope: it links issue #40910 as a bug fix. Verification: it lists focused test results (21 passed, with a new stub-only case that fails on main), check:changed results, and manual Windows Server 2025 registry checks. It also gives before/after evidence and states what was not shown. It names the model and harness that did the work. The Problem section gives reproduction steps and environment. The description is thorough and follows the template. The title line is not part of the provided text, so the conventional commit title cannot be confirmed.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2c4310e and 3f77e41.

Files selected for processing: 2

  • apps/desktop/src/wsl/DesktopWslEnvironment.test.ts
  • apps/desktop/src/wsl/DesktopWslEnvironment.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@juliusmarminge
juliusmarminge merged commit 5ddcc25 into main Nov 22, 2026
38 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-40910 branch November 22, 2026 16:31
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Nov 22, 2026
**v0.1.12-nightly.20261122.5111** · 30 changes from 10 contributors

- **Multi-file diffs.** Open diff now shows every file in a multi-file Codex patch.
- **Mixed-content paste.** Pasting a message with text and a picture now keeps both.
- **Queued attachments.** Edit a queued message without losing its image or file attachment chips.
- **Pull request checks.** Agents watching a pull request can recognize checks that already passed instead of waiting indefinitely.
- **Notebook outputs.** Saved HTML outputs now appear when you scroll them into view.

### Plus 24 more bug fixes and performance improvements.

<details>
<summary>Full changelog</summary>

## What's Changed
* perf(mobile): keep image bytes outside draft JSON by @t3dotgg in pingdotgg/t3code#9727
* fix(server): watch_pull_request says when checks already passed by @juliusmarminge in pingdotgg/t3code#40866
* fix(codex): Open diff shows every file of a multi-file patch by @Abhiram-745 in pingdotgg/t3code#40874
* fix(server): ACP startup gives up when the agent never answers the handshake by @juliusmarminge in pingdotgg/t3code#40864
* fix(server): a branch prefixed with another remote's name publishes under its full name by @Abhiram-745 in pingdotgg/t3code#40877
* fix(server): list open delegated tasks when task_status or task_cancel finds no match by @Project516 in pingdotgg/t3code#40886
* fix(gitlab): find merge requests opened from a fork by @Abhiram-745 in pingdotgg/t3code#40894
* fix(web): pasting a chat message with text and a picture keeps both by @juliusmarminge in pingdotgg/t3code#40909
* fix(antigravity): bound silent post-settle background command holds by @Lokkuchakreshkumar in pingdotgg/t3code#40858
* fix(desktop): WSL is not offered or started when only the Windows install stub exists by @juliusmarminge in pingdotgg/t3code#40918
* fix(server): idle /ws connections behind a reverse proxy no longer drop every 60s by @juliusmarminge in pingdotgg/t3code#40932
* fix(server): thread reads no longer attribute T3 Code's compact-before-send /compact to the user by @juliusmarminge in pingdotgg/t3code#40934
* fix(web,mobile): @-file mentions show by name in message previews, not as raw links by @tiliakoos in pingdotgg/t3code#40924
* fix(web): tool calls stay grouped after a usage-limit pause again by @matthew-waters in pingdotgg/t3code#40905
* fix(server): t3 doctor no longer reports a database just under 1 GiB as "1024.0 MiB" by @tiliakoos in pingdotgg/t3code#40952
* fix(web): show clone failure after progress is dismissed by @StiensWout in pingdotgg/t3code#40951
* Invalidate pending theme imports when a replacement is too large by @StiensWout in pingdotgg/t3code#40965
* fix(mobile): show linked thread history page errors by @StiensWout in pingdotgg/t3code#40973
* fix(client-runtime): skip waiting for lower-priority linked addresses by @StiensWout in pingdotgg/t3code#40989
* fix(web): navigate Excel sheets from the focused tab by @StiensWout in pingdotgg/t3code#41008
* fix(mobile): bound app-owned composer attachment filenames by @StiensWout in pingdotgg/t3code#40991
* fix(web): prioritize visible saved notebook outputs by @StiensWout in pingdotgg/t3code#40998
* fix(web): editing a queued message keeps its attachment chips resolved by @smirea in pingdotgg/t3code#40945
* fix(server): unlinking an environment ends its session on the other machine by @juliusmarminge in pingdotgg/t3code#41005
* fix(mobile): scope Git result banners to their originating thread by @StiensWout in pingdotgg/t3code#41015
* fix(web): keep the conversation when a pairing tab closes by @StiensWout in pingdotgg/t3code#41025
* fix: restart linked thread reads when trying again by @StiensWout in pingdotgg/t3code#41020
* fix(client-runtime): count ambiguous projects in chat file links by @StiensWout in pingdotgg/t3code#40986
* fix(mobile): keep media actions on each sent image page by @StiensWout in pingdotgg/t3code#41018
* perf(server): a run's provider turn lookup is linear, not quadratic by @navidnadali in pingdotgg/t3code#38791

## New Contributors
* @Lokkuchakreshkumar made their first contribution in pingdotgg/t3code#40858
* @matthew-waters made their first contribution in pingdotgg/t3code#40905

**Full Changelog**: pingdotgg/t3code@v0.1.12-nightly.20261122.5098...v0.1.12-nightly.20261122.5111

</details>


Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.12-nightly.20261122.5111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 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.

[Bug]: Enabling WSL without WSL installed softlocks the app until WSL is installed

1 participant