Skip to content

Commit 70fd8a4

Browse files
Merge pull request #196 from corbitsdev/cl-6462-stall-fix
CL-6462: keep polling past the stall state
2 parents 9ddf93f + 736addf commit 70fd8a4

3 files changed

Lines changed: 32 additions & 7 deletions

File tree

‎apps/web/src/pages/home-page.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// implementation detail, and "0 of 5" told a waiting person nothing.
2121

2222
import { Button, EmptyState, PageShell } from "@corbits/react-ui";
23-
import { WarningCircle } from "@corbits/icons";
23+
import { Clock, WarningCircle } from "@corbits/icons";
2424
import { useEffect, useState } from "react";
2525

2626
import { listAllWorkbenches, WorkbenchLoadingState } from "@corbits/chat-ui";
@@ -75,8 +75,10 @@ export function HomeRoute({
7575
if (cancelled) return;
7676
if ((attempt + 1) * retryMs >= stallAfterMs) {
7777
setState({ kind: "slow" });
78-
return;
7978
}
79+
// Slow is a message, not a stop: retries keep going underneath it so
80+
// a backend that recovers after the stall still lands on its own —
81+
// "Retry" stays as an escape hatch, never the only way forward.
8082
retryTimer = setTimeout(() => setAttempt((count) => count + 1), retryMs);
8183
};
8284

@@ -185,12 +187,12 @@ export function HomeRoute({
185187
return (
186188
<PageShell width="full" className="page-fill">
187189
<EmptyState
188-
icon={<WarningCircle />}
190+
icon={<Clock />}
189191
title="Myra is taking longer than usual"
190192
description="She's still getting set up. Give it another moment, or try again."
191193
action={
192194
<Button variant="outline" onClick={startOver}>
193-
Try again
195+
Retry
194196
</Button>
195197
}
196198
/>

‎apps/web/src/shell/setup-progress-note.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export function SetupProgressNote() {
7878
return (
7979
<div className="setup-progress-note" role="status">
8080
<p className="setup-progress-note-text">
81-
Your workbench is still setting up the rest of its agents. Nothing to
82-
wait for — keep going.
81+
Your workbench is still setting up in the background. Nothing to wait
82+
for — keep going.
8383
</p>
8484
<Button
8585
variant="ghost"

‎apps/web/test/home-page.test.tsx‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,33 @@ describe("the wait right after connecting a provider", () => {
350350
expect(text).toContain("Myra is taking longer than usual");
351351
expect(text).not.toMatch(/\d+ of \d+/);
352352
const retry = Array.from(container?.querySelectorAll("button") ?? []).find(
353-
(button) => button.textContent === "Try again",
353+
(button) => button.textContent === "Retry",
354354
);
355355
expect(retry).not.toBeUndefined();
356356
});
357+
358+
test("auto-navigates once Myra becomes ready even after the stall message fires, with no click", async () => {
359+
// Myra doesn't answer until well past the stall threshold — the slow
360+
// message must not be the end of the line. Polling keeps going
361+
// underneath it, and the land happens on its own once she's ready.
362+
benchWhereMyraArrivesAfter(6);
363+
const navigated: string[] = [];
364+
await renderHome({ retryMs: 10, stallAfterMs: 40, navigated });
365+
for (let i = 0; i < 40; i++) {
366+
await settle();
367+
if ((container?.textContent ?? "").includes("longer than usual")) break;
368+
}
369+
expect(container?.textContent ?? "").toContain(
370+
"Myra is taking longer than usual",
371+
);
372+
373+
for (let i = 0; i < 60; i++) {
374+
await settle();
375+
if (navigated.length > 0) break;
376+
}
377+
378+
expect(navigated).toEqual(["/w/chan_new"]);
379+
});
357380
});
358381

359382
describe('a failed memberships fetch never reads as "pick from the switcher"', () => {

0 commit comments

Comments
 (0)