Files
PaperClipAI/server/src/services/explicit-continuation-retry-claim.ts
T
Devin FoleyandPaperclip 2e67ea8dc7 fix: renew explicit continuation authorization for bounded retries (#14987)
Preserve exact user-authorized continuation receipts across bounded retries and retain the task claim through owned retry admission. Stop, reassignment, superseding input, and active cleanup continue to block unsafe continuation.

Validation: exact-head Greptile 5/5, passing CI, no unresolved review threads, and a clean merge. Detailed verification and limitations are recorded in the pull request.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-05 10:57:57 -07:00

15 lines
780 B
TypeScript

import type { heartbeatRuns, issues } from "@paperclipai/db";
/**
* This claim must be settled by queue-first recovery, not generic terminal-lock
* cleanup. It is pending intent only; admission still validates its authority.
*/
export function isExplicitContinuationRetryClaim(
issue: Pick<typeof issues.$inferSelect, "id" | "companyId" | "executionRunId">,
run: Pick<typeof heartbeatRuns.$inferSelect, "id" | "companyId" | "runtimeMode" | "status" | "contextSnapshot"> | null | undefined,
) {
return Boolean(run && issue.executionRunId === run.id && run.companyId === issue.companyId &&
run.runtimeMode === "legacy" && ["failed", "timed_out"].includes(run.status) &&
run.contextSnapshot?.issueId === issue.id && run.contextSnapshot.explicitUserContinuation);
}