runner: keep export handoffs nonterminal through recovery

This commit is contained in:
2026-10-20 21:19:26 +01:00
parent ca78b24f47
commit ec3eda9e05
28 changed files with 370 additions and 82 deletions
+3 -1
View File
@@ -96,6 +96,7 @@ export function decisionTargetLabel(option, target) {
*/
export function pendingDecision(run) {
if (run == null || run.status !== RUN_STATUS_WAITING) return null;
if (Number(run.export_pending_sequence) > 0) return null;
const step = lastWaitingStep(run.steps ?? []);
const stepStage = str(step?.stage).trim() !== "" ? String(step.stage) : "";
const runStage = str(run.current_stage).trim() !== "" ? String(run.current_stage) : "";
@@ -103,6 +104,7 @@ export function pendingDecision(run) {
if (stageKey === "") return null;
const declared = (run.graph?.stages ?? []).find((candidate) => candidate?.key === stageKey) ?? null;
if (declared?.type && declared.type !== "human") return null;
const recorded = waitingOptions(step?.output);
const keys = recorded.length > 0 ? recorded : humanOptions(declared?.edges);
if (keys.length === 0) return null;
@@ -154,7 +156,7 @@ export class DecisionDraft {
/** Cancel is offered only while the run is executing. */
export function canCancel(run) {
return Boolean(run?.executing) && !run.cancel_requested && !run.cleanup_unconfirmed;
return (Boolean(run?.executing) || (run?.status === RUN_STATUS_WAITING && Number(run.export_pending_sequence) > 0)) && !run.cancel_requested && !run.cleanup_unconfirmed;
}
/** Retry is offered only for a loaded, non-executing, `failed` run. */