From c6b8815ad94277cf2cd50ff4e5cfa43bcbf5ba46 Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Fri, 15 May 2026 18:59:07 +0200 Subject: [PATCH] feat(verification): wire auto-defer into finalize phase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- .../extensions/sf/auto/phases-finalize.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/resources/extensions/sf/auto/phases-finalize.js b/src/resources/extensions/sf/auto/phases-finalize.js index ada0a96b4..e82782cba 100644 --- a/src/resources/extensions/sf/auto/phases-finalize.js +++ b/src/resources/extensions/sf/auto/phases-finalize.js @@ -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)