fix(recovery): exempt routine-parent issues from missing-disposition handoff (#8157)

Recognize active routine-parent issues as having a valid continuation path during successful-run handoff recovery. This prevents unnecessary missing-disposition corrective wakes when an active routine owns the next scheduled action.

Also keeps the routine-continuation guard before the productivity check so logs surface the decisive skip reason for both productive and non-productive routine-parent runs.

Verification:
- CI status checks passed on PR #8157
- Greptile Review passed at 5/5
- Focused recovery unit test passed locally

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
BuyWhere
2026-06-19 07:59:06 +07:00
committed by GitHub
parent 5c11725784
commit 67c98323b0
3 changed files with 44 additions and 0 deletions
+16
View File
@@ -4987,6 +4987,7 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
existingWake,
budgetBlock,
pauseHold,
activeRoutineContinuation,
] = await Promise.all([
issue
? db
@@ -5112,6 +5113,20 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
issue
? treeControlSvc.getActivePauseHoldGate(issue.companyId, issue.id)
: Promise.resolve(null),
issue
? db
.select({ id: routines.id })
.from(routines)
.where(
and(
eq(routines.companyId, issue.companyId),
eq(routines.parentIssueId, issue.id),
eq(routines.status, "active"),
),
)
.limit(1)
.then((rows) => rows[0] ?? null)
: Promise.resolve(null),
]);
const decision = decideSuccessfulRunHandoff({
@@ -5127,6 +5142,7 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
hasExplicitBlockerPath: Boolean(explicitBlocker),
hasOpenRecoveryIssue: Boolean(openRecoveryIssue),
hasPauseHold: Boolean(pauseHold),
hasActiveRoutineContinuation: Boolean(activeRoutineContinuation),
budgetBlocked: Boolean(budgetBlock),
idempotentWakeExists: Boolean(existingWake),
});