authorgravatar for anshsinghapa@gmail.comANSH SINGH <anshsinghapa@gmail.com> 2026-10-12 07:11:46+05:30
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-12 01:41:46+00:00
log4a90c1cf5db5f25893827643fb32d3304dddcdd9
tree94115cbf4a8d1157c5c80cebf16648f12b054da8
parentb8d03ba2dd2a511899a5187c0fbe477ef2b40bbe
signature Signed by PGP key B5690EEEBB952194

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

Co-authored-by: maria <maria@kuuro.net>

2 files changed, 8 insertions(+), 2 deletions(-)

apps/web/src/state/threads.test.ts+7-1
...@@ -19,7 +19,7 @@ import { createRunningThreadKeepAliveAtom } from "./threads";...@@ -19,7 +19,7 @@ import { createRunningThreadKeepAliveAtom } from "./threads";
19const LOCAL = EnvironmentId.make("local");19const LOCAL = EnvironmentId.make("local");
20const REMOTE = EnvironmentId.make("remote");20const REMOTE = EnvironmentId.make("remote");
2121
22type Status = "running" | "starting" | "idle";22type Status = "running" | "starting" | "preparing" | "queued" | "waiting" | "idle";
23function shell(id: string, status: Status | null) {23function shell(id: string, status: Status | null) {
24 return { id: ThreadId.make(id), status: status ?? "idle" } satisfies Pick<24 return { id: ThreadId.make(id), status: status ?? "idle" } satisfies Pick<
25 OrchestrationV2ThreadShell,25 OrchestrationV2ThreadShell,
...@@ -159,6 +159,12 @@ describe("createRunningThreadKeepAliveAtom", () => {...@@ -159,6 +159,12 @@ describe("createRunningThreadKeepAliveAtom", () => {
159 expect(h.openStreams()).toEqual([]);159 expect(h.openStreams()).toEqual([]);
160 });160 });
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
162 it("follows environments that connect and go away", () => {168 it("follows environments that connect and go away", () => {
163 const h = makeHarness();169 const h = makeHarness();
164 h.registry.set(h.environmentIds, [LOCAL]);170 h.registry.set(h.environmentIds, [LOCAL]);
apps/web/src/state/threads.ts+1-1
...@@ -51,7 +51,7 @@ export function useEnvironmentThread(...@@ -51,7 +51,7 @@ export function useEnvironmentThread(
51}51}
5252
53const isRunning = (status: string) =>53const isRunning = (status: string) =>
54 status === "preparing" || status === "starting" || status === "running";54 status === "preparing" || status === "queued" || status === "starting" || status === "running";
5555
56type KeptThreads = ReadonlyMap<EnvironmentId, ReadonlySet<ThreadId>>;56type KeptThreads = ReadonlyMap<EnvironmentId, ReadonlySet<ThreadId>>;
5757