Skip to content

The open-source app everyone uses to manage agents at work

test(recovery): fix race condition in workspace validation comment check (#8294)

Nicky Leach6cfc6731d93b
diff --git a/server/src/__tests__/heartbeat-process-recovery.test.ts b/server/src/__tests__/heartbeat-process-recovery.test.ts
index 797fa16336..723f845537 100644
--- a/server/src/__tests__/heartbeat-process-recovery.test.ts
+++ b/server/src/__tests__/heartbeat-process-recovery.test.ts
@@ -1425,8 +1425,11 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
});
expect(recoveryAction?.nextAction).toContain("Repair the source issue workspace link");
- const comments = await db.select().from(issueComments).where(eq(issueComments.issueId, issueId));
- expect(comments.some((comment) => comment.body.includes("workspace failed validation"))).toBe(true);
+ const validationComment = await waitForValue(async () => {
+ const rows = await db.select().from(issueComments).where(eq(issueComments.issueId, issueId));
+ return rows.find((comment) => comment.body.includes("workspace failed validation")) ?? null;
+ });
+ expect(validationComment).toBeTruthy();
});
it("queues one finish-handoff wake when a successful run leaves in-progress work without a next action", async () => {