fix: read cancellation evidence for keyed execution release
Preserve operator-stop recovery suppression when newer callers release a run using only its company and run IDs. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
404ac6b228
commit
7fbf403a9f
|
|
@ -25344,11 +25344,16 @@ export function heartbeatService(
|
|||
options: { suppressImmediateRecovery?: boolean } = {},
|
||||
) {
|
||||
try {
|
||||
// Some release paths carry only the durable run key. Read authoritative
|
||||
// cancellation evidence before deciding whether automatic recovery is allowed.
|
||||
const latestRun = options.suppressImmediateRecovery ? null : await getRun(run.id);
|
||||
const operatorCancelled = latestRun?.companyId === run.companyId
|
||||
&& isOperatorCancelledRun(latestRun, latestRun.agentId);
|
||||
const { postCommitEffects } = await wakeQueue.releaseIssueExecution({
|
||||
companyId: run.companyId,
|
||||
runId: run.id,
|
||||
now: new Date(),
|
||||
suppressImmediateRecovery: options.suppressImmediateRecovery || isOperatorCancelledRun(run, run.agentId),
|
||||
suppressImmediateRecovery: options.suppressImmediateRecovery || operatorCancelled,
|
||||
});
|
||||
await applyWakeQueuePostCommitEffects(postCommitEffects);
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue