fix(auto): pause on out-of-scope task changes

This commit is contained in:
Mikael Hugo 2026-05-15 12:17:20 +02:00
parent 32362a83bc
commit 7c78994612

View file

@ -370,6 +370,7 @@ export async function autoCommitUnit(basePath, unitType, unitId, ctx) {
* - "dispatched" a signal caused stop/pause
* - "continue" proceed normally
* - "retry" artifact verification failed, s.pendingVerificationRetry set for loop re-iteration
* - unexpected execute-task file changes pause autonomy before verification/advance
*/
export async function postUnitPreVerification(pctx, opts) {
const {
@ -979,6 +980,20 @@ export async function postUnitPreVerification(pctx, opts) {
dedupe_key: `safety:file-change:${s.currentUnit.id}`,
},
);
if (taskRow.status === "complete") {
updateTaskStatus(sMid, sSid, sTid, "pending", null);
}
ctx.ui.notify(
`Safety: pausing ${s.currentUnit.type} ${s.currentUnit.id} because it changed files outside the task plan.`,
"error",
{
kind: "progress",
source: "safety",
dedupe_key: `safety:file-change-pause:${s.currentUnit.id}`,
},
);
await pauseAuto(ctx, pi);
return "dispatched";
}
}
}