Commit Graph

1247 Commits

Author SHA1 Message Date
Fusion
cb53d13623 feat(FN-4315): complete Step 1 — add audit recovery settings and bounce field plumbing
Fusion-Task-Id: FN-4315
Fusion-Task-Lineage: 2646fd86-e525-4b62-a041-616fa7789e84
2026-05-13 19:30:20 -07:00
gsxdsm
ab4df2a72f fix(FN-4417): prefer local main over origin/main in contamination base
Follow-up to 35854e047. The previous fix correctly stopped using
task.baseCommitSha for the contamination check, but the new
resolveContaminationBaseRef tried origin/main first and fell back to
local main only if the origin/main lookup failed. On dev machines that
have not pushed recently, origin/main is a tracking ref that can lag
local main by hundreds of commits. `git merge-base HEAD origin/main`
then resolves successfully and returns the last common ancestor between
the (force-reset-to-local-main) branch and the stale origin/main ref,
which is exactly the same stale SHA the prior bug surfaced. Every
commit on local main since that point is then flagged as foreign
contamination.

Observed: after restarting the engine with 35854e047, FN-4315/FN-4403
still failed with `since base 961f3da8bb7b...`. Local main was 166
commits ahead of origin/main; 961f3da was the last shared commit.

Fix: reorder the shell fallback to prefer `main` over `origin/main`.
Local main is the canonical integration target for Fusion's merger,
and origin/main is only useful as a fallback when local main does not
exist (rare in a worktree).

Test updated: `resolveContaminationBaseRef returns the current
merge-base...` now asserts local `main` appears before `origin/main` in
the issued command so the shell `||` resolves to local main first.

Fusion-Task-Id: FN-4417
2026-05-13 19:07:31 -07:00
gsxdsm
35854e0479 fix(FN-4417): stop false-positive branch contamination from stale baseCommitSha
The contamination check at executor.ts was reusing task.baseCommitSha as
its reference SHA. That field is intentionally preserved across resumed
sessions for stable diff math, which means it can lag behind main by
many commits. Passing it to assertCleanBranchAtBase caused every
legitimately-merged commit on main since the stale SHA to be reported
as a foreign task-attributed contamination commit, pausing the task
with pausedReason=branch-cross-contamination.

FN-4403 was the trigger case: a pooled worktree was force-reset to
current main by WorktreePool.prepareForTask (correctly), then the
executor immediately ran assertCleanBranchAtBase(rootDir, branch,
staleBaseCommitSha, taskId) and flagged 157 commits across ~39
unrelated FN-* tasks as contamination. FN-4417 itself then hit the
same bug when it tried to start, blocking the board.

Two fixes, both in packages/engine/src/executor.ts:

1. New resolveContaminationBaseRef(worktreePath) computes a fresh
   merge-base against origin/main or main and is used in place of
   resolveDiffBaseRef for the contamination check. It never reads
   task.baseCommitSha and never falls back to HEAD~1 (which on a
   force-reset pooled branch would be a main commit and re-introduce
   the same false positive at smaller scale). Returns undefined on
   git failure so the caller treats it as check skipped.

2. captureBaseCommitSha gains an explicit { isResume: boolean }
   parameter and only preserves an existing baseCommitSha when
   isResume is true. On fresh/pool acquisitions the branch was just
   force-reset to current main, so the stored value is stale by
   definition. Always recapture in that case. Diff-base stability
   across resumed sessions (FN-4309/FN-4383) is preserved by passing
   isResume: true on resume; the existing executor call site is
   already gated on non-resume and passes false.

Tests:
- executor-base-commit-capture.test.ts: updated to thread isResume
  through assertions and added a FN-4417 regression case that verifies
  a stale-but-ancestor baseCommitSha is recaptured (not preserved) on
  non-resume.
- executor-base-commit-capture.real-git.test.ts: FN-4309/FN-4383
  multi-session test now explicitly passes isResume: true on the
  second capture, matching the real resume code path.
- executor-contamination-base.test.ts (new): three focused tests for
  resolveContaminationBaseRef covering fresh-merge-base resolution,
  graceful failure when neither origin/main nor main resolves, and a
  structural guard that the function arity is 1 (no baseCommitSha
  parameter, so the bug cannot regress through that surface).

Verified: 4265 engine tests pass; tsc clean.

Fusion-Task-Id: FN-4417
2026-05-13 18:44:41 -07:00
Fusion
c1f787a0df 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
1941d2133e test(FN-4397): align worktree conflict tests with stale-resolved + tripwire assertions
Fusion-Task-Id: FN-4397
Fusion-Task-Lineage: 1ffac4f7-adf5-4115-b588-108d75eadde7
2026-05-13 16:58:35 -07:00
Fusion
09e6302798 fix(FN-4397): add branch-conflict tripwire and tighten stale detection
Fusion-Task-Id: FN-4397
Fusion-Task-Lineage: 1ffac4f7-adf5-4115-b588-108d75eadde7
2026-05-13 16:58:35 -07:00
Fusion
263de0cb3d 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
Fusion
3d2997ce8e test(FN-4397): add loop reproduction for repeated branch-conflict emissions
Fusion-Task-Id: FN-4397
Fusion-Task-Lineage: 1ffac4f7-adf5-4115-b588-108d75eadde7
2026-05-13 16:58:35 -07:00
Fusion
e88b5dbb01 test(FN-4397): annotate regression coverage for stale/live branch conflict
Fusion-Task-Id: FN-4397
Fusion-Task-Lineage: 1ffac4f7-adf5-4115-b588-108d75eadde7
2026-05-13 16:58:34 -07:00
Fusion
381ecbfe21 test(FN-4397): complete Step 2 — reproduce stale/live misclassification
Fusion-Task-Id: FN-4397
Fusion-Task-Lineage: 1ffac4f7-adf5-4115-b588-108d75eadde7
2026-05-13 16:58:34 -07:00
Fusion
ea4af60998 test(FN-4386): complete Step 3 — cover idle heartbeat timer gate
Fusion-Task-Id: FN-4386
Fusion-Task-Lineage: 82c1c281-8d69-42c1-8705-90e811b6df93
2026-05-13 16:38:00 -07:00
Fusion
8a9f320983 feat(FN-4386): complete Step 2 — gate timer heartbeat when idle
Fusion-Task-Id: FN-4386
Fusion-Task-Lineage: 82c1c281-8d69-42c1-8705-90e811b6df93
2026-05-13 16:38:00 -07:00
Fusion
be6fe05b2f test(FN-4307): fix notification tests for strict task status typing
Fusion-Task-Id: FN-4307
Fusion-Task-Lineage: 00140a5a-af93-4905-8570-32d7ecb8a874
2026-05-13 15:58:49 -07:00
Fusion
cd7779c3e0 test(FN-4307): add recovery-notification integration coverage
Fusion-Task-Id: FN-4307
Fusion-Task-Lineage: 00140a5a-af93-4905-8570-32d7ecb8a874
2026-05-13 15:58:48 -07:00
Fusion
425926b0b4 test(FN-4307): cover suppression signals and timer cleanup
Fusion-Task-Id: FN-4307
Fusion-Task-Lineage: 00140a5a-af93-4905-8570-32d7ecb8a874
2026-05-13 15:58:48 -07:00
Fusion
fac39cf72e test(FN-4307): add failed-notification grace window coverage
Fusion-Task-Id: FN-4307
Fusion-Task-Lineage: 00140a5a-af93-4905-8570-32d7ecb8a874
2026-05-13 15:58:48 -07:00
Fusion
76a07fea21 feat(FN-4307): complete Step 2 — suppress transient failure surfacing
Fusion-Task-Id: FN-4307
Fusion-Task-Lineage: 00140a5a-af93-4905-8570-32d7ecb8a874
2026-05-13 15:58:48 -07:00
Fusion
2e7e5e091c feat(FN-4307): complete Step 1 — defer failed notifications
Fusion-Task-Id: FN-4307
Fusion-Task-Lineage: 00140a5a-af93-4905-8570-32d7ecb8a874
2026-05-13 15:58:48 -07:00
Fusion
084047555c fix(FN-4383): satisfy tsc signatures in exec mock implementations
Fusion-Task-Id: FN-4383
Fusion-Task-Lineage: 69516bdf-34d1-405c-8bc9-b558c4780863
2026-05-13 15:28:34 -07:00
Fusion
86bcd2566b fix(FN-4383): align pooled worktree baseline tests with merge-base capture
Fusion-Task-Id: FN-4383
Fusion-Task-Lineage: 69516bdf-34d1-405c-8bc9-b558c4780863
2026-05-13 15:28:34 -07:00
Fusion
3695555757 test(FN-4383): complete Step 3 — add real-git base commit capture regression
Fusion-Task-Id: FN-4383
Fusion-Task-Lineage: 69516bdf-34d1-405c-8bc9-b558c4780863
2026-05-13 15:28:34 -07:00
Fusion
f9f8ee6f62 test(FN-4383): complete Step 2 — add base commit capture unit tests
Fusion-Task-Id: FN-4383
Fusion-Task-Lineage: 69516bdf-34d1-405c-8bc9-b558c4780863
2026-05-13 15:28:34 -07:00
Fusion
731aa7b14a feat(FN-4383): complete Step 1 — capture baseCommitSha from merge-base
Fusion-Task-Id: FN-4383
Fusion-Task-Lineage: 69516bdf-34d1-405c-8bc9-b558c4780863
2026-05-13 15:28:34 -07:00
Fusion
c9e8e7a350 test(FN-4332): align notifier defaults with legacy failure behavior
Fusion-Task-Id: FN-4332
Fusion-Task-Lineage: c920ac71-906b-458d-b496-1b60540b58f3
2026-05-13 15:15:41 -07:00
Fusion
bbd810e28a feat(FN-4332): complete Step 2 — defer failed notifications
Fusion-Task-Id: FN-4332
Fusion-Task-Lineage: c920ac71-906b-458d-b496-1b60540b58f3
2026-05-13 15:15:41 -07:00
Fusion
a302b12c76 test(FN-4379): complete Step 5 — real-git orphan-only recovery test
Fusion-Task-Id: FN-4379
Fusion-Task-Lineage: 88ee0f49-1db2-40e6-8781-7ecbc4dcbdc8
2026-05-13 14:22:23 -07:00
Fusion
78da8aef5c test(FN-4379): complete Step 4 — orphan-only scope unit coverage
Fusion-Task-Id: FN-4379
Fusion-Task-Lineage: 88ee0f49-1db2-40e6-8781-7ecbc4dcbdc8
2026-05-13 14:22:23 -07:00
Fusion
7d5f3b0e3f fix(FN-4379): honor paused tasks in orphan-only recovery
Fusion-Task-Id: FN-4379
Fusion-Task-Lineage: 88ee0f49-1db2-40e6-8781-7ecbc4dcbdc8
2026-05-13 14:22:23 -07:00
Fusion
4fe5792cf2 feat(FN-4379): complete Step 2 — orphan-only scope recovery implementation
Fusion-Task-Id: FN-4379
Fusion-Task-Lineage: 88ee0f49-1db2-40e6-8781-7ecbc4dcbdc8
2026-05-13 14:22:23 -07:00
Fusion
039e9a2d02 feat(FN-4309): guard squash commits against gitignored files
- Unstage gitignored paths before squash merge commit creation using git check-ignore
- Re-run the guard on the verification-fix squash restore path to keep ignored artifacts out of final merges
- Add merger tests covering forced .fusion artifacts, spaced ignored paths, and ignored-only squash results
- Document the gitignored-path merge guard and add a published package changeset

Fusion-Task-Id: FN-4309
2026-05-13 13:18:12 -07:00
Fusion
88a98194cc test(FN-4293): add tree-equality recovery tests
Fusion-Task-Id: FN-4293
Fusion-Task-Lineage: 5b7b5a50-d4f5-487c-b420-0ae2ea49b21f
2026-05-13 13:07:06 -07:00
Fusion
35482209bf feat(FN-4293): complete Step 3 — add tree-equality fallback
Fusion-Task-Id: FN-4293
Fusion-Task-Lineage: 5b7b5a50-d4f5-487c-b420-0ae2ea49b21f
2026-05-13 13:07:06 -07:00
Fusion
272e7ddd55 fix(FN-4350): complete Step 4 — pass verification gates
Fusion-Task-Id: FN-4350
Fusion-Task-Lineage: 11fff2c2-1cd1-4562-9b01-032a15217479
2026-05-13 12:30:45 -07:00
gsxdsm
f378874c14 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
259c650528 fix(FN-4350): complete Step 4 — pass verification gates
Fusion-Task-Id: FN-4350
Fusion-Task-Lineage: 11fff2c2-1cd1-4562-9b01-032a15217479
2026-05-13 12:26:07 -07:00
Fusion
6e5e2b0747 test(FN-4349): complete Step 6 — align block-path tests with new default
Fusion-Task-Id: FN-4349
Fusion-Task-Lineage: 7fa7b0ee-7705-4728-b425-1a3ac45e75a2
2026-05-13 12:16:51 -07:00
Fusion
41a99ca9b4 test(FN-4333): complete Step 4 — align audit helper test contract
Fusion-Task-Id: FN-4333
Fusion-Task-Lineage: 39442c0b-046e-4a34-8bdd-0f4c60bea451
2026-05-13 10:45:52 -07:00
Fusion
7b6db26f41 feat(FN-4333): complete Step 2 — wire audit mode and verified-rebase short-circuit
Fusion-Task-Id: FN-4333
Fusion-Task-Lineage: 39442c0b-046e-4a34-8bdd-0f4c60bea451
2026-05-13 10:45:52 -07:00
Fusion
d93aeaa1c0 test(FN-4295): complete Step 2 — add 1.5x stale threshold coverage
Fusion-Task-Id: FN-4295
Fusion-Task-Lineage: e2a47487-33f5-4077-8031-c7bb14882121
2026-05-13 10:08:30 -07:00
Fusion
2437aae418 feat(FN-4295): complete Step 1 — update reports stale threshold multiplier
Fusion-Task-Id: FN-4295
Fusion-Task-Lineage: e2a47487-33f5-4077-8031-c7bb14882121
2026-05-13 10:08:29 -07:00
Fusion
121198852f docs(FN-4333): document postMergeAuditMode + add mode=off/warn integration tests
Adopts the documentation and integration test additions from the
Fusion executor's parallel work on FN-4333 (sleek-oak worktree). The
core hot-fix already landed in ccd718acd.

- AGENTS.md: update the post-squash audit paragraph to describe the
  three modes and the verified-tree short-circuit.
- docs/settings-reference.md: add postMergeAuditMode row.
- packages/engine/src/__tests__/merger-merge-lifecycle.test.ts: add
  integration tests covering postMergeAuditMode=off (skips audit) and
  postMergeAuditMode=warn (continues despite dirty findings).

Fusion-Task-Id: FN-4333
2026-05-13 09:53:45 -07:00
gsxdsm
961f3da8bb feat(FN-4333): emergency hot-fix for post-merge audit blocks
Stop the post-merge audit from parking tasks as `failed` when deterministic
merge verification already proved the merged tree. Adds `postMergeAuditMode`
project setting (`block` | `warn` | `off`, default `block`) and a
verified-tree short-circuit for rebase-strategy overlap-only findings.

- packages/engine/src/merger.ts: new `resolvePostMergeAuditAction` helper
  + audit call site gated on `postMergeAuditMode` and verification-cache
  lookup. Rebase + overlap-only + verified-tree → pass through with a
  short-circuit log entry instead of throwing SquashAuditError.
- packages/core/src/types.ts, settings-schema.ts, index.ts: new
  `PostMergeAuditMode` type, `postMergeAuditMode` field on Settings,
  default `block`, exports `normalizePostMergeAuditMode`.
- packages/engine/src/__tests__/post-merge-audit-action.test.ts: unit
  tests for the decision helper.
- packages/dashboard/app/components/SettingsModal.tsx: settings UI row.
- .changeset: minor bump for @runfusion/fusion.

The FN-3936 silent-drop guard is preserved: duplicate-subject findings
still block in `block` mode and squash-strategy audits still block
(no equivalent deterministic guarantee).

Fusion-Task-Id: FN-4333
2026-05-13 09:06:20 -07:00
Fusion
0683611ea3 feat(FN-4278): clarify orphaned-running timeout semantics in agent heartbea
Clarifies orphaned-running timeout semantics in the agents documentation and adds a related implementation detail in the agent heartbeat module.

Fusion-Task-Id: FN-4278
2026-05-13 09:06:20 -07:00
Fusion
758d213d9c feat(FN-4080): complete Step 2 — route thinking persistence by agent kind
Fusion-Task-Id: FN-4080
Fusion-Task-Lineage: 086863ba-7100-41ab-9cfc-197301fbcab0
2026-05-13 06:29:36 -07:00
Fusion
7a38039a39 test(FN-4115): refine Step 3 stranded-review invariant coverage
Fusion-Task-Id: FN-4115
Fusion-Task-Lineage: 9e34cdc1-ac78-41f2-9587-269f50b30af4
2026-05-13 06:29:36 -07:00
Fusion
8035f05b7a test(FN-4115): complete Step 3 — stranded in-review recovery tests
Fusion-Task-Id: FN-4115
Fusion-Task-Lineage: 9e34cdc1-ac78-41f2-9587-269f50b30af4
2026-05-13 06:29:36 -07:00
Fusion
95e21b1c91 test(FN-4115): complete Step 2 — paused todo normalization tests
Fusion-Task-Id: FN-4115
Fusion-Task-Lineage: 9e34cdc1-ac78-41f2-9587-269f50b30af4
2026-05-13 06:29:36 -07:00
Fusion
65e163833a test(FN-4115): complete Step 1 — wrong-checkout completion rejection tests
Fusion-Task-Id: FN-4115
Fusion-Task-Lineage: 9e34cdc1-ac78-41f2-9587-269f50b30af4
2026-05-13 06:29:36 -07:00
Fusion
8a9f84b433 test(FN-4259): add exhaustion recovery regressions
Fusion-Task-Id: FN-4259
Fusion-Task-Lineage: 7a7ca17b-93ce-4319-8461-7d1462a2c0e1
2026-05-13 06:29:36 -07:00
Fusion
1bbf57b8e1 feat(FN-4259): complete Step 3 — stop exhausted-task churn
Fusion-Task-Id: FN-4259
Fusion-Task-Lineage: 7a7ca17b-93ce-4319-8461-7d1462a2c0e1
2026-05-13 06:29:36 -07:00