Skip to content

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

test(backup): cover a timed-out restart status poll; drop narration comments

Bugfixer 214e11867b244
diff --git a/src/components/WorkspaceBackupSettings.test.ts b/src/components/WorkspaceBackupSettings.test.ts
index c06962c618..51499af9dc 100644
--- a/src/components/WorkspaceBackupSettings.test.ts
+++ b/src/components/WorkspaceBackupSettings.test.ts
@@ -165,11 +165,13 @@ describe("Settings full backups", () => {
fixture.api.mockResolvedValueOnce({});
await vi.advanceTimersByTimeAsync(3_000);
expect(window.location.reload).not.toHaveBeenCalled();
+ fixture.api.mockRejectedValueOnce(new DOMException("The operation timed out.", "TimeoutError"));
+ await vi.advanceTimersByTimeAsync(3_000);
+ expect(window.location.reload).not.toHaveBeenCalled();
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);
+ expect(fixture.api.mock.calls.filter(([path, init]) => path === "/api/workspace-backup/status" && init?.timeoutMs === 10_000)).toHaveLength(4);
await vi.advanceTimersByTimeAsync(9_000);
expect(window.location.reload).toHaveBeenCalledOnce();
stop();
diff --git a/src/components/WorkspaceBackupSettings.tsx b/src/components/WorkspaceBackupSettings.tsx
index f44c337580..e47ae2e7dc 100644
--- a/src/components/WorkspaceBackupSettings.tsx
+++ b/src/components/WorkspaceBackupSettings.tsx
@@ -24,8 +24,6 @@ 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; 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", { 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) => {