| ... | @@ -2,6 +2,32 @@ import { describe, expect, it } from "vite-plus/test"; | ... | @@ -2,6 +2,32 @@ import { describe, expect, it } from "vite-plus/test"; |
| 2 | import * as ThreadBackgroundLiveness from "./ThreadBackgroundLiveness.ts"; | 2 | import * as ThreadBackgroundLiveness from "./ThreadBackgroundLiveness.ts"; |
| 3 | | 3 | |
| 4 | describe("ThreadBackgroundLiveness", () => { | 4 | describe("ThreadBackgroundLiveness", () => { |
| | 5 | it("does not let status-free progress restart an idle task", () => { |
| | 6 | const liveness = ThreadBackgroundLiveness.make(); |
| | 7 | liveness.recordTaskLiveness({ |
| | 8 | threadId: "thread", |
| | 9 | taskId: "task", |
| | 10 | taskType: undefined, |
| | 11 | status: undefined, |
| | 12 | kind: "started", |
| | 13 | }); |
| | 14 | liveness.recordTaskLiveness({ |
| | 15 | threadId: "thread", |
| | 16 | taskId: "task", |
| | 17 | taskType: undefined, |
| | 18 | status: "idle", |
| | 19 | kind: "updated", |
| | 20 | }); |
| | 21 | liveness.recordTaskLiveness({ |
| | 22 | threadId: "thread", |
| | 23 | taskId: "task", |
| | 24 | taskType: undefined, |
| | 25 | status: undefined, |
| | 26 | kind: "progress", |
| | 27 | }); |
| | 28 | expect(liveness.getThreadBackgroundLiveness("thread")).toBeNull(); |
| | 29 | }); |
| | 30 | |
| 5 | it("agents present as working; monitors as monitoring; agents win", () => { | 31 | it("agents present as working; monitors as monitoring; agents win", () => { |
| 6 | const liveness = ThreadBackgroundLiveness.make(); | 32 | const liveness = ThreadBackgroundLiveness.make(); |
| 7 | const threadId = "t-live-1"; | 33 | const threadId = "t-live-1"; |