test(server): retire duplicate process-loss recovery execution (#16088)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip authored and GitHub committed 2026-10-14 23:47:22 -05:00
1 parent 3b6d1452f2
commit 997ea5fd17
3 files changed
+186 -31

No files matched your search

@@ -10648,6 +10648,11 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
expect(runs).toHaveLength(2);
const retryRun = runs.find((row) => row.id !== runId);
expect(retryRun?.id).toBeTruthy();
expect(retryRun).toMatchObject({
status: "scheduled_retry",
scheduledRetryAttempt: 1,
});
expect(
retryRun?.contextSnapshot as Record<string, unknown> | undefined,
).toMatchObject({
@@ -11455,37 +11460,6 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
}
});
it("re-enqueues continuation for stranded in-progress work with no active run", async () => {
const { companyId, agentId, issueId, runId } =
await seedStrandedIssueFixture({
status: "in_progress",
runStatus: "failed",
});
const heartbeat = heartbeatService(db);
const result = await heartbeat.reconcileStrandedAssignedIssues();
expect(result.dispatchRequeued).toBe(0);
expect(result.continuationRequeued).toBe(1);
expect(result.escalated).toBe(0);
expect(result.issueIds).toEqual([issueId]);
const runs = await selectRecoveryRunsByAgent(agentId);
expect(runs).toHaveLength(2);
const retryRun = runs.find((row) => row.id !== runId);
expect(retryRun?.id).toBeTruthy();
expect(
(retryRun?.contextSnapshot as Record<string, unknown>)?.retryReason,
).toBe("transient_failure");
expect(
retryRun?.contextSnapshot as Record<string, unknown>,
).not.toHaveProperty("modelProfile");
expect(retryRun).toMatchObject({
status: "scheduled_retry",
scheduledRetryAttempt: 1,
});
});
it("does not run generic continuation recovery for a paused unfinished session goal", async () => {
const { companyId, agentId, issueId, runId } =
await seedStrandedIssueFixture({