Skip to content
TypeScript

fix(web): keep queued threads subscribed (#15293)

ANSH SINGH4a90c1cf5db5
diff --git a/apps/web/src/state/threads.test.ts b/apps/web/src/state/threads.test.ts
index dc6585d75a9..c7cf8920746 100644
--- a/apps/web/src/state/threads.test.ts
+++ b/apps/web/src/state/threads.test.ts
@@ -19,7 +19,7 @@ import { createRunningThreadKeepAliveAtom } from "./threads";
const LOCAL = EnvironmentId.make("local");
const REMOTE = EnvironmentId.make("remote");
-type Status = "running" | "starting" | "idle";
+type Status = "running" | "starting" | "preparing" | "queued" | "waiting" | "idle";
function shell(id: string, status: Status | null) {
return { id: ThreadId.make(id), status: status ?? "idle" } satisfies Pick<
OrchestrationV2ThreadShell,
@@ -159,6 +159,12 @@ describe("createRunningThreadKeepAliveAtom", () => {
expect(h.openStreams()).toEqual([]);
});
+ it("keeps queued threads open", () => {
+ const h = makeHarness();
+ h.registry.set(h.threads(LOCAL), [shell("a", "queued")]);
+ expect(h.openStreams()).toEqual(["local:a"]);
+ });
+
it("follows environments that connect and go away", () => {
const h = makeHarness();
h.registry.set(h.environmentIds, [LOCAL]);
diff --git a/apps/web/src/state/threads.ts b/apps/web/src/state/threads.ts
index 59401e41e7c..4f62a2e6d2d 100644
--- a/apps/web/src/state/threads.ts
+++ b/apps/web/src/state/threads.ts
@@ -51,7 +51,7 @@ export function useEnvironmentThread(
}
const isRunning = (status: string) =>
- status === "preparing" || status === "starting" || status === "running";
+ status === "preparing" || status === "queued" || status === "starting" || status === "running";
type KeptThreads = ReadonlyMap<EnvironmentId, ReadonlySet<ThreadId>>;