The best way to control Claude Code, Codex and more from any computer or phone
fix(desktop): skip WSL distro probing while the WSL backend is off (#21225)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Victor Vogel committed
Oct 19, 2026 at 23:16 UTC
4846ba8af7d038d851618bc7c64b143fc082a2e2
3 files changed
+50
-6
apps/desktop/src/ipc/methods/wsl.test.ts
+37
@@ -120,6 +120,43 @@ describe("WSL IPC", () => {
120
),
121
);
122
123
+ it.effect("does not enumerate distros until the WSL backend is enabled", () => {
124
+ const distros = [
125
+ { name: "Ubuntu", isDefault: true, version: 2 as const },
126
+ { name: "Debian", isDefault: false, version: 2 as const },
127
+ ];
128
+ const layer = Layer.mergeAll(
129
+ DesktopAppSettings.layerTest({
130
+ ...DesktopAppSettings.DEFAULT_DESKTOP_SETTINGS,
131
+ wslDistro: "Debian",
132
+ }),
133
+ DesktopWslEnvironment.layerTest({ isAvailable: true, distros }),
134
+ layerWslBackend(),
135
+ layerLifecycle([]),
136
+ layerUnusedLifecycleRuntime,
137
+ );
138
+
139
+ return Effect.gen(function* () {
140
+ const wsl = yield* DesktopWslEnvironment.DesktopWslEnvironment;
141
+ const state = yield* getWslState.handler(undefined).pipe(
142
+ Effect.provideService(DesktopWslEnvironment.DesktopWslEnvironment, {
143
+ ...wsl,
144
+ listDistros: Effect.die("must not enumerate distros"),
145
+ }),
146
+ Effect.flatMap(decodeWslState),
147
+ );
148
+ assert.equal(state.enabled, false);
149
+ assert.equal(state.available, true);
150
+ assert.equal(state.distro, "Debian");
151
+ assert.deepEqual(state.distros, []);
152
+
153
+ const enabledState = yield* invokeSetWslBackendEnabled(true);
154
+ assert.equal(enabledState.enabled, true);
155
+ assert.equal(enabledState.distro, "Debian");
156
+ assert.deepEqual(enabledState.distros, distros);
157
+ }).pipe(Effect.provide(layer));
158
+ });
159
+
160
it.effect("stages dual-backend preferences before enabling without relaunching", () => {
161
const relaunchReasons: Array<string> = [];
162
const layer = Layer.mergeAll(
apps/desktop/src/ipc/methods/wsl.ts
+3
-3
@@ -22,9 +22,9 @@ const readWslState: Effect.Effect<
22
const wslBackend = yield* DesktopWslBackend.DesktopWslBackend;
23
const settings = yield* appSettings.get;
24
const available = settings.localEnvironmentEnabled && (yield* wslEnvironment.isAvailable);
25
- // Only enumerate distros when WSL is actually available — listDistros on a
26
- // non-WSL host would spawn wsl.exe and hit the timeout for nothing.
27
- const distros = available ? yield* wslEnvironment.listDistros : [];
25
+ // Windows ships a wsl.exe stub that can prompt to install WSL when invoked.
26
+ // Keep disabled state reads from launching it to enumerate distros.
27
+ const distros = available && settings.wslBackendEnabled ? yield* wslEnvironment.listDistros : [];
28
const preflightError = yield* wslBackend.lastPreflightError;
29
return {
30
enabled: settings.wslBackendEnabled,
apps/web/src/components/settings/ConnectionsSettings.tsx
+10
-3
@@ -3240,9 +3240,16 @@ export function ConnectionsSettings() {
3240
Off
3241
</SelectItem>
3242
{desktopWslState.distros.length === 0 ? (
3243
- <SelectItem hideIndicator value={BACKEND_VALUE_DEFAULT_WSL}>
3244
- Default distro
3245
- </SelectItem>
3243
+ <>
3244
+ <SelectItem hideIndicator value={BACKEND_VALUE_DEFAULT_WSL}>
3245
+ Default distro
3246
+ </SelectItem>
3247
+ {desktopWslState.distro !== null ? (
3248
+ <SelectItem hideIndicator value={desktopWslState.distro}>
3249
+ {desktopWslState.distro}
3250
+ </SelectItem>
3251
+ ) : null}
3252
+ </>
3253
) : (
3254
desktopWslState.distros.map((distro) => (
3255
<SelectItem hideIndicator key={distro.name} value={distro.name}>