feat(verification): wire auto-defer into finalize phase

M003 S05 continuation: phases-finalize.js now handles "continue" from
runPostUnitVerification as an auto-defer path (low-risk findings).

- phases-finalize.js: added `verificationResult === "continue"` branch
  after pause/retry checks — logs "verification-deferred" and falls
  through to post-verification processing instead of breaking/retrying
- uok/auto-verification.js: defer decision runs before retry logic,
  returns "continue" without consuming retry attempts
- verification-evidence.js: forwards deferred fields in evidence JSON

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Mikael Hugo 2026-05-15 18:59:07 +02:00
parent f48a4cc7c5
commit c6b8815ad9

View file

@ -37,6 +37,7 @@ import {
import { resumeAutoAfterProviderDelay } from "../bootstrap/provider-error-resume.js";
import { debugLog } from "../debug-logger.js";
import { PROJECT_FILES } from "../detection.js";
import { getErrorMessage } from "../error-utils.js";
import { MergeConflictError } from "../git-service.js";
import { recordLearnedOutcome } from "../learning/runtime.js";
import { sfRoot } from "../paths.js";
@ -115,14 +116,16 @@ import {
FINALIZE_PRE_TIMEOUT_MS,
withTimeout,
} from "./finalize-timeout.js";
import {
recordLearningOutcomeForUnit,
shouldSkipArtifactVerification,
} from "./phases-helpers.js";
import { runUnit } from "./run-unit.js";
import { getErrorMessage } from "../error-utils.js";
import {
BUDGET_THRESHOLDS,
MAX_FINALIZE_TIMEOUTS,
MAX_RECOVERY_CHARS,
} from "./types.js";
import { recordLearningOutcomeForUnit, shouldSkipArtifactVerification } from "./phases-helpers.js";
// ─── runFinalize ──────────────────────────────────────────────────────────────
/**
@ -426,6 +429,16 @@ export async function runFinalize(ic, iterData, loopState, sidecarItem) {
return { action: "continue" };
}
}
if (verificationResult === "continue") {
// Verification was auto-deferred (low-risk findings) — proceed normally.
// The defer logic in runPostUnitVerification already notified the user
// and wrote deferred evidence; we just need to avoid the break/retry
// paths above and fall through to post-verification processing.
debugLog("autoLoop", {
phase: "verification-deferred",
iteration: ic.iteration,
});
}
}
}
// Post-verification processing (DB dual-write, hooks, triage, quick-tasks)