mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-01 15:35:12 +01:00
Honor operator cancellation before immediate task recovery
Reuse the periodic recovery policy so an operator-cancelled run does not immediately dispatch a replacement and resume its sandbox. Keep explicit deferred wake promotion intact. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
1caad1bf9e
commit
5acb4274cb
4 files changed
+29
-1
No files matched your search
@@ -371,6 +371,7 @@ import {
|
||||
import { withRecoveryContext } from "./recovery/status-only-context.js";
|
||||
import {
|
||||
ACTIVE_RUN_OUTPUT_SUSPICION_THRESHOLD_MS as RECOVERY_ACTIVE_RUN_OUTPUT_SUSPICION_THRESHOLD_MS,
|
||||
isOperatorCancelledRun,
|
||||
recoveryService,
|
||||
} from "./recovery/service.js";
|
||||
import { collectDispositionRepairSourceState } from "./recovery/disposition-repair.js";
|
||||
@@ -23689,6 +23690,11 @@ export function heartbeatService(
|
||||
};
|
||||
}
|
||||
|
||||
// Match the periodic recovery policy: an operator's stop must not create
|
||||
// a fresh continuation that immediately resumes the cancelled sandbox.
|
||||
// Explicit deferred wakes above remain eligible for normal promotion.
|
||||
if (isOperatorCancelledRun(run)) return { kind: "released" as const };
|
||||
|
||||
const findExistingExecutionPath = (agentId?: string | null) =>
|
||||
tx
|
||||
.select({ id: heartbeatRuns.id })
|
||||
|
||||
@@ -608,7 +608,7 @@ function isStrandedIssueRecoveryIssue(issue: Pick<typeof issues.$inferSelect, "o
|
||||
* stopped the agent, and re-waking it — or escalating "stranding" — would
|
||||
* fight the human. Any newer run or wake supersedes the exemption.
|
||||
*/
|
||||
function isOperatorCancelledRun(latestRun: LatestIssueRun): boolean {
|
||||
export function isOperatorCancelledRun(latestRun: LatestIssueRun): boolean {
|
||||
if (!latestRun || latestRun.status !== "cancelled") return false;
|
||||
if (latestRun.errorCode === "operator_interrupted") return true;
|
||||
const result = parseObject(latestRun.resultJson);
|
||||
|
||||
Reference in new issue
Block a user