From d361a06dc3152472b3486f6993a0124c59bf7e84 Mon Sep 17 00:00:00 2001 From: Dotta Date: Sat, 10 Oct 2026 11:32:04 -0500 Subject: [PATCH] Compare project plans with the first started execution Co-Authored-By: Paperclip --- tests/e2e/agent-chat-projects.spec.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/e2e/agent-chat-projects.spec.ts b/tests/e2e/agent-chat-projects.spec.ts index d4979449e37..c8fcdc2345e 100644 --- a/tests/e2e/agent-chat-projects.spec.ts +++ b/tests/e2e/agent-chat-projects.spec.ts @@ -124,12 +124,19 @@ test("split handoff commits relevant plans before execution and never creates ch const runs = await json( await request.get(`/api/companies/${f.company.id}/heartbeat-runs`), ); - const run = runs.find( + const taskRuns = runs.filter( (run: any) => run.contextSnapshot?.issueId === task.id, ); - expect(run).toBeTruthy(); + expect(taskRuns.length).toBeGreaterThan(0); + const startedAt = taskRuns + .filter((run: any) => run.startedAt != null) + .map((run: any) => Date.parse(run.startedAt)); + // A newer queued/cancelled run need not have started. Preserve the + // invariant against the first actual execution, not list ordering. + expect(startedAt.length).toBeGreaterThan(0); + expect(startedAt.every(Number.isFinite)).toBe(true); expect(Date.parse(plan.updatedAt)).toBeLessThanOrEqual( - Date.parse(run.startedAt), + Math.min(...startedAt), ); } expect(