fix(mobile): distinguish queued and waiting archive states
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
1e736a710f
commit
9e286b6ac9
2 files changed
+10
-3
No files matched your search
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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" &&
|
||||
|
||||
Reference in new issue
Block a user