The merge handoff refused with head-branch-mismatch whenever the reused worktree's HEAD wasn't on fusion/<id> (detached, recycled to main, or on a sibling branch), even when the branch ref itself still held a clean, task-attributed lineage. That wedged FN-5339-class tasks in review for no good reason. Add isBranchAuthoritativeForTask in branch-conflicts.ts (branch ref exists, tip carries Fusion-Task-Id trailer, base..branch is foreign- contamination-free) and use it in acquireReuseHandoff: when HEAD drifts but the branch ref is authoritative, run a plain `git checkout <branch>` inside the already-asserted-clean worktree, re-read HEAD, and emit a branch:auto-reattach-authoritative audit. Refusal still fires unchanged when the branch ref is missing, missing the trailer, or contaminated, so FN-5363 strict-lease and foreign-commit guards remain authoritative. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.2 KiB
1.2 KiB
@runfusion/fusion
| @runfusion/fusion |
|---|
| patch |
Engine reliability: auto-recover merge handoff from HEAD drift when the branch ref is authoritative.
acquireReuseHandoffpreviously refused outright withhead-branch-mismatch / unexpected-branchwhenever the worktree's HEAD pointed at anything other thanfusion/<id>(detached, recycled tomain, on a sibling branch). The existing case-mismatch autocorrect did not cover these states, leaving FN-5339-class tasks wedged in review even though their branch ref still held a clean, task-attributed lineage.- New
isBranchAuthoritativeForTaskhelper (inbranch-conflicts.ts) confirms the expected branch ref exists, its tip carries theFusion-Task-Id: <id>trailer, and thebase..branchrange has no foreign FN-attributed commits. - When that probe passes, the handoff now performs a plain
git checkout <branch>(not-B, which would clobber the ref) inside the already-asserted-clean worktree, re-reads HEAD, and emits abranch:auto-reattach-authoritativeaudit. Refusal still fires unchanged when the branch ref itself is missing, missing a trailer, or contaminated — so the FN-5363 strict-lease and foreign-commit protections remain authoritative.