Commit Graph

1502 Commits

Author SHA1 Message Date
Fusion (runfusion.ai)
b2ca02f743 feat(FN-4813): complete docs, settings, and verification updates
Fusion-Task-Id: FN-4813
Fusion-Task-Lineage: 846893a5-2afa-4817-8f64-8c444d2fd713
2026-05-16 17:31:10 -07:00
Fusion
86237c9a50 fix(FN-4811): unblock @fusion/engine typecheck so verification bootstrap can run
Symptom found while investigating 'tasks are still struggling': every
in-review task hitting pre-merge deterministic verification failed with

  [verification:bootstrap] bootstrap preamble failed (exit 2):
  [test-bootstrap] FAILED: workspace dist artifact rebuild did not complete.
  [test-bootstrap] command: pnpm --filter @fusion/engine build

Because pnpm --filter @fusion/engine build hit 17 TS errors from a prior
autonomous-agent refactor introducing a RemovalReason enum-like object
and two new audit event types. The bootstrap preamble is run by the
merger before every direct-merge verification, so a broken engine
typecheck blocked EVERY task from merging.

Fixes:

1. Duplicate RemovalReason re-export in worktree-pool.ts

   Both  and
    were present for the same identifier,
   producing TS2300 'Duplicate identifier'. RemovalReason is a const
   object with derived type (typeof-keyof pattern), so a single value
   export covers both kinds; the type-only re-export was redundant.

2. GitMutationType union missing the FN-4811 audit event types

   merger.ts and worktree-backend.ts were emitting
   'worktree:removal-refused-active-session' and
   'worktree:removal-forced-over-active-session' audit events, but the
   union in run-audit.ts didn't include them. Added both.

3. self-healing.test.ts vi.mock had wrong RemovalReason keys

   The mock only exposed 5 keys (SelfHealing*) but production code
   references HardCancel, Executor*, Merger*, PoolPrune, etc. Calls
   like removeWorktree({ reason: RemovalReason.MergerPostMerge }) were
   getting reason=undefined, producing confusing 'cannot remove
   worktree: [vitest] No RemovalReason export is defined on mock'
   error messages. Updated the mock to mirror the production const
   exactly.

4. worktree-backend.test.ts removeWorktree calls missing required reason

   The new contract makes reason: RemovalReason a required field on
   removeWorktree's input. Five existing test cases were missing it;
   added reason: RemovalReason.MergerCleanup to each.

5. integrity-warning-persisted-dedup.test.ts Settings cast

   The test's makeStore helper cast a partial settings object to
   Settings; TS rejected the narrowed type. Cast through unknown.

Verification:

  - pnpm --filter @fusion/engine build: clean
  - pnpm lint: clean
  - pnpm build (full workspace): clean
  - pnpm --filter @fusion/engine test: 5045 pass, 1 pre-existing
    aiMergeTask real-git timeout flake, 1 skipped

With this fix, the verification bootstrap can complete and the merger
can finalize tasks again.

Fusion-Task-Id: FN-4811
2026-05-16 17:23:15 -07:00
Fusion
f4aa6d7b8b fix(FN-4811): persist done-task integrity warnings across engine restarts
The periodic self-healing sweep at
SelfHealingManager.reconcileDoneTaskIntegrity() emits a single
'Integrity warning: done-task finalize evidence is unproven (<reason>)' log
entry per task when the task is in 'done' but has no provable on-main
evidence. Dedup was via an in-memory finalizeUnprovenWarned Set per manager
instance, so every engine restart resurfaced the same warning on the next
sweep — significant noise on done tasks that legitimately lack evidence,
typically residue of FN-4811 contamination (FN-4771/FN-4778 in production).

Adds an optional MergeDetails.integrityWarning = { warnedAt, reason } field
and persists it on the first warning. Both warning sites in
reconcileDoneTaskIntegrity() (the unproven-and-still-mergeable branch and
the unproven-final branch) now consult the persisted record:

  - Same reason as persisted → skip re-emitting, just rehydrate the in-memory
    Set for in-process consistency.
  - Different reason → re-warn (so a *new* classification problem still
    surfaces) and update the persisted record.

Tests added under
packages/engine/src/__tests__/reliability-interactions/integrity-warning-persisted-dedup.test.ts
(real-git, 4 cases):

  - First sweep: emits warning + persists record.
  - Second sweep, same instance: in-memory Set dedupes (existing contract).
  - Fresh manager (simulated engine restart) + pre-persisted record:
    persisted dedup suppresses re-emission.
  - Fresh manager + persisted record with different reason: must re-warn
    and overwrite the persisted reason.

Full engine suite: 308 files, 5041 tests pass, 1 skipped. Lint clean.

Fusion-Task-Id: FN-4811
2026-05-16 16:51:43 -07:00
Fusion (runfusion.ai)
42b8eebc8e feat(FN-4809): complete Step 3 — add changeset for merge attempt audit coverage
Fusion-Task-Id: FN-4809
Fusion-Task-Lineage: bd632e33-b376-47de-ad99-da4610ae4690
2026-05-16 16:50:16 -07:00
Fusion
dcd6bf60f3 fix(FN-4811): recover from validation-failed remove + collapse broken FN-4806 nested branches
Two follow-ups stacked on the FN-4811 active-worktree liveness gate:

1. Stale conflict-path recovery (FN-4813 production failure)

   When 'git worktree remove --force' fails with 'fatal: validation failed,
   cannot remove working tree', the worktree directory is missing on disk
   and the git admin entry is stale. Without this recovery, every retry of
   tryCreateWorktree on a stale conflict path failed 3 times with
   'automatic cleanup failed', leaving tasks unable to create worktrees.

   cleanupConflictingWorktree now catches that specific error class, runs
   'git worktree prune' to drop the stale admin entry, best-effort deletes
   the branch, and returns success so the caller can proceed.

   Implementation note: the original attempt used existsSync(worktreePath)
   as a pre-check, but vitest's vi.clearAllMocks() can leave the existsSync
   mock returning undefined, causing the new branch to fire inside tests
   that didn't expect it and leading to worker OOM in
   executor-worktree.test.ts. The error-class-based catch is robust against
   mock state and matches the real production failure signal exactly.

2. Collapsed broken FN-4806 nested branches

   The previous FN-4806 refactor (commit 087b1a766) accidentally nested the
   genuine 'agent finished without calling fn_task_done after N retries'
   failure path INSIDE the silent-recovery branch, meaning ordinary
   failures were being silently requeued (no status=failed, no onError, no
   retry-budget burn) instead of being surfaced.

   Restored the clean two-branch structure:

     } else if (retryAbortedDueToReclaim) {
       // silent recovery (FN-4806)
     } else {
       // genuine no-fn_task_done exhaustion: mark failed, onError, burn budget
     }

   Also clears baseCommitSha on silent recovery (matches the parallel
   session-start-failure path's metadata clearing).

Tests:

  - Adds 'FN-4811 follow-up (FN-4813): recovers from validation failed'
    case to active-worktree-removal-liveness.test.ts (12 total cases).
  - executor-recovery.test.ts no-fn_task_done reclaim coverage now
    asserts baseCommitSha is cleared.
  - executor-recovery.test.ts 'does not mark task as failed when invalid
    transition error occurs on completion' regression fixed by restoring
    the failure-path branch.
  - executor-core.test.ts 'still enforces fn_task_done requirement in
    fast mode' restored.

Full engine suite: 307 files, 5037 tests pass, 1 skipped. Lint clean.

Fusion-Task-Id: FN-4811
2026-05-16 16:25:28 -07:00
Fusion (runfusion.ai)
7310642b68 test(FN-4806): add reclaim retry coverage and changeset
Fusion-Task-Id: FN-4806
Fusion-Task-Lineage: 4192226a-b24c-4681-b0fa-ce86f40fce64
2026-05-16 16:01:23 -07:00
Fusion
4c26aa6e91 fix(FN-4811): refuse to force-remove worktrees actively bound to live sessions
The executor's conflict-recovery paths (cleanupConflictingWorktree,
handleBranchConflict, and tryCreateWorktree's live-foreign/stale-resolved
branches) could force-remove a worktree even when it was currently bound
to an active executor session. This caused the FN-4781/FN-4804 cascade:

  - 'Execution blocked: assigned worktree path disappeared mid-task' as
    git deleted the live agent's filesystem out from under it
  - Two parallel runs for the same task alive simultaneously, with the
    second run started in a fresh worktree while the first was still
    holding the old session
  - Cross-task log attribution (an FN-4804 runContext writing to FN-4781)
  - Post-merge 'branch tip misbound but content found on main via trailer'
    rescues firing on every successful merge as the bookkeeping was
    corrupted mid-merge

Adds a hard liveness gate centralized in findActiveWorktreeOwner(), which
checks both the in-memory activeWorktrees map and the DB for non-done,
non-paused, in-progress tasks bound to the worktree. The gate fires at
two points:

  1. cleanupConflictingWorktree returns false (refuses removal) when an
     active owner is found, logging an FN-4811 refusal entry.
  2. handleBranchConflict short-circuits to 'sticky' BEFORE invoking
     inspectBranchConflict, because some inspection branches force-remove
     unconditionally.

When cleanup is refused, the live-foreign and stale-resolved branches in
tryCreateWorktree now FALL THROUGH to the suffix-rename path (rather
than returning null) so the requesting task can still proceed without
disturbing the live owner.

Tests:

  - New reliability-interactions backstop at
    src/__tests__/reliability-interactions/active-worktree-removal-liveness.test.ts
    covers findActiveWorktreeOwner (5 cases: in-memory match, requesting
    task excluded, DB-level match, paused exclusion, terminal-column
    exclusion, self-exclusion), cleanupConflictingWorktree gate (3 cases:
    in-memory refuse, DB refuse, no-owner proceed), and handleBranchConflict
    gate (2 cases: short-circuit + inspection-skipped, no-owner proceeds).
  - Updates existing executor-worktree.test.ts assertion that was
    documenting the bug behavior (force-removing active worktree) to match
    the new contract (refuses + falls through to suffix-rename).

Full engine suite: 307 files, 5035 tests pass.

Fusion-Task-Id: FN-4811
2026-05-16 15:36:07 -07:00
Fusion
3f8a5e6839 fix(FN-4806): silently recover when worktree/branch reclaimed mid-retry
The executor's no-fn_task_done retry loop has two reclaim signals
(retryAbortedDueToReclaim=true): (1) pre-retry liveness recheck where the
task DB shows worktree/branch was cleared, and (2) session-start failure
because the worktree path no longer exists. Both are engine self-heal
situations triggered by FN-4546 stale-active-branch reclaim, FN-4742
self-healing removals, or related housekeeping paths — the agent never
got a fair retry attempt.

Previously these surfaced as task status=failed with error
'Worktree/branch reclaimed during no-fn_task_done retry — requeueing',
fired onError, and burned the taskDoneRetryCount budget. Three legitimate
problems followed: tasks accumulated spurious failures in the UI, the
exhausted-budget branch escalated reclaimed tasks to in-review instead of
retrying, and the noise masked the underlying worktree-removal regression
(FN-4811).

Now the reclaim branch silently:
- clears stale worktree/branch metadata so the next pickup creates a fresh worktree
- requeues to todo with preserveProgress
- logs an informational 'engine self-heal, no failure' line
- does NOT set status=failed, does NOT bump taskDoneRetryCount, does NOT call onError

The genuine 'agent finished without calling fn_task_done after N retries'
exhaustion path (retryAbortedDueToReclaim=false) is unchanged.

Tests updated in
packages/engine/src/__tests__/reliability-interactions/executor-no-task-done-vs-worktree-reclaim.test.ts
to assert the new silent-recovery contract on all three reclaim paths.

Fusion-Task-Id: FN-4806
2026-05-16 15:16:05 -07:00
Fusion (runfusion.ai)
246609a415 feat(FN-4803): complete Steps 4-5 — docs update and changeset
Fusion-Task-Id: FN-4803
Fusion-Task-Lineage: cbfa10fd-33a6-469c-9cb4-3a647bc47b84
2026-05-16 14:56:56 -07:00
Fusion (runfusion.ai)
fea0b51915 feat(FN-4783): complete Step 8 — documentation and changeset
Fusion-Task-Id: FN-4783
Fusion-Task-Lineage: 7a02897b-e303-4947-86b2-3dd7a343f653
2026-05-16 13:46:43 -07:00
Fusion (runfusion.ai)
fc86c4f429 feat(FN-4784): complete Step 4 — add changeset
Fusion-Task-Id: FN-4784
Fusion-Task-Lineage: e11a4758-93ab-451e-8721-ae8995aaa70d
2026-05-16 13:35:31 -07:00
Fusion (runfusion.ai)
424c61f4f7 feat(FN-4780): complete Step 7 — add changeset
Fusion-Task-Id: FN-4780
Fusion-Task-Lineage: 7f052539-9d15-4997-8135-21434f065d4a
2026-05-16 13:24:56 -07:00
Fusion (runfusion.ai)
a2710fb70f test(FN-4802): stabilize desktop auto-updater setup assertions
Fusion-Task-Id: FN-4802
Fusion-Task-Lineage: a1436633-8000-4b3a-8d22-dcc28be69bcd
2026-05-16 13:15:00 -07:00
Fusion (runfusion.ai)
5a101dc70b feat(FN-4785): complete Step 6 — document and ship agents-load perf fix
Fusion-Task-Id: FN-4785
Fusion-Task-Lineage: be241ee7-9df0-433c-a00b-997bcd558862
2026-05-16 13:04:28 -07:00
Fusion (runfusion.ai)
416bd8b1f5 feat(FN-4785): complete Step 6 — add changeset for agents load perf
Fusion-Task-Id: FN-4785
Fusion-Task-Lineage: be241ee7-9df0-433c-a00b-997bcd558862
2026-05-16 13:04:28 -07:00
Fusion (runfusion.ai)
023a0cc6bd feat(FN-4777): complete Step 6 — add changeset
Fusion-Task-Id: FN-4777
Fusion-Task-Lineage: ed00f639-c928-4c14-be1f-2b43db6022c7
2026-05-16 12:56:31 -07:00
gsxdsm
c6e978286a feat(FN-4779): merge fusion/fn-4779 2026-05-16 12:49:57 -07:00
Fusion (runfusion.ai)
11012b49c9 feat(FN-4774): complete Step 5 — add changeset for triage search tool
Fusion-Task-Id: FN-4774
Fusion-Task-Lineage: f3b81550-fb23-441e-aee7-44ffec63d03d
2026-05-16 11:55:40 -07:00
Fusion (runfusion.ai)
93c3975532 feat(FN-4769): show inline spinners in planning-mode modal during creation
Adds inline loading spinners to the planning mode task-creation modal, replacing any placeholder states during the creation flow, with a new planning-flow test covering the spinner behavior.

Fusion-Task-Id: FN-4769
2026-05-16 11:55:15 -07:00
Fusion (runfusion.ai)
db7b196462 test(FN-4770): complete Steps 3-4 — add tracking async coverage
Fusion-Task-Id: FN-4770
Fusion-Task-Lineage: 8c8d1786-f81b-4544-9275-595b90ea5689
2026-05-16 11:39:37 -07:00
Fusion (runfusion.ai)
b594160e77 feat(FN-4772): complete Step 7 — docs and changeset
Fusion-Task-Id: FN-4772
Fusion-Task-Lineage: d296e96a-fe44-4896-928a-fa44da62b41a
2026-05-16 11:32:56 -07:00
Fusion (runfusion.ai)
ff71746ba1 feat(FN-4743): complete Step 6 — docs, changeset, and verification fixes
Fusion-Task-Id: FN-4743
Fusion-Task-Lineage: 50d1d8e4-66d5-4299-843b-28072a904277
2026-05-16 10:43:48 -07:00
Fusion (runfusion.ai)
7c0624c74a fix(FN-4752): add changeset for settings sync payload fix
Fusion-Task-Id: FN-4752
Fusion-Task-Lineage: 1faf04bf-c6f6-4f75-b030-86e3d940950d
2026-05-16 10:37:56 -07:00
Fusion (runfusion.ai)
befbc51237 feat(FN-4748): complete Step 6 — docs and release notes
Fusion-Task-Id: FN-4748
Fusion-Task-Lineage: b540f985-c20f-438e-8290-a07531c6612c
2026-05-16 10:31:44 -07:00
Fusion (runfusion.ai)
1e02028585 feat(FN-4750): complete Step 4 — add release changeset
Fusion-Task-Id: FN-4750
Fusion-Task-Lineage: 54b3e35f-ef34-469a-aa9f-6d7fe9e79f27
2026-05-16 10:18:40 -07:00
Fusion (runfusion.ai)
293441a3f1 feat(FN-4739): complete Step 7 — add docs and changeset
Fusion-Task-Id: FN-4739
Fusion-Task-Lineage: fc120dfa-d1b2-4065-9595-d0bc6304d2af
2026-05-16 09:56:54 -07:00
Fusion (runfusion.ai)
f761f771d1 feat(FN-4736): complete Step 4 — add changeset and docs
Fusion-Task-Id: FN-4736
Fusion-Task-Lineage: f723ded5-cc07-47f1-ae49-fc7378c8e9f1
2026-05-16 09:42:37 -07:00
Fusion (runfusion.ai)
b1209b1859 feat(FN-4740): persist github tracking enabled state in dashboard
Adds persistence for the GitHub tracking enabled state with test coverage in the dashboard hook, and includes a changeset for the `@runfusion/fusion` package.

Fusion-Task-Id: FN-4740
2026-05-16 09:36:19 -07:00
Fusion (runfusion.ai)
51c60fe1b5 feat(FN-4731): add tracking repo dropdown to settings modal
Adds a `TrackingRepoSelect` dropdown component to the SettingsModal (with co-located CSS and full test coverage), updates the settings reference docs, and includes the FN-4731 changeset for the `@runfusion/fusion` package.

Fusion-Task-Id: FN-4731
2026-05-16 09:20:33 -07:00
Fusion (runfusion.ai)
e5c9c7a3d9 feat(FN-4744): complete Step 6 — add release note for wake reason annotation
Fusion-Task-Id: FN-4744
Fusion-Task-Lineage: 5ffbea10-4da3-4f85-9cc4-679545eb2383
2026-05-16 09:05:51 -07:00
Fusion (runfusion.ai)
b772881dd3 feat(FN-4733): complete Step 6 — verify and add changeset
Fusion-Task-Id: FN-4733
Fusion-Task-Lineage: 38495ced-c7a0-40aa-be22-7f02fe958806
2026-05-16 08:50:48 -07:00
Fusion (runfusion.ai)
c6daa5e1a7 feat(FN-4730): complete docs and changeset updates
Fusion-Task-Id: FN-4730
Fusion-Task-Lineage: 10fa1d65-f898-4576-bbca-a796df13bedb
2026-05-16 08:45:07 -07:00
Fusion (runfusion.ai)
c3651da1b5 feat(FN-4732): complete Step 5 — add changeset for project switch fix
Fusion-Task-Id: FN-4732
Fusion-Task-Lineage: 3377a9a1-bb22-42a9-bada-ecd623000b42
2026-05-16 08:37:25 -07:00
Fusion (runfusion.ai)
e9403df6ba feat(FN-4727): add github tracking toggle to quick entry box
Adds a GitHub tracking toggle to the QuickEntryBox component with co-located tests, shipped as a patch to `@runfusion/fusion`.

Fusion-Task-Id: FN-4727
2026-05-16 08:33:29 -07:00
Fusion (runfusion.ai)
56f38cf174 feat(FN-4728): complete Step 5 — add changeset
Fusion-Task-Id: FN-4728
Fusion-Task-Lineage: 6e8e9040-0c2f-4290-8905-1c1be8487894
2026-05-16 08:09:07 -07:00
Fusion (runfusion.ai)
cc701b25e9 feat(FN-4726): complete Step 5 — add changeset and delivery notes
Fusion-Task-Id: FN-4726
Fusion-Task-Lineage: 9fa3bfd7-f277-4c03-8d1e-6162eb7771b2
2026-05-16 07:48:09 -07:00
Fusion (runfusion.ai)
a92f9aac2b feat(FN-4725): complete Step 3 — add changeset
Fusion-Task-Id: FN-4725
Fusion-Task-Lineage: 91058db5-9a5b-4506-89f4-8abf89b28862
2026-05-16 07:41:48 -07:00
Fusion (runfusion.ai)
dc959a7727 feat(FN-4723): complete Steps 5-7 — docs, changeset, and verification
Fusion-Task-Id: FN-4723
Fusion-Task-Lineage: b79b42a0-c65d-4e02-938f-d1ffabc272ee
2026-05-16 07:16:05 -07:00
Fusion (runfusion.ai)
6afd2737ad feat(FN-4722): complete Step 9 — add changeset and delivery notes
Fusion-Task-Id: FN-4722
Fusion-Task-Lineage: 51be7260-82f0-4ec9-a350-06778b8eb01b
2026-05-16 06:31:07 -07:00
Fusion (runfusion.ai)
b94eae4f23 feat(FN-4719): complete Step 3-4 — goals view lazy wiring and changeset
Fusion-Task-Id: FN-4719
Fusion-Task-Lineage: 53fb716e-2d3e-40c7-ad7a-e9f315f33c34
2026-05-16 05:29:27 -07:00
Fusion (runfusion.ai)
9a1c904377 feat(FN-4718): complete Step 5 — add changeset for done auto-archive days
Fusion-Task-Id: FN-4718
Fusion-Task-Lineage: 4553c39c-c174-4993-a4ac-2c8b7d86bda2
2026-05-16 04:44:36 -07:00
Fusion (runfusion.ai)
769afd4e37 feat(FN-4711): complete Step 6 — document install audit and add changeset
Fusion-Task-Id: FN-4711
Fusion-Task-Lineage: 800e3606-c30f-40c5-a707-4dbbf5a9d032
2026-05-16 02:12:58 -07:00
Fusion (runfusion.ai)
f40f2ba9b1 feat(FN-4717): complete Step 5 — add delivery notes and changeset
Fusion-Task-Id: FN-4717
Fusion-Task-Lineage: a2533cd8-52c4-43a0-9daf-e0a49745306b
2026-05-16 01:58:16 -07:00
Fusion (runfusion.ai)
e1e21f6462 feat(FN-4698): complete verification and docs updates
Fusion-Task-Id: FN-4698
Fusion-Task-Lineage: 267131ce-b02a-4e54-8d71-c949e3b55e56
2026-05-16 01:41:40 -07:00
Fusion (runfusion.ai)
5253cc138e feat(FN-4642): document and export container sandbox prototype
Fusion-Task-Id: FN-4642
Fusion-Task-Lineage: a42a36f8-2d2a-43fe-b7c1-d7cf1ad321c3
2026-05-16 01:04:47 -07:00
Fusion (runfusion.ai)
8e8c1a2574 feat(FN-4715): complete Step 4 — add defaults contract changeset
Fusion-Task-Id: FN-4715
Fusion-Task-Lineage: b1c3393f-2596-4b3f-a8fb-c9838bf6c985
2026-05-16 00:19:18 -07:00
Fusion (runfusion.ai)
414e62d39d feat(FN-4716): complete Step 2 — invert reliability headline to success rate
Fusion-Task-Id: FN-4716
Fusion-Task-Lineage: 3893e8c0-ee1f-4d32-8e18-fd747b0d955d
2026-05-16 00:13:37 -07:00
Fusion (runfusion.ai)
196b7e439f feat(FN-4633): import worktrunk integration dependency from FN-4632
Adds a changesets file for worktrunk integration (FN-4632), preparing the patch release for the feature.

Fusion-Task-Id: FN-4633
2026-05-16 00:13:02 -07:00
Fusion (runfusion.ai)
7f2412bdc3 feat(FN-4628): complete Step 6 — add docs and changeset
Fusion-Task-Id: FN-4628
Fusion-Task-Lineage: ebd36565-946b-4b4f-b8df-4d99d7a5f074
2026-05-15 23:50:12 -07:00
Fusion (runfusion.ai)
98c88c7c2c feat(FN-4702): document worktrunk install approval flow
Fusion-Task-Id: FN-4702
Fusion-Task-Lineage: 378b46bc-2e71-43bf-9ff7-85e7aed8bf85
2026-05-15 23:39:43 -07:00