fix(mobile): allow archiving post-provider work
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
aece3cb2f3
commit
ee78e27154
2 files changed
+9
-4
No files matched your search
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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"
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user