fix(desktop): skip WSL distro probing while the WSL backend is off#21225
Opening Settings or the command palette could enumerate WSL distros while the backend was off. On Windows 11 without WSL installed, that runs the system wsl.exe stub and can trigger its install prompt.
Only enumerate when WSL is available and enabled. Keep availability unchanged so users can enable it. While enumeration is off, the Connections picker offers the saved distro alongside Default distro. Re-enabling the saved choice preserves it; explicitly choosing Default still clears the saved name. Enabling then loads installed distros normally.
Based on @only21mil’s focused fix in #21225, with the saved-distro reset tradeoff corrected. Fixes #21038; thanks @rabranruken for reporting and tracing the cause.
Verification on headless Linux:
- 8 IPC tests + 20 existing Connections logic tests: 28 → 28 passed. The single PR regression now includes saved Debian with Ubuntu as default. Main production fails that regression because disabled reads evaluate enumeration.
- Desktop and web scoped typechecks, focused lint and formatting passed. IPC tests use an Electron import-path override without launching Electron.
- The actual Connections page, picker, and confirmation dialog were driven through T3’s Browser panel with a controlled desktop bridge. Disabled + saved Debian + empty list offers Debian; selecting it and Run both backends preserves the saved name without calling setWslDistro. Explicit Default calls setWslDistro(null) and selects Ubuntu after enablement.
- Independent whole-diff reviews: Opus and Sol returned no required code changes in one round. An uninstalled saved distro uses existing preflight recovery.
Before — current main picker with the same saved Debian / empty-list snapshot:
Before: saved Debian is absent from the empty picker
After — saved Debian can be selected without enumeration:
After: saved Debian remains selectable while WSL is off
Recording: select saved Debian and enable both backends. Both use the same controlled snapshot and viewport. The browser fixture uses a temporary font override because this host does not render its default system fonts correctly.
Native Windows was not available: install-prompt suppression, real distro enumeration/startup, and WSL-only relaunch were not exercised. macOS, iOS, Android, and the Electron desktop process were not run. Browser proof covers the UI flow; mocked IPC regression proves the enumeration gate. Neither substitutes for Windows runtime validation. A saved distro may have been uninstalled while WSL was off; enabling it then uses existing preflight error recovery.
Implementation: GPT-6.1 Sol via Codex; tests: GPT-6 Astra via Codex; adversarial review: Claude Opus 5.5 via Claude Code and GPT-6 Sol via Codex, orchestrated in T3 Code.
Checks
Added 2 commits
Approvability
Verdict: Approved at f1059b5
Macroscope's review found this PR approvable — This is a narrowly scoped WSL bug fix that prevents unnecessary wsl.exe distro probing while the backend is disabled, without changing availability detection or the existing product default. A regression test verifies that probing resumes when the backend is enabled.
You can add or adjust custom eligibility rules. Learn more.
Warning
Review limit reached
Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.
Next included review available in 11 minutes.
View limit details
Limit details: You’ve used all 10 included reviews currently available.
Review configuration:
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d926a394-0f1d-4ff2-b8e2-d6bc828cbb57
📥 Commits
Reviewing files that changed from the base of the PR and between f1059b5ba65b5e0a0656f91b00318d3d9e2a50d5 and d4cdad3b6437f583f7e1d340d2f1dbf3689723e1.
📒 Files selected for processing: 3
apps/desktop/src/ipc/methods/wsl.test.tsapps/desktop/src/ipc/methods/wsl.tsapps/web/src/components/settings/ConnectionsSettings.tsx
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b1bcda22-d911-4e0a-aeb5-9dfa68cfe494
📥 Commits
Reviewing files that changed from the base of the PR and between 9c161462c94f7d9d6d9169da5c841457cbadf213 and f1059b5ba65b5e0a0656f91b00318d3d9e2a50d5.
📒 Files selected for processing: 2
apps/desktop/src/ipc/methods/wsl.test.tsapps/desktop/src/ipc/methods/wsl.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
readWslStatenow skips distro enumeration when the WSL backend is disabled. A test verifies the empty distro list in that state and the configured list after enabling the backend.Changes: WSL state
Layer / File(s) Summary Gate distro enumeration
apps/desktop/src/ipc/methods/wsl.ts,apps/desktop/src/ipc/methods/wsl.test.tsreadWslStatecallslistDistrosonly when the local environment is available and the WSL backend is enabled. The test checks that enumeration is skipped while disabled and returns the configured distros when enabled.Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
jgratton24
Merge Risk: ⚪ Minimal · up to f1059
With the WSL backend off, the app skips distro enumeration without starting wsl.exe; enabling the backend allows the distro list to populate. No actionable merge risk remains.
Architecture risk: 🔵 Low · up to f1059
The change affects 1 system.
Changed systems: apps/desktop
Architecture concerns No architecture-level concerns identified.
Review details
Systems and components
- observed — apps/desktop (service) was modified; 2 changed files map to changed impact.
Before / after behavior
- observed — Modified behavior in apps/desktop/src/ipc/methods/wsl.test.ts: Adds a test that makes distro enumeration fail if attempted while the backend is disabled, verifies WSL remains available with no listed distros, then enables the backend and checks that the configured distro list is returned.
- observed — Modified behavior in apps/desktop/src/ipc/methods/wsl.ts:
readWslStatenow callslistDistrosonly whenavailableandsettings.wslBackendEnabledare both true; otherwise, it returns an empty distro list. Previously, an available local environment triggered enumeration even when the WSL backend was disabled. The comments now describe the Windows 11wsl.exestub and its install prompt.
Pre-merge checks: Passed 4
Check name Status Explanation Linked Issues check Passed Issue #21038requires the desktop to avoid starting WSL when the backend is off, while keeping the local environment available.readWslStatenow callslistDistrosonly whenavailableand `settin…Out of Scope Changes check Passed The pull request changes only the WSL state gate and its regression test. The implementation change directly addresses issue #21038. The test supports the required behavior and does not add unrelated …Title check Passed The title clearly and concisely describes the primary change: preventing WSL distro probing when the WSL backend is disabled. Description check Passed The description provides a clear problem statement, explains the implementation and scope, links the related issue and prior fix, reports detailed verification results, includes UI evidence, and docum… Full details: Linked Issues check
Explanation
Issue
#21038requires the desktop to avoid starting WSL when the backend is off, while keeping the local environment available.readWslStatenow callslistDistrosonly whenavailableandsettings.wslBackendEnabledare true. The test verifies that an available WSL environment returns no distros and makes no enumeration call while the backend is off, then returns the configured distros after enabling the backend. The change keepsavailableunchanged, so Settings can still enable WSL.
Full details: Out of Scope Changes check
Explanation
The pull request changes only the WSL state gate and its regression test. The implementation change directly addresses issue
#21038. The test supports the required behavior and does not add unrelated scope.
Full details: Description check
Explanation
The description provides a clear problem statement, explains the implementation and scope, links the related issue and prior fix, reports detailed verification results, includes UI evidence, and documents untested Windows scenarios and agent usage. Although it does not use the template's exact section headings, the required information is present and complete.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Taking over this one as maintainer for batch desktop-app-02. I will keep it on the original PR, preserve the disabled-backend probe gate, and correct re-enablement so a saved non-default distro is retained. Thanks @only21mil for the focused diagnosis and regression test.
Added 3 commits
Reverting this in #22222 together with the other desktop fixes the takeover campaign merged yesterday. Nothing was wrong with the review of this change; it was merged on CI and code audits only, and after #20907 from the same batch broke existing installs the maintainer decided that desktop changes do not ship without being run on a real desktop build. To bring it back: open a fresh PR from the original commit, run it on a real build that already has user state on each platform it touches, and put the before/after proof in the body.