From 38efd4e400715ef71db60b3313ff9cd2728002c5 Mon Sep 17 00:00:00 2001 From: Nicky Leach Date: Wed, 18 Nov 2026 19:29:02 -0800 Subject: [PATCH] Exercise the active recovery hold while admission owns the issue lock --- server/src/modules/wake-queue/adapters/postgres.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/modules/wake-queue/adapters/postgres.test.ts b/server/src/modules/wake-queue/adapters/postgres.test.ts index 7fc9d5b9e63..e2755b0f80a 100644 --- a/server/src/modules/wake-queue/adapters/postgres.test.ts +++ b/server/src/modules/wake-queue/adapters/postgres.test.ts @@ -194,7 +194,7 @@ describeEmbeddedPostgres("wake-queue postgres adapter", () => { }); const wakeId = await seedDeferredWake({ companyId, agentId: formerAgentId, issueId }); await db.insert(issueRecoveryActions).values({ - companyId, sourceIssueId: issueId, kind: "active_run_watchdog", ownerType: "board", status: "pending", + companyId, sourceIssueId: issueId, kind: "active_run_watchdog", ownerType: "board", status: "active", cause: "legacy_execution_requires_reconciliation", fingerprint: handoffRunId, nextAction: "Check the stopped execution.", }); @@ -203,6 +203,8 @@ describeEmbeddedPostgres("wake-queue postgres adapter", () => { const admit = createPostgresIssueWakeAdmission(db); try { await admit({ companyId, issueId }, async (tx, { fresh }) => { + await expect(db.execute(sql`select id from issues where id = ${issueId} for update nowait`)) + .rejects.toMatchObject({ cause: { code: "55P03" } }); const input = { issueId, agentId, handoffRunId, checkExecutionBlocker: true }; const receiptScope = { kind: "exact" as const, wakeId }; await expect(fresh.readCommentCandidates({ ...input, receiptScope: { ...receiptScope, wakeId: randomUUID() } }))