Skip to content

fix(desktop): skip WSL distro probing while the WSL backend is off - #22493

Open
only21mil wants to merge 2 commits into
pingdotgg:mainfrom
only21mil:r9/rl-21225
Open

only21mil wants to merge 2 commits into
pingdotgg:mainfrom
only21mil:r9/rl-21225

Conversation

@only21mil

@only21mil only21mil commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Re-lands #21225, which was merged and then reverted in #22222 with the other desktop fixes from the takeover batch. The revert comment asked for a fresh PR from the original commit, run on a real build that already has user state. This branch is git cherry-pick -x of the #21225 squash commit (4846ba8) onto main (d36b7da). It applied cleanly with no edits.

Problem

On Windows 11, C:\Windows\System32\wsl.exe exists even when WSL isn't installed, so isAvailable is true. Every desktop:get-wsl-state call then runs wsl.exe --list --verbose, even with the WSL backend off (the default). Opening Settings or the command palette is enough. On a host without WSL the stub exits with code 1, and #21038 reports that it can also show the Windows WSL install prompt.

Change

readWslState lists distros only when WSL is available and the backend is enabled. Availability is unchanged, so users can still turn WSL on. While the list is empty, the Connections picker also offers the saved distro next to "Default distro", so re-enabling keeps a saved non-default choice. The code is the #21225 commit as merged, unchanged.

Scope and approval

Verification

Real build with existing user state, Windows 11 x64 (Enterprise Evaluation VM, WSL not installed, the inbox wsl.exe stub present):

  1. Built unsigned NSIS packages for main (d36b7da) and this branch inside the VM, using the same node scripts/build-desktop-artifact.ts --platform win --target nsis --arch x64 --build-version 0.1.1-pr.21225 command for both, so both builds show version 0.1.1-pr.21225 in Settings. Each build went to its own folder, and each run used the packaged win-unpacked app from that build. I didn't run the installer.
  2. Both builds shared one state directory (T3CODE_HOME and APPDATA pointed at a scratch folder). Launch 1 used main for first-run setup. It added a git project (demo-app), sent a message in a thread, and changed two settings (Project grouping off, Claude provider off). A real Codex CLI 0.163.0, logged in with a placeholder API key, made the composer usable, so the thread's turn fails with 401 by design.
  3. In launches 2 to 5 (main, branch, branch, main), each launch opened Settings > Connections, the thread, and the Add project palette, with the WSL backend Off.
  4. Windows process-creation auditing (event 4688, with command lines) logged every wsl.exe start and the build that started it.

With the backend off, each main launch started wsl.exe --list --verbose once and the branch started none:

wsl.exe launches per build with the WSL backend off

The desktop trace shows why. On main, getWslState runs probeDistros, which fails because WSL isn't installed. On the branch, the same call returns in 0.2 ms without probing:

getWslState spans on main and on the branch

With the backend off and no saved non-default distro, the change has no visible effect, so main and the branch render the same Connections row and the same thread. The paired screenshots below are pixel-identical; the trace and the process log above tell the builds apart:

Main, launch 2, Connections with WSL backend Off

Branch, launch 3, the same state

Turning the backend on in the branch (Default distro, Run both backends) brings the probe back. Turning it off stops it:

Branch with the WSL backend on

wsl.exe launches after turning the backend on

The project and the thread with its failed turn opened in every launch. Branch launch 4 still showed both settings changed in launch 1:

Main, launch 2, the thread

Branch, launch 3, the same thread

Main, launch 1, Project grouping turned off

Branch, launch 4, Project grouping still off

I also reran the same packaged main and candidate builds on that existing state with a saved Debian preference populated while WSL was off. Neither build had installed distros, so both distro lists were empty, which is what the branch returns on any host while the backend is off. Main offered only Off and Default distro; the candidate also offered Debian:

Main picker with a saved Debian preference

Candidate picker with the same saved Debian preference

On the candidate, selecting Debian and Run both backends kept wslDistro: "Debian" with the backend enabled. After switching Off, selecting Default distro and Run both backends cleared it to null. The UI and the persisted settings file agreed. This checks preference handling, not successful WSL startup:

Candidate enabled with Debian preserved

Candidate default selection removes the saved Debian option

Focused test: with main's wsl.ts, the new test fails (must not enumerate distros). After merging main 05696c6, all 3 remaining tests pass on the branch.

wsl.test.ts with main's production code

wsl.test.ts on the branch

Also run on the branch: tsc-rs --noEmit in apps/desktop and apps/web, plus vp fmt --check and vp lint --report-unused-disable-directives on the three changed files.

Not checked:

Prior PRs: #21225 (merged, then reverted in #22222 for missing real-build proof). This PR re-lands it unchanged.

Production fix and tests are the #21225 squash commit, unchanged. They were written with Claude Opus 5.5 and revised in the maintainer takeover, with GPT-6.1 Sol on the implementation and GPT-6 Astra on the tests. Re-land and original Windows packaged-build verification, PR description and images by Claude Opus 5.5. Saved-distro packaged-build verification, description corrections and added screenshots by GPT-6.1 Sol in T3 Code Nightly.

🤖 Generated with Claude Opus 5.5 and GPT-6.1 Sol and GPT-6 Astra in T3 Code Nightly

…ingdotgg#21225)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 4846ba8)
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 20, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 61392ab

Macroscope's review found this PR approvable — This is a focused WSL bug fix: disabled-backend state reads no longer launch wsl.exe, while enabled behavior remains intact. The UI preserves a saved distro choice when live probing is skipped, with regression coverage for both states.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: 351cacd9-fc28-4175-a54a-81bbb034fb2e
📥 Commits

Reviewing files that changed from the base of the PR and between 61392ab and fb89238.

📒 Files selected for processing: 1
  • apps/desktop/src/ipc/methods/wsl.test.ts

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

📝 Walkthrough

WSL state reads now skip distro enumeration when the backend is disabled. The settings selector retains the configured distro option when no distros are discovered.

Changes: WSL distro state and selection

Layer / File(s) Summary
Gate WSL distro enumeration
apps/desktop/src/ipc/methods/wsl.ts, apps/desktop/src/ipc/methods/wsl.test.ts
readWslState lists distros only when WSL is available and the backend is enabled. Tests cover disabled and enabled backend states.
Retain configured distro option
apps/web/src/components/settings/ConnectionsSettings.tsx
When no distros are discovered, the selector shows the default-distro option and, if configured, the currently selected distro.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to fb892

The change appears ready to merge after normal checks; no actionable issue remains in the supplied evidence.

Architecture risk: 🔵 Low · up to fb892

The change affects 2 systems.

Changed systems: apps/desktop, apps/web

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.
  • observed — apps/web (ui) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in apps/desktop/src/ipc/methods/wsl.ts: readWslState now skips listDistros unless settings.wslBackendEnabled is true in addition to WSL availability; otherwise, distros is an empty list. The previous availability-only guard and its timeout-related comment were replaced.
  • observed — Modified behavior in apps/web/src/components/settings/ConnectionsSettings.tsx: When no WSL distros are discovered, the selector now retains the default-distro choice and conditionally includes the currently configured distro when one exists, instead of showing only the default-distro option.
  • observed — Modified behavior in apps/desktop/src/ipc/methods/wsl.test.ts: Added the getWslState IPC handler import for state verification.
  • observed — Modified behavior in apps/desktop/src/ipc/methods/wsl.test.ts: Added a test verifying that disabled WSL backends do not enumerate distros, while enabling the backend enumerates and returns the configured distro list.
Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: preventing WSL distro probing while the WSL backend is disabled.
Description check Passed The description includes complete Problem, Change, Scope and approval, and Verification sections. It provides issue links, detailed Windows verification, test results, screenshots, and explicit limita…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes complete Problem, Change, Scope and approval, and Verification sections. It provides issue links, detailed Windows verification, test results, screenshots, and explicit limitations.

✨ 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.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>

This branch has not been deployed

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

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant