From 6d32481ee29b1f9ee604198867f681f12c5b8a40 Mon Sep 17 00:00:00 2001 From: Josh Gratton Date: Mon, 11 May 2026 11:53:58 -0400 Subject: [PATCH] fix(desktop): widen swap flow ceiling to cover stacked rollback waits The renderer's 180s ceiling was shorter than the IPC's worst-case duration: setWslBackend can take up to ~2min for the initial readiness wait plus another ~2min for the rollback readiness wait before throwing WslBackendSwapError, so the client was firing "Backend swap took too long" while the main process was still actively rolling back. Bump the ceiling to 6 minutes (4min IPC worst case + ~60s reauth retry budget + 45s welcome race) so a real hang still surfaces but a legitimate rollback completes. --- .../src/components/settings/ConnectionsSettings.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx index b84e291153..971c1c0f4a 100644 --- a/apps/web/src/components/settings/ConnectionsSettings.tsx +++ b/apps/web/src/components/settings/ConnectionsSettings.tsx @@ -2414,17 +2414,19 @@ export function ConnectionsSettings() { } }); - // Global ceiling on the whole flow — the IPC waits up to 2 minutes for - // the backend to come up (cold WSL boots + node-pty prep can be slow), - // the welcome wait is 45s after that, and reauth has its own retry loop. - // Cap the total so a hung step can't strand the modal forever. + // Global ceiling on the whole flow. The IPC handler has two stacked + // 2-minute waits worst-case (initial readiness + rollback readiness), so + // setWslBackend itself can legitimately take up to ~4 minutes before + // resolving; reauth adds another ~60s retry budget and the welcome race + // is bounded at 45s. We cap the total at 6 minutes so a true hang surfaces + // without firing prematurely while a legitimate rollback is in progress. let aborted = false; let flowTimeoutHandle: number | null = null; const flowTimeout = new Promise((_, reject) => { flowTimeoutHandle = window.setTimeout(() => { aborted = true; reject(new Error("Backend swap took too long. Check WSL is responsive and try again.")); - }, 180_000); + }, 360_000); }); const runSwap = async () => {