Skip to content

Commit 4a90c1c

Browse files
fix(web): keep queued threads subscribed (#15293)
Co-authored-by: maria <maria@kuuro.net>
1 parent b8d03ba commit 4a90c1c

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎apps/web/src/state/threads.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { createRunningThreadKeepAliveAtom } from "./threads";
1919
const LOCAL = EnvironmentId.make("local");
2020
const REMOTE = EnvironmentId.make("remote");
2121

22-
type Status = "running" | "starting" | "idle";
22+
type Status = "running" | "starting" | "preparing" | "queued" | "waiting" | "idle";
2323
function shell(id: string, status: Status | null) {
2424
return { id: ThreadId.make(id), status: status ?? "idle" } satisfies Pick<
2525
OrchestrationV2ThreadShell,
@@ -159,6 +159,12 @@ describe("createRunningThreadKeepAliveAtom", () => {
159159
expect(h.openStreams()).toEqual([]);
160160
});
161161

162+
it("keeps queued threads open", () => {
163+
const h = makeHarness();
164+
h.registry.set(h.threads(LOCAL), [shell("a", "queued")]);
165+
expect(h.openStreams()).toEqual(["local:a"]);
166+
});
167+
162168
it("follows environments that connect and go away", () => {
163169
const h = makeHarness();
164170
h.registry.set(h.environmentIds, [LOCAL]);

‎apps/web/src/state/threads.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function useEnvironmentThread(
5151
}
5252

5353
const isRunning = (status: string) =>
54-
status === "preparing" || status === "starting" || status === "running";
54+
status === "preparing" || status === "queued" || status === "starting" || status === "running";
5555

5656
type KeptThreads = ReadonlyMap<EnvironmentId, ReadonlySet<ThreadId>>;
5757

0 commit comments

Comments
 (0)