The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as DateTime from "effect/DateTime"; |
| 2 | import { describe, expect, it } from "vite-plus/test"; |
| 3 | |
| 4 | import { subagentResumedSince } from "./V2LifecycleRow.logic"; |
| 5 | |
| 6 | const failedAt = "2026-10-09T12:21:00.000Z"; |
| 7 | const beforeFailure = DateTime.makeUnsafe("2026-10-09T12:05:00.000Z"); |
| 8 | const afterFailure = DateTime.makeUnsafe("2026-10-09T12:48:00.000Z"); |
| 9 | |
| 10 | describe("subagentResumedSince", () => { |
| 11 | it("is true while it runs even when the notification was delivered after the resume", () => { |
| 12 | expect( |
| 13 | subagentResumedSince( |
| 14 | { status: "running", startedAt: afterFailure }, |
| 15 | "2026-10-09T12:50:00.000Z", |
| 16 | ), |
| 17 | ).toBe(true); |
| 18 | }); |
| 19 | |
| 20 | // regression: #18099 a resumed subagent's old failure notification row showed failed instead of resumed |
| 21 | it("is true once a run started after the notification has settled", () => { |
| 22 | expect(subagentResumedSince({ status: "completed", startedAt: afterFailure }, failedAt)).toBe( |
| 23 | true, |
| 24 | ); |
| 25 | }); |
| 26 | |
| 27 | it("is false for the run the notification reported on", () => { |
| 28 | expect(subagentResumedSince({ status: "failed", startedAt: beforeFailure }, failedAt)).toBe( |
| 29 | false, |
| 30 | ); |
| 31 | }); |
| 32 | }); |