The auto-recovery handler in branch-worktree.ts passed foreignCommits: [] to classifyBootstrapMisbinding, and the classifier gated isBootstrapMisbinding on foreignCommits.length > 0. The entire reanchor block was dead code on this path — the FN-5475 cascade hit "human adjudication" instead of recovering. The classifier now derives the foreign-commit count from its own git log walk; the input field is advisory/optional. Result type gains foreignCommitCount. The fallback handler also stops using ctx.task.baseCommitSha (deliberately stale per FN-4417) and computes a fresh merge-base against local main / origin/main, matching the executor's primary contamination path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.3 KiB
@fusion/engine
| @fusion/engine |
|---|
| patch |
fix(engine): un-deadcode the bootstrap-misbinding auto-recovery fallback
The auto-recovery handler in auto-recovery-handlers/branch-worktree.ts
called classifyBootstrapMisbinding with foreignCommits: [] because it
had no BranchCrossContaminationError in hand (it discovers the conflict
via inspectBranchConflict). The classifier's predicate gated on
foreignCommits.length > 0, so the input always resolved to
isBootstrapMisbinding: false and the re-anchor block was effectively
dead code.
The handler also used ctx.task.baseCommitSha as the contamination base,
which is deliberately preserved across sessions for diff math (FN-4417)
and can lag local main by many commits — causing legitimately-merged
landings to be classified as foreign at this layer.
Changes:
classifyBootstrapMisbindingnow derives the foreign-commit count from its owngit log baseSha..branchNamewalk;input.foreignCommitsis optional and advisory only. The result type gainsforeignCommitCount.- The
branch-worktreerecovery handler stops passing an empty array and computes a fresh merge-base against localmain(falling back toorigin/main), mirroring the executor's primary contamination path. - Regression tests cover both the no-
foreignCommitscall shape and theforeignCommitCountfield.