Commit Graph

25 Commits

Author SHA1 Message Date
gsxdsm
5848606a9a feat(engine): post-session branch attribution audit
Contamination on fusion/<id> branches (FN-5233 was the recent example:
two untrailered feat(FN-5353): commits sitting on fusion/fn-5233) used
to be invisible until merge time, days after it happened. The executor
already runs assertCleanBranchAtBase at worktree acquisition and reclaim
— the gap was the active session window itself.

Add reportBranchAttribution(repoDir, branch, baseSha, taskId) which
walks base..branch and bins every commit into ownTrailed (healthy),
ownUntrailed (subject tag but commit-msg hook didn't fire), foreign
(different FN-id), or unattributed (no subject pattern, no trailer —
typically a hand-merge or plumbing commit). Wire it into the executor
right after captureModifiedFiles in the post-session path: when any
anomaly bucket is non-empty, emit a structured branch:attribution-
anomaly audit event and a task log entry. The audit itself is wrapped
in a try/catch so a probe failure never destabilizes a completing
session. New branch:attribution-anomaly and branch:auto-reattach-
authoritative GitMutationType variants accept the structured metadata
(the latter for the handoff re-attach added earlier this session).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 19:20:33 -07:00
gsxdsm
d947197c2a fix(engine): auto-reattach HEAD at handoff when branch ref is authoritative
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>
2026-05-21 19:03:35 -07:00
Fusion (runfusion.ai)
79850b233f feat(FN-5349): add integration branch resolver with auto-recovery fallback
FN-5349 adds a dedicated integration branch resolution module (`packages/engine/src/integration-branch.ts`) replacing ad-hoc dynamic fallbacks, routes merger branch conflict resolution through it, wires auto-recovery handlers (branch-worktree, contamination) to use integration branch fallback, and w

Fusion-Task-Id: FN-5349
2026-05-21 12:04:58 -07:00
Fusion (runfusion.ai)
fd202e9356 feat(FN-5329): remove orphan rescue and branch-recovery primitives from eng
Removes the branch-recovery CLI surface, orphan-rescue engine primitives, and their associated tests (over 1,500 lines deleted), while restoring a minimal prune-only orphan branch sweep with proper git audit mutation types. Documentation across `cli-reference.md`, `task-management.md`, and `AGENTS.m

Fusion-Task-Id: FN-5329
2026-05-20 16:43:27 -07:00
Fusion (runfusion.ai)
a0b75579b8 feat(FN-5094): merge fusion/fn-5094
Commits merged:
- merge fusion/fn-5094

Files changed:
.../self-healing-stale-merger-status.test.ts       | 200 +++++++++++++++++++++
 packages/engine/src/branch-conflicts.ts            |   6 +-
 packages/engine/src/run-audit.ts                   |   2 +
 packages/engine/src/self-healing.ts                |  67 ++++++-
 4 files changed, 271 insertions(+), 4 deletions(-)

Fusion-Task-Id: FN-5094

Fusion-Task-Lineage: c6c9710c-51fe-40e9-bfad-bfb6d589c7f4
2026-05-18 21:54:39 -07:00
gsxdsm
fac81b8432 fix(FN-5090): use live merge-base in classifyForeignOnlyContamination
When task.baseCommitSha becomes stale (because main has advanced past
it via legitimate merges of OTHER tasks), git log baseSha..branchName
includes commits that are already on main with foreign task-id
attribution. classifyForeignOnlyContamination then returns
kind="ambiguous" — own commits AND foreign commits in range — and the
contamination recovery skips, blocking the merger handoff
indefinitely.

This stranded FN-5092 after manual merges of FN-5060/FN-5090/FN-5053
moved main forward without updating downstream tasks' baseCommitSha.

Fix: when git merge-base(branch, main) is a descendant of the
persisted baseSha, prefer the live merge-base for the contamination
classification range. Fail open to persisted baseSha on any git
error. Also pass the effective base to classifyBootstrapMisbinding
so both classifiers see consistent input.

Fusion-Task-Id: FN-5090
2026-05-18 21:23:19 -07:00
Fusion (runfusion.ai)
300bc233cf feat(FN-4944): add post-finalize verification guard to prevent regressions
Added a verification guard for steps 1-4 in project-engine with companion regression tests covering both the merge-error recovery path and a post-finalize noop scenario using real git fixtures.

Fusion-Task-Id: FN-4944

Fusion-Task-Lineage: ca8fca22-c732-42e4-aa8d-a82981d2f36e
2026-05-17 17:39:46 -07:00
Fusion (runfusion.ai)
597aa79690 feat(FN-4948): complete Step 4 — classify and drop misrouted foreign commits
Fusion-Task-Id: FN-4948
Fusion-Task-Lineage: dc622643-4c3e-4217-9219-a6a6e5424427
2026-05-17 17:29:29 -07:00
Fusion (runfusion.ai)
91df093502 feat(FN-4887): complete Step 1 — add foreign-only contamination classifier
Fusion-Task-Id: FN-4887
Fusion-Task-Lineage: 559690d8-cea6-4323-a522-9ebb6aa25731
2026-05-17 17:07:01 -07:00
Fusion (runfusion.ai)
96a19309ae fix(FN-4884): finalize docs and keep workspace gates green
Fusion-Task-Id: FN-4884
Fusion-Task-Lineage: b906ade4-a9f1-4f2e-b684-4ebf49c3e7e6
2026-05-17 07:26:21 -07:00
Fusion (runfusion.ai)
030a27b40d feat(FN-4884): complete Step 2-3 fast-path and coverage
Fusion-Task-Id: FN-4884
Fusion-Task-Lineage: b906ade4-a9f1-4f2e-b684-4ebf49c3e7e6
2026-05-17 07:26:21 -07:00
Fusion
663e5d2cdc feat(FN-4508): complete Step 1 — harden inspectBranchConflict ghost/tip guards
Fusion-Task-Id: FN-4508
Fusion-Task-Lineage: 948a9cae-3975-4f15-bd47-2f88b379171d
2026-05-14 16:33:27 -07:00
Fusion
311bee43a0 feat(FN-4499): complete Step 3 — add reanchor primitive
Fusion-Task-Id: FN-4499
Fusion-Task-Lineage: 3e9fee75-5c3d-4ce5-aa8b-3f2bb94e48eb
2026-05-14 13:33:01 -07:00
Fusion
ec13b2b3a9 feat(FN-4499): complete Step 2 — add bootstrap misbinding classifier
Fusion-Task-Id: FN-4499
Fusion-Task-Lineage: 3e9fee75-5c3d-4ce5-aa8b-3f2bb94e48eb
2026-05-14 13:33:01 -07:00
Fusion
bcb0035d1a feat(FN-4500): complete Step 2 — harden zero-unique classifier
Fusion-Task-Id: FN-4500
Fusion-Task-Lineage: 81d33759-70f6-4958-abf8-3db20f918c01
2026-05-14 12:44:09 -07:00
Fusion
e01d2ef04f feat(FN-4485): complete Step 2 — tighten branch conflict classifier
Fusion-Task-Id: FN-4485
Fusion-Task-Lineage: 034088dc-ebc4-4e12-8314-39419d41b23f
2026-05-14 11:23:43 -07:00
Fusion
ab4729099c feat(FN-4476): complete Step 3 — add fully-subsumed branch conflict kind
Fusion-Task-Id: FN-4476
Fusion-Task-Lineage: 8673c1d9-f47e-4d02-89e6-646040b9be32
2026-05-14 08:49:37 -07:00
Fusion
69d35585cb feat(FN-4476): complete Step 2 — add patch-id unique commit helper
Fusion-Task-Id: FN-4476
Fusion-Task-Lineage: 8673c1d9-f47e-4d02-89e6-646040b9be32
2026-05-14 08:49:37 -07:00
Fusion
d672e53970 fix(FN-4428): address classification safety and recovery coverage
Fusion-Task-Id: FN-4428
Fusion-Task-Lineage: ea174f50-49ac-4105-b6cf-db3bab0984fd
2026-05-14 02:28:56 -07:00
Fusion
f576ba7849 feat(FN-4428): complete Step 2 — classify foreign commits
Fusion-Task-Id: FN-4428
Fusion-Task-Lineage: ea174f50-49ac-4105-b6cf-db3bab0984fd
2026-05-14 02:28:56 -07:00
gsxdsm
86f8caf14e chore(FN-4428): import dependency content from fusion/fn-4410
Squash-imported the working tree of fusion/fn-4410 as a single commit so this branch carries the dep's content without inheriting its individual commits. If the dep is later squash-merged to main, this commit's patch-id should match the merge and rebase cleanly.

Fusion-Task-Id: FN-4428
Fusion-Task-Lineage: ea174f50-49ac-4105-b6cf-db3bab0984fd
2026-05-14 02:28:56 -07:00
Fusion
d39430b344 feat(FN-4409): add branch contamination assertions in worktree flows
Fusion-Task-Id: FN-4409
Fusion-Task-Lineage: c608c942-fec7-4489-9970-b8dc314f8be2
2026-05-13 17:44:46 -07:00
Fusion
e16af74ce4 fix(FN-4397): complete Step 3 — treat unbound branch conflicts as stale-resolved
Fusion-Task-Id: FN-4397
Fusion-Task-Lineage: 1ffac4f7-adf5-4115-b588-108d75eadde7
2026-05-13 16:58:35 -07:00
gsxdsm
22fee60aee chore(FN-4350): import dependency content from fusion/fn-4326
Squash-imported the working tree of fusion/fn-4326 as a single commit so this branch carries the dep's content without inheriting its individual commits. If the dep is later squash-merged to main, this commit's patch-id should match the merge and rebase cleanly.

Fusion-Task-Id: FN-4350
Fusion-Task-Lineage: 11fff2c2-1cd1-4562-9b01-032a15217479
2026-05-13 12:30:45 -07:00
Fusion
bddcc3a931 feat(FN-4068): add branch conflict detection and recovery for stale worktre
Implements branch conflict detection and recovery across the Fusion engine, CLI, and dashboard — surfacing git worktree conflicts when tasks conflict with unrelated branch state, and providing a recovery workflow to resolve them. The executor and worktree pool now integrate typed branch conflict che

Fusion-Task-Id: FN-4068
2026-05-12 17:14:29 -07:00