diff --git a/apps/mobile/src/features/home/threadArchive.test.ts b/apps/mobile/src/features/home/threadArchive.test.ts index 6d93ec8e80..06c521bb52 100644 --- a/apps/mobile/src/features/home/threadArchive.test.ts +++ b/apps/mobile/src/features/home/threadArchive.test.ts @@ -24,11 +24,13 @@ describe("threadCanArchive", () => { expect(threadCanArchive(runtime("preparing", activeRunId))).toBe(false); expect(threadCanArchive(runtime("starting", activeRunId))).toBe(false); expect(threadCanArchive(runtime("running", activeRunId))).toBe(false); - expect(threadCanArchive(runtime("queued", activeRunId))).toBe(false); }); - it("allows queued-only and post-provider waiting work", () => { + it("allows queued and post-provider waiting work despite a stale active run id", () => { + const staleActiveRunId = RunId.make("run-finished"); expect(threadCanArchive(runtime("queued", null))).toBe(true); + expect(threadCanArchive(runtime("queued", staleActiveRunId))).toBe(true); 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 aa1cd091fa..342a7ba0a5 100644 --- a/apps/mobile/src/features/home/threadArchive.ts +++ b/apps/mobile/src/features/home/threadArchive.ts @@ -1,4 +1,3 @@ -import { threadRuntimeHasInterruptibleRun } from "@t3tools/client-runtime/state/thread-execution"; import type { ThreadRuntimeSummary } from "@t3tools/client-runtime/state/models"; /** @@ -6,5 +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 { - return !threadRuntimeHasInterruptibleRun(runtime); + return ( + runtime?.status !== "preparing" && + runtime?.status !== "starting" && + runtime?.status !== "running" + ); }