Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/web/src/state/threads.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/state/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Comment thread
coderabbitai[bot] marked this conversation as resolved.

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

Expand Down
Loading