Commit Graph

27 Commits

Author SHA1 Message Date
gsxdsm
3ccb132dcc feat(FN-5519): merge fusion/fn-5519 2026-05-22 22:43:26 -07:00
Fusion (runfusion.ai)
1bffa22ca9 feat(FN-5479): fix identity-guard merger bypass on detached HEAD and gate l
The merge delivers the FN-5483 identity-guard bypass for merger-driven commits on detached HEAD, plus Steps 2 and 6 of FN-5479 which gate the limbo counter by enqueue acceptance and document the associated invariant. It also restores the dashboard's PWA and theme-boot contract in index.html. New reg

Fusion-Task-Id: FN-5479
2026-05-22 08:31:12 -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
gsxdsm
cf0101be7c fix(FN-5256): keep live task worktrees through pause/resume races
Three independent reliability fixes that all surfaced as the same bug:
live tasks losing their worktrees mid-execution and emitting
`wrong_toplevel` errors.

Fix A — executor stale-self-owned classifier:
`reconcileSelfOwnedActiveSessionForRemoval` now takes a process-active
probe (`executingTaskLock.has`) and a minimum-idle window (default 5s)
in addition to the existing in-memory `activeWorktrees` binding probe.
Recently-registered or still-running entries are refused with
`process-active-refuses` / `too-recent-refuses`, with audit-grade
log lines. Both the pre-remove path
(`reconcileSelfOwnedBeforeRemove`), the post-throw retry in
`removeOwnWorktreeWithReconcile`, and the defensive reconcile in
`removeWorktree` route through the same hardened gates.

Fix B — pause synchronously reaps the agent session:
New `awaitAbortInFlightTaskWork` mirrors the existing fire-and-forget
abort but awaits each `session.abort()` /
`stepExecutor.terminateAllSessions()` /
`workflowSession.abort()`. `parkTaskAfterWorkflowStepPause` calls it
before `moveTask("todo")`, and the `task:updated` user-pause handler
routes through it, so a fast re-dispatch can no longer race a still-
live shell.

Fix C — self-healing realpath + active-task skip:
`reconcileTaskWorktreeMetadata` now realpath-normalizes both sides of
the registry comparison (handling macOS `/private/var/...`) and
refuses to clear `worktree`/`branch` on in-progress or in-review
tasks. The skip emits a new
`task:auto-recover-worktree-metadata-skipped-active` audit event;
executor-level recovery paths remain in charge of active tasks.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 09:06:23 -07:00
Fusion (runfusion.ai)
f798378693 feat(FN-5346): add post-completion defensive backstop and shared reconcile
The merge adds a post-completion defensive backstop that probes and removes stale same-task `activeSessionRegistry` entries on `done`/`archived` transitions, completing FN-5346 with a shared reconcile helper, a defensive ownership probe wired into paused cleanup, audit event alignment, and regressio

Fusion-Task-Id: FN-5346
2026-05-20 21:53:02 -07:00
gsxdsm
6fc0f5cebc feat(FN-5063): merge fusion/fn-5063 2026-05-18 15:51:01 -07:00
Fusion (runfusion.ai)
4b16429618 fix(FN-4948): harden guard install failure cleanup paths
Fusion-Task-Id: FN-4948
Fusion-Task-Lineage: dc622643-4c3e-4217-9219-a6a6e5424427
2026-05-17 17:29:28 -07:00
Fusion (runfusion.ai)
487dfcc10c feat(FN-4948): complete Step 2 — wire identity guard into worktree provisioning
Fusion-Task-Id: FN-4948
Fusion-Task-Lineage: dc622643-4c3e-4217-9219-a6a6e5424427
2026-05-17 17:29:28 -07:00
Fusion (runfusion.ai)
753068482e feat(FN-4830): complete Step 2 — backend stale-lock recovery
Fusion-Task-Id: FN-4830
Fusion-Task-Lineage: d9b8ad72-669f-488e-8e85-be2dce9b8341
2026-05-16 20:54:33 -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 (runfusion.ai)
f02482f8f3 feat(FN-4717): complete Step 2 — add backend resolver precedence
Fusion-Task-Id: FN-4717
Fusion-Task-Lineage: a2533cd8-52c4-43a0-9daf-e0a49745306b
2026-05-16 01:58:16 -07:00
Fusion (runfusion.ai)
e21e72884b feat(FN-4717): complete Step 1 — add lazy worktrunk binary resolver
Fusion-Task-Id: FN-4717
Fusion-Task-Lineage: a2533cd8-52c4-43a0-9daf-e0a49745306b
2026-05-16 01:58:16 -07:00
Fusion (runfusion.ai)
6e74f6366c fix(FN-4698): harden worktrunk path resolution and coverage
Fusion-Task-Id: FN-4698
Fusion-Task-Lineage: 267131ce-b02a-4e54-8d71-c949e3b55e56
2026-05-16 01:41:40 -07:00
Fusion (runfusion.ai)
156392410a feat(FN-4678): add removeWorktree helper to worktree-backend
Adds a `removeWorktree` helper to the worktree backend with corresponding unit tests, and wires it into the worktree pool.

Fusion-Task-Id: FN-4678
2026-05-15 22:49:36 -07:00
Fusion (runfusion.ai)
3d9260e0a8 feat(FN-4623): complete Step 6/7 — verification fixes, docs, and changeset
Fusion-Task-Id: FN-4623
Fusion-Task-Lineage: 58122853-cab7-4102-9649-4ceda4c5959e
2026-05-15 19:37:48 -07:00
Fusion (runfusion.ai)
a2245e1959 test(FN-4623): cover backend layout resolution paths
Fusion-Task-Id: FN-4623
Fusion-Task-Lineage: 58122853-cab7-4102-9649-4ceda4c5959e
2026-05-15 19:37:48 -07:00
Fusion (runfusion.ai)
c98a4e2f82 fix(FN-4623): align worktrunk sync target and prune fallback
Fusion-Task-Id: FN-4623
Fusion-Task-Lineage: 58122853-cab7-4102-9649-4ceda4c5959e
2026-05-15 19:37:48 -07:00
Fusion (runfusion.ai)
67b8051b91 feat(FN-4623): complete Step 2 — implement worktrunk lifecycle operations
Fusion-Task-Id: FN-4623
Fusion-Task-Lineage: 58122853-cab7-4102-9649-4ceda4c5959e
2026-05-15 19:37:48 -07:00
Fusion (runfusion.ai)
bcf140a92a fix(FN-4623): align worktrunk create/remove argv semantics
Fusion-Task-Id: FN-4623
Fusion-Task-Lineage: 58122853-cab7-4102-9649-4ceda4c5959e
2026-05-15 19:37:47 -07:00
Fusion (runfusion.ai)
35279a2517 feat(FN-4623): complete Step 1 — add worktrunk CLI helper and mappings
Fusion-Task-Id: FN-4623
Fusion-Task-Lineage: 58122853-cab7-4102-9649-4ceda4c5959e
2026-05-15 19:37:47 -07:00
Fusion (runfusion.ai)
58cc260444 feat(FN-4622): complete Step 2 — implement worktrunk backend
Fusion-Task-Id: FN-4622
Fusion-Task-Lineage: 10ab809f-32ef-4a1e-921e-4f8ae4161323
2026-05-15 18:54:48 -07:00
Fusion (runfusion.ai)
f3c557b216 feat(FN-4622): complete Step 1 — native backend sync contract
Fusion-Task-Id: FN-4622
Fusion-Task-Lineage: 10ab809f-32ef-4a1e-921e-4f8ae4161323
2026-05-15 18:54:48 -07:00
Fusion (runfusion.ai)
e2d7dcbf27 feat(FN-4687): complete Step 2 — scaffold worktrunk backend
Fusion-Task-Id: FN-4687
Fusion-Task-Lineage: d646a4dc-e28e-4b1f-ac07-c4ab79e893d5
2026-05-15 18:23:50 -07:00
Fusion (runfusion.ai)
c0f9ddedc0 feat(FN-4686): complete Step 7 — docs and changeset delivery
Fusion-Task-Id: FN-4686
Fusion-Task-Lineage: a1e58bd8-fd94-471a-b164-c396c5512fea
2026-05-15 17:52:55 -07:00
Fusion (runfusion.ai)
3391477716 feat(FN-4686): complete Step 2 — add worktrunk create scaffold
Fusion-Task-Id: FN-4686
Fusion-Task-Lineage: a1e58bd8-fd94-471a-b164-c396c5512fea
2026-05-15 17:52:54 -07:00
Fusion (runfusion.ai)
00a44e82af feat(FN-4685): complete Step 1 — define native backend
Fusion-Task-Id: FN-4685
Fusion-Task-Lineage: 406ac389-c360-4e4d-b9ac-f5349a241907
2026-05-15 17:07:45 -07:00
Fusion (runfusion.ai)
c1abebc98d feat(FN-4684): complete Step 2 — add worktree backend primitives
Fusion-Task-Id: FN-4684
Fusion-Task-Lineage: 142e512b-8189-4029-9df4-4bd40b69ed2a
2026-05-15 16:44:49 -07:00