commitOrAmendMergeWithFixes used to swallow every unexpected throw as `reason: "unknown-phantom"` and the two callers re-threw a bare "verification fix finalize failed (unknown phantom)" with no operator- actionable signal. FN-5422-class wedges (preAttemptHeadSha == currentHead but branchTip ahead with task-trailered commits) couldn't be diagnosed without re-running. The catch now records the original error and probes whether the branch ref itself is authoritative for the task (tip carries Fusion-Task-Id trailer, base..branch is foreign-contamination-free). When it is — i.e. the work isn't lost, the integration worktree just didn't advance — the catch resets rootDir to preAttemptHeadSha so the next merge attempt starts from a known baseline instead of inheriting partial squash state, and returns `reason: "branch-ref-ahead-reset"`. The two callers fold `originalError=` and `branchAuthority=` into the thrown message so the real cause (diff-volume gate, file-scope, transient git, etc.) is visible in the run log. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.3 KiB
1.3 KiB
@runfusion/fusion
| @runfusion/fusion |
|---|
| patch |
Engine reliability: better diagnostics + clean-baseline reset on phantom finalize.
commitOrAmendMergeWithFixespreviously swallowed all unexpected errors asreason: "unknown-phantom"and the two callers re-threw averification fix finalize failed (unknown phantom)error with no surface area beyond the SHAs. FN-5422-class tasks wedged in review with no actionable signal in the failure message.- The catch now captures the original error message and runs an
isBranchAuthoritativeForTaskprobe (existing branch ref carries this task'sFusion-Task-Idtrailer + foreign-contamination check against base). When the branch ref is authoritative — meaning the AI's work is safely stored onfusion/<id>and only the in-merge attempt's integration worktree drifted — the catch resets rootDir topreAttemptHeadShaand returnsreason: "branch-ref-ahead-reset". The next merge attempt then starts from a known-good baseline instead of inheriting half-built squash state. - Verification-fix and build-verification-fix callers now include the original error and the branch-authority probe outcome in the thrown error, so operators see the actual failure cause (e.g. diff-volume regression, file-scope violation, transient git error) rather than
unknown phantom.