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.
This commit is contained in:
Josh Gratton committed 2026-05-16 11:38:36 -04:00
1 parent 4506e73863
commit 6d32481ee2
1 file changed
+7 -5
@@ -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<never>((_, 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 () => {