feat: surface explicit auto-next obligation failure in force-recall hook

This commit is contained in:
Eve
2026-04-24 16:25:50 +08:00
parent 15570a3917
commit 8e290a4d9b
2 changed files with 19 additions and 3 deletions

View File

@@ -356,6 +356,11 @@ function buildApprovedPlanContinuityInput(wrapperResult: any, autoChainPlanResul
: (wrapperResult?.handoff?.mode === "button_path" ? "waiting_user" : "completed");
const dispatchReceipt = wrapperResult?.dispatchReceipt ?? null;
const nextTaskKnown = wrapperResult?.nextTaskKnown === true
|| (plannerDerivedAction != null && typeof autoChainPlanResult?.derivedAction === 'string' && autoChainPlanResult.derivedAction !== 'none');
const sameApprovedPlan = wrapperResult?.sameApprovedPlan === true || plannerDerivedAction != null;
const taskBoundaryStop = wrapperResult?.taskBoundaryStop === true || replyClosureState === 'completed';
const highRiskStop = wrapperResult?.highRiskStop === true;
return {
planId: wrapperResult?.planId ?? "hook-preflight-approved-plan",
@@ -364,6 +369,10 @@ function buildApprovedPlanContinuityInput(wrapperResult: any, autoChainPlanResul
nextDerivedAction,
replyClosureState,
dispatchReceipt,
nextTaskKnown,
sameApprovedPlan,
taskBoundaryStop,
highRiskStop,
};
}
@@ -387,7 +396,12 @@ function buildApprovedPlanContinuityBlock(result: ApprovedPlanContinuityResult |
if (result.ok === false) {
lines.push("- HARD_GATE: Do not close out this reply as normal completion.");
lines.push("- HARD_GATE: Route back to continuity failure until a real next dispatch receipt exists, unless closure state is waiting_user, blocked, or pending_verification.");
if (result.reason === 'missing_auto_next_dispatch') {
lines.push("- HARD_GATE: Do not stop at this completed-task boundary.");
lines.push("- HARD_GATE: Auto-dispatch the next task in the same approved plan, unless waiting_user, blocked, pending_verification, or high-risk stop applies.");
} else {
lines.push("- HARD_GATE: Route back to continuity failure until a real next dispatch receipt exists, unless closure state is waiting_user, blocked, or pending_verification.");
}
}
lines.push("[/APPROVED_PLAN_CONTINUITY_GATE]", "");