fix(test): gate interaction-continuation retry barrier on terminal write (#10049)

This commit is contained in:
Nicky Leach 2026-07-22 14:00:36 -07:00 committed by GitHub
parent 4e8cd757eb
commit 39b94d0e7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 1 deletions

View File

@ -2211,7 +2211,21 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
.select()
.from(heartbeatRuns)
.where(eq(heartbeatRuns.agentId, agentId));
return rows.length >= 2 ? rows : null;
if (rows.length < 2) return null;
// Gate on the *terminal* write of the background recovery, not the
// intermediate retry-run commit. recordPlanApprovalResumeFailureRetry
// writes the system comment first and updates the interaction
// result.resumeFailure last (heartbeat.ts:5627 then :5632), so once
// resumeFailure.status is observed the comment + issue update are also
// committed and every assertion below is race-free.
const interactionRow = await db
.select({ result: issueThreadInteractions.result })
.from(issueThreadInteractions)
.where(eq(issueThreadInteractions.id, interactionId))
.then((interactionRows) => interactionRows[0] ?? null);
const result = interactionRow?.result ?? null;
const resumeFailure = result && "resumeFailure" in result ? result.resumeFailure : null;
return resumeFailure?.status === "retrying" ? rows : null;
});
expect(runs).toHaveLength(2);