Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(backup): time out each restart status poll so the wait carries on

Bugfixer 237b5972f3a04
diff --git a/src/components/WorkspaceBackupSettings.test.ts b/src/components/WorkspaceBackupSettings.test.ts
index b13afe1131..c06962c618 100644
--- a/src/components/WorkspaceBackupSettings.test.ts
+++ b/src/components/WorkspaceBackupSettings.test.ts
@@ -168,6 +168,8 @@ describe("Settings full backups", () => {
fixture.api.mockResolvedValueOnce({ busy: false, pendingRestore: false, lastRestoreId: "stage-id" });
await vi.advanceTimersByTimeAsync(3_000);
expect(window.location.reload).toHaveBeenCalledOnce();
+ // A poll that hangs across the restart times out instead of stopping the wait.
+ expect(fixture.api.mock.calls.filter(([path, init]) => path === "/api/workspace-backup/status" && init?.timeoutMs === 10_000)).toHaveLength(3);
await vi.advanceTimersByTimeAsync(9_000);
expect(window.location.reload).toHaveBeenCalledOnce();
stop();
diff --git a/src/components/WorkspaceBackupSettings.tsx b/src/components/WorkspaceBackupSettings.tsx
index eda8ffab22..f44c337580 100644
--- a/src/components/WorkspaceBackupSettings.tsx
+++ b/src/components/WorkspaceBackupSettings.tsx
@@ -24,9 +24,10 @@ export function WorkspaceBackupRestartNotice({ onRetry, serverRestarts = false }
if (!serverRestarts) return;
let alive = true;
let timer: ReturnType<typeof setTimeout>;
- // One check at a time, so requests do not pile up while the server is down.
+ // One check at a time, so requests do not pile up while the server is down; a request that hangs
+ // across the restart times out, so polling carries on.
// A restored workspace may not know this browser's session: a reload shows sign-in.
- const check = () => api("/api/workspace-backup/status").then((status: BackupStatus) => status.pendingRestore === false ? "installed" : "wait",
+ const check = () => api("/api/workspace-backup/status", { timeoutMs: 10_000 }).then((status: BackupStatus) => status.pendingRestore === false ? "installed" : "wait",
(cause: unknown) => cause instanceof Error && "status" in cause && cause.status === 401 ? "signedOut" : "wait").then((state) => {
if (!alive) return;
if (state === "wait") timer = setTimeout(check, 3_000);