From dd1b5244e508bf3aa33f8511a5b3b68ed624a4bc Mon Sep 17 00:00:00 2001 From: Dotta Date: Sat, 9 May 2026 16:27:30 -0500 Subject: [PATCH] Avoid locking source issue for recovery-action wakes Co-Authored-By: Paperclip --- server/src/services/heartbeat.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/services/heartbeat.ts b/server/src/services/heartbeat.ts index aef4801fe6c..192cf9048ff 100644 --- a/server/src/services/heartbeat.ts +++ b/server/src/services/heartbeat.ts @@ -5883,8 +5883,10 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {}) // Fix A (lazy locking): stamp executionRunId now that the run is actually running, // not at queue time. Guard is idempotent — safe if called more than once. - const claimedIssueId = readNonEmptyString(parseObject(claimed.contextSnapshot).issueId); - if (claimedIssueId) { + const claimedContext = parseObject(claimed.contextSnapshot); + const claimedIssueId = readNonEmptyString(claimedContext.issueId); + const claimedWakeReason = readNonEmptyString(claimedContext.wakeReason); + if (claimedIssueId && claimedWakeReason !== "source_scoped_recovery_action") { const claimedAgent = await getAgent(claimed.agentId); await db .update(issues)