diff --git a/apps/mobile/src/features/home/threadArchive.test.ts b/apps/mobile/src/features/home/threadArchive.test.ts index 06c521bb52..5f1320b762 100644 --- a/apps/mobile/src/features/home/threadArchive.test.ts +++ b/apps/mobile/src/features/home/threadArchive.test.ts @@ -26,10 +26,14 @@ describe("threadCanArchive", () => { expect(threadCanArchive(runtime("running", activeRunId))).toBe(false); }); - it("allows queued and post-provider waiting work despite a stale active run id", () => { - const staleActiveRunId = RunId.make("run-finished"); + it("only allows queued work when no provider run remains active", () => { + const activeRunId = RunId.make("run-live"); expect(threadCanArchive(runtime("queued", null))).toBe(true); - expect(threadCanArchive(runtime("queued", staleActiveRunId))).toBe(true); + expect(threadCanArchive(runtime("queued", activeRunId))).toBe(false); + }); + + it("allows post-provider waiting work despite a retained active run id", () => { + const staleActiveRunId = RunId.make("run-finished"); expect(threadCanArchive(runtime("waiting", null))).toBe(true); expect(threadCanArchive(runtime("waiting", staleActiveRunId))).toBe(true); }); diff --git a/apps/mobile/src/features/home/threadArchive.ts b/apps/mobile/src/features/home/threadArchive.ts index 342a7ba0a5..8eaf9fa541 100644 --- a/apps/mobile/src/features/home/threadArchive.ts +++ b/apps/mobile/src/features/home/threadArchive.ts @@ -5,6 +5,9 @@ import type { ThreadRuntimeSummary } from "@t3tools/client-runtime/state/models" * that provider is still executing a turn. */ export function threadCanArchive(runtime: ThreadRuntimeSummary | null | undefined): boolean { + if (runtime?.status === "queued") { + return runtime.activeRunId === null; + } return ( runtime?.status !== "preparing" && runtime?.status !== "starting" &&