Commit Graph

2112 Commits

Author SHA1 Message Date
Fusion (runfusion.ai)
6fb4b9ee47 feat(FN-5362): add heartbeat executor sparse-cache reports-health diagnosti
The merge fixes a stale cache-miss path in the heartbeat executor and adds `reports-health` diagnostics for cache-state reporting, with a regression test covering a sparse-cache false-positive scenario. It also adds a two-line tweak to the merger and updates the diagnostics documentation.

Fusion-Task-Id: FN-5362
2026-05-20 14:28:45 -07:00
gsxdsm
c824810181 fix(FN-5279): apply reuse-mode squash to local main and guard executor-lease race
In reuse-task-worktree mode the merger detaches HEAD in the task worktree so
the squash commit lands on detached HEAD; nothing previously advanced the
project root's local integration branch, so changes never appeared on main.
Step 5c now applies the squash to projectRootDir via git merge --ff-only,
falling back to a regular merge with AI conflict resolution if main has
diverged. pushAfterMerge (when enabled) now runs from projectRootDir where
the branch was just advanced, so parsePushRemoteTarget can resolve a branch
instead of failing on the worktree's detached HEAD.

Also tightens acquireReuseHandoff: the executor-lease check above the
queue-lease acquisition was non-atomic, letting a local executor grab the
task between checks. Re-check after acquisition and release the queue
lease with a precise diagnostic instead of proceeding into a generic
failure later.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 14:28:19 -07:00
gsxdsm
d6196a8665 fix(FN-5363): implement targetTaskId in store SQL so lease targets correct task
The previous commit wired targetTaskId through the engine caller but the
store's acquireMergeQueueLease SQL still grabbed the queue head unconditionally,
leaving the no-lease loop intact. This lands the store-side change: when
targetTaskId is provided it attempts a direct-match UPDATE first; only falls
back to queue-head ordering if that row isn't available (backward-compatible).

Adds regression test covering the polluted-queue-head scenario (FN-5363).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 12:05:41 -07:00
gsxdsm
b8918b83b0 fix(FN-5363): target mergeQueue lease to specific task ID instead of queue head
The merge handoff path in acquireReuseHandoff called acquireMergeQueueLease
without a targetTaskId, which grabbed the priority/FIFO-sorted queue head
instead of the specific in-review task. When the queue head was a different
task (e.g. a polluted non-review entry), the returned lease had a mismatched
taskId and triggered 'no-lease' for every in-review task.

Fix:
- Pass targetTaskId: input.task.id to acquireMergeQueueLease so the merge
  lane targets its specific task instead of grabbing the queue head.
  MergeQueueAcquireOptions.targetTaskId is already wired in store.ts.
- Replace the broken typeof check (typeof object !== 'object' is always false
  for plain JSON objects returned by RETURNING *) with a proper 'taskId' in
  lease guard.
- Add acquiredTaskId to the no-lease error payload for better observability.

Reliability backstop: merge-reuse-task-worktree.test.ts guards this path.

Fixes: FN-5363
2026-05-20 12:02:05 -07:00
gsxdsm
480db25de0 fix(FN-5353): remove stale merge:reuse-fallback-cwd-main type entries
The behavioral cwd-main fallback is gone (fresh-acquire on refusal
replaces it), but the type string was left as a dead entry in the
emitReuseHandoffAuditEvent union (merger.ts) and the
DatabaseMutationType union (run-audit.ts). Remove both so the dead
string cannot be accidentally reintroduced.
2026-05-20 10:58:29 -07:00
gsxdsm
1b7f492227 feat(FN-5353): wire fresh-worktree-acquire to ActivityLogModal 2026-05-20 10:58:29 -07:00
gsxdsm
7df11bc2cf fix(FN-5353): reacquire fresh worktree when reuse handoff fails instead of falling back to main
Before: when reuse-task-worktree was configured but task worktree was missing/unusable,
merger fell back to cwd-main, losing the task worktree isolation benefit.

After: merger creates a fresh worktree for the task branch inline (using the standard
git worktree add pattern with identity guard installation) and retries the reuse handoff.
Only falls back to cwd-main if fresh acquisition also fails.

Three new audit events track the recovery path:
- merge:reuse-worktree-fresh-acquire — fresh acquisition started
- merge:reuse-worktree-fresh-acquired — fresh worktree created and bound to task
- merge:reuse-fallback-cwd-main — only when fresh acquisition itself fails (last resort)

Behavior:
- Missing/unusable task worktree → fresh worktree created, merge continues from it
- Fresh acquisition fails → cwd-main fallback (last resort, fully audited)
- Genuine liveness conflict (usable worktree but lease refused) → re-thrown, not masked

Regression test covers the missing-worktree case: verifies fresh acquisition + handoff
succeeds without any cwd-main fallback event.
2026-05-20 10:58:29 -07:00
gsxdsm
6d66559eb3 fix(FN-5353): reacquire fresh worktree on reuse-handoff refusal
After merge:reuse-handoff-refused with no usable task worktree:
- Acquire a fresh worktree and restore the fusion/<task-id> branch
  from baseCommitSha before continuing merge
- Hard-fail only if fresh acquisition itself fails (not cwd-main fallback)
- Emit merge:reuse-worktree-fresh-acquire / merge:reuse-worktree-fresh-acquired
  audit events around the acquisition lifecycle

Replaces the incorrect cwd-main fallback (499784581) with correct
reacquire path. Updates regression test in merge-reuse-task-worktree.test.ts
to assert fresh-acquire audit trail instead of cwd-main fallback.

Refs: FN-5353
2026-05-20 10:47:35 -07:00
gsxdsm
a03a5de235 fix(FN-5353): re-acquire fresh task worktree instead of cwd-main fallback
When mergeIntegrationWorktree=reuse-task-worktree but the task has no
worktree or the worktree classifies as unusable, the merger now:
1. Creates a fresh worktree at the standard path with the fusion/<id> branch
2. Installs identity-guard hooks
3. Updates task.worktree + task.branch in the store
4. Emits merge:reuse-worktree-fresh-acquire / merge:reuse-worktree-fresh-acquired
5. Retries the handoff from the new worktree

Only falls back to cwd-main as last resort when fresh acquisition also
fails. Lease/liveness conflicts (worktree exists and classifies OK but
handoff refused on active-session or lease grounds) are re-thrown — not
masked with cwd-main.

New audit event types: merge:reuse-worktree-fresh-acquire,
merge:reuse-worktree-fresh-acquired
2026-05-20 10:46:33 -07:00
gsxdsm
4997845812 fix(FN-5353): fallback merge reuse handoff to cwd-main 2026-05-20 10:32:59 -07:00
Fusion (runfusion.ai)
c9ff2078b5 feat(FN-5314): add broad-scope advisory chip to TaskCard and banner to Task
Adds broad-scope advisory chips to TaskCard and banner to TaskDetailModal with comprehensive test coverage and a dashboard guide entry. TaskCard gains an inline advisory chip (with styles), TaskDetailModal gets a matching banner, and both components have dedicated test suites covering the new UI ele

Fusion-Task-Id: FN-5314

Fusion-Task-Lineage: cbc88f36-d029-4e4b-ac9c-32a77560b8b9
2026-05-20 09:42:40 -07:00
Fusion (runfusion.ai)
22d59b5f9a feat(FN-5279): add merge integration worktree feature with settings UI and
Implements the `mergeIntegrationWorktree` setting (FN-5279) that allows tasks to reuse their own worktree as the integration root instead of spawning a separate one. Steps 1–2 added the settings schema, types, and SettingsModal surface with documentation; Step 3 wired an integration-root resolver th

Fusion-Task-Id: FN-5279
2026-05-20 09:42:40 -07:00
Fusion (runfusion.ai)
c5e9dc43f1 fix(FN-5304): guard against silent no-op landed-file attribution mismatches
- Add a merger guard that verifies source fusion/FN branch attribution when rebase capture reports zero own commits
- Fail finalize with explicit no-op attribution mismatch handling instead of marking mergeConfirmed on ambiguous no-op ranges
- Type and emit dedicated audit events for mismatch and source-ref-unavailable skip diagnostics
- Expand branch attribution, merger, and reliability interaction tests to cover the full no-op guard matrix

Fusion-Task-Id: FN-5304
2026-05-20 08:23:40 -07:00
Fusion (runfusion.ai)
9011c2107e feat(FN-5320): canonicalize worktrunk binary name and manifest
Implements canonical worktrunk binary naming and manifest handling (FN-5320), adding a worktrunk installer that canonicalizes the executable name and manifest data, with documentation updates for architecture and settings, plus test alignments across routes, audit, and worktree acquisition fixtures.

Fusion-Task-Id: FN-5320
2026-05-20 07:44:57 -07:00
Fusion (runfusion.ai)
cee2c1385a feat(FN-5319): tighten scheduler queued-concurrency memo key to reduce fals
Add regression tests for queued concurrency in the scheduler and tighten the memo key used to track queued tasks, improving correctness of scheduler dispatch decisions.

Fusion-Task-Id: FN-5319
2026-05-20 06:52:11 -07:00
Fusion (runfusion.ai)
9efcf9375a feat(FN-5271): add precommit identity guard for worktree hooks
Adds pre-commit identity guard handling for branch case normalization (FN-5271), updating the worktree hooks implementation and adding a real-git integration test alongside a changeset for `@runfusion/fusion`.

Fusion-Task-Id: FN-5271
2026-05-20 06:42:05 -07:00
gsxdsm
e33f84fb0a feat(FN-5253): merge fusion/fn-5253 2026-05-20 06:32:21 -07:00
Fusion (runfusion.ai)
69c77fa3bf feat(FN-5257): restore visible action icons in SecretsView
Restores visibility of action icons in SecretsView (CSS styling and component adjustments), accompanied by updated test coverage. A test stabilization commit for the process supervisor fallback rounds out the merge.

Fusion-Task-Id: FN-5257
2026-05-20 06:27:44 -07:00
Fusion (runfusion.ai)
37d4115bb6 feat(FN-5231): detect and flag broad-scope tasks at triage to prompt scope
- docs(FN-5231): complete Step 6 — AGENTS.md + delivery summary + dashboard follow-up
- test(FN-5231): complete Step 5 — verification gates green
- test(FN-5231): complete Step 4 — reliability interaction regression for broad-scope flag
- feat(FN-5231): complete Step 3 — wire broad-scope flag into finalizeApprovedTask
- feat(FN-5231): complete Step 2 — register broad-scope audit event type
- feat(FN-5231): complete Step 1 — broad-scope heuristic helper

Fusion-Task-Id: FN-5231
2026-05-20 05:28:36 -07:00
Fusion (runfusion.ai)
1a4525e0b9 feat(FN-5219): detect and recover in-progress limbo tasks
The merge adds a new self-healing recovery path for tasks stuck in `in-progress` limbo (no pending step updates but not marked done), hardening `resetTask` and `recoverInProgressLimboTasks` with proper worker binding cleanup, audit event coverage, and integration tests validating the invariant acros

Fusion-Task-Id: FN-5219
2026-05-20 05:27:59 -07:00
Fusion (runfusion.ai)
1b49cbc94d feat(FN-5284): surface db corruption via health checks, self-healing, and d
- fix(FN-5284): add db corruption audit mutation type
- feat(FN-5284): complete Step 7 — document corruption surfacing
- feat(FN-5284): complete Step 6 — add db corruption banner
- feat(FN-5284): complete Step 5 — extend health payload
- feat(FN-5284): complete Step 3 — surface db corruption in self-healing
- feat(FN-5284): complete Step 2 — add db corruption notification event
- feat(FN-5284): complete Step 1 — expose integrity check errors

Fusion-Task-Id: FN-5284
2026-05-20 04:13:43 -07:00
gsxdsm
c89d68dd2d feat(FN-5203): merge fusion/fn-5203 2026-05-20 02:48:39 -07:00
gsxdsm
b1c0a91752 feat(FN-5195): merge fusion/fn-5195 2026-05-20 02:47:34 -07:00
Fusion (runfusion.ai)
c9fd41ef26 feat(FN-5175): thread soft-delete audit context and add reconciliation scri
Adds a reconcile script to recover leaked soft-deleted tasks, threads delete audit context through all callers, and records soft-delete audit events with archive column tracking across core/engine/cli/dashboard, with reliability backstop tests covering caller alignment.

Fusion-Task-Id: FN-5175
2026-05-20 02:46:49 -07:00
Fusion (runfusion.ai)
ab0a253004 feat(FN-5264): abort in-flight executor/merge/triage work on soft-delete (F
Implements in-flight abort for soft-deleted tasks across all three execution lanes: executor, merger, and triage now check for `deletedAt` before proceeding and emit `task:soft-delete-in-flight-abort` audits rather than continuing work on a deleted task. The 829-line addition is dominated by integra

Fusion-Task-Id: FN-5264

Fusion-Task-Lineage: 4ee8e63b-abf0-43e2-9130-39a05434d8f9
2026-05-20 01:16:06 -07:00
Fusion (runfusion.ai)
93b11c6c0c feat(FN-5241): add atomic in-review handoff seam with executor/self-healing
The merge introduces an atomic review handoff seam in the core store (`packages/core/src/store.ts`) and migrates executor and self-healing transitions to use it, replacing the previous multi-step mutable-state handoff with a single transactional operation. Extensive reliability backstops and regress

Fusion-Task-Id: FN-5241
2026-05-20 01:01:08 -07:00
gsxdsm
e908cbcb42 fix(FN-5291): downgrade file-scope invariant failures 2026-05-19 23:00:11 -07:00
gsxdsm
98033bc869 feat(engine): guard one engine per project per machine
Adds a per-machine singleton lock that engages in
ProjectEngineManager.createAndStart() before any engine subsystems
spin up. Two fn dashboard processes can no longer run engines for the
same project on the same host — previously they would share .fusion/
state and corrupt worktrees / task rows for in-process projects.

The guard combines two independent checks:
  - A proper-lockfile file at <project>/.fusion/engine.lock with
    stale-lock recovery (auto-released on process death).
  - A loopback listener on a hashed per-project address — UDS on
    POSIX, named pipe on Windows. Stale UDS files are probed and
    unlinked before a retry bind.

Failures raise EngineAlreadyRunningError. Both guards are released
from stopAll() and pauseProject(); a release on engine.start()
failure lets retries re-acquire cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 22:50:39 -07:00
gsxdsm
959f7cd4eb chore(release): v0.32.0
Version bump via changesets.
2026-05-19 22:09:26 -07:00
Fusion (runfusion.ai)
17eb85ed81 feat(FN-5266): add metadata-driven pre-commit identity guard
Implements metadata-driven pre-commit identity guard hooks in the worktree layer, replacing static hook bodies with configurable metadata; adds regression tests covering shared-hook worktrees and the metadata-driven lock behavior.

Fusion-Task-Id: FN-5266
2026-05-19 21:08:21 -07:00
Fusion (runfusion.ai)
b078a8135e feat(FN-5232): add deterministic verification-followup deduplication to pre
Implements deterministic followup deduplication for the project engine, routing eval and PR followups through a new `verification-followup-dedup` helper that excludes the parent task to prevent self-referential loops, with tests covering eval-followups, merge-error-recovery, PR comments, and the new

Fusion-Task-Id: FN-5232
2026-05-19 19:28:05 -07:00
gsxdsm
87da1cb757 test(dashboard): align github-tracking-documentation phrases with current docs
The doc was rewritten to cover "every task-creation path" (with an
explicit enumeration of surfaces) instead of the older "task creation
flows (including ...)" wording, and uses "best-effort and non-blocking"
instead of "Creation is best-effort and non-blocking". Update the
documentation contract test to match the current phrasing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fusion-Task-Id: FN-5208
2026-05-19 19:23:47 -07:00
Fusion (runfusion.ai)
7fe6cd362a fix(FN-5188): complete Step 5 — restore green verification
Fusion-Task-Id: FN-5188
Fusion-Task-Lineage: 6d238ff1-2d69-44e7-8694-ec19e412f8ef
2026-05-19 17:27:21 -07:00
Fusion (runfusion.ai)
9c59f1da0d test(FN-5188): add orphan-rescue fresh-db reliability backstop
Fusion-Task-Id: FN-5188
Fusion-Task-Lineage: 6d238ff1-2d69-44e7-8694-ec19e412f8ef
2026-05-19 17:27:20 -07:00
Fusion (runfusion.ai)
4b2a77b631 feat(FN-5188): complete Step 3 — gate fresh-db orphan rescue
Fusion-Task-Id: FN-5188
Fusion-Task-Lineage: 6d238ff1-2d69-44e7-8694-ec19e412f8ef
2026-05-19 17:27:20 -07:00
Fusion (runfusion.ai)
dc8dd33f80 test(FN-5189): complete Step 4 — add supervision regression test
Fusion-Task-Id: FN-5189
Fusion-Task-Lineage: 4caa3f0a-af81-4c60-88e8-de229ed72e08
2026-05-19 17:19:03 -07:00
Fusion (runfusion.ai)
818db4a714 feat(FN-5189): complete Step 3 — migrate supervised spawns
Fusion-Task-Id: FN-5189
Fusion-Task-Lineage: 4caa3f0a-af81-4c60-88e8-de229ed72e08
2026-05-19 17:19:02 -07:00
Fusion (runfusion.ai)
23dae4b495 test(FN-5168): complete Step 6 — verification gates green
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:25 -07:00
Fusion (runfusion.ai)
7ac8a73f1b test(FN-5168): complete Step 5 — reliability interaction regression
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:25 -07:00
Fusion (runfusion.ai)
368c4c37fe feat(FN-5168): complete Step 3 — no-progress churn terminalization
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:25 -07:00
Fusion (runfusion.ai)
af830a74cc fix(FN-5168): preserve tracking through loop recovery
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:24 -07:00
Fusion (runfusion.ai)
af16608810 feat(FN-5168): complete Step 2 — executor feeds ignored step-update churn
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:24 -07:00
Fusion (runfusion.ai)
913167c736 feat(FN-5168): complete Step 1 — detector signal for ignored step-update churn
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:24 -07:00
Fusion (runfusion.ai)
b39c2dd071 feat(FN-5153): deliver soft-delete verification gate
Completes FN-5153 by delivering the soft-delete verification gate with a new end-to-end test suite covering the full soft-delete lifecycle and a documentation matrix summarizing the gate behavior. Updates the dashboard test file and adds a brief entry to AGENTS.md to surface the new feature.

Fusion-Task-Id: FN-5153
2026-05-19 15:52:09 -07:00
gsxdsm
b7e57f84a9 chore: minor cleanups — docs index, test-project fixture, empty catches, triage timestamp guard
- Add diagnostics.md and FN-4886/FN-5048 entries to docs/README.md index
- Fix test-project.test.ts spy target (updateSettings → init) to match fixture flow
- Remove unused DEFAULT_PROJECT_SETTINGS import and skip empty settings patch
- Add explanatory comments to empty catch blocks in secrets-env-writer
- Refine near-duplicate timestamp guard in triage for cleaner NaN handling
2026-05-19 14:22:11 -07:00
Fusion (runfusion.ai)
41d18b3f6d fix(FN-5150): unblock workspace gates with near-duplicate timestamp guard
Fusion-Task-Id: FN-5150
Fusion-Task-Lineage: 09bf24f1-5d23-4049-bd5e-7afbea0a59ae
2026-05-19 12:13:46 -07:00
Fusion (runfusion.ai)
4d9068d927 test(FN-5152): cover same-millisecond near-duplicate finalize race
Fusion-Task-Id: FN-5152
Fusion-Task-Lineage: 954570d8-82e1-4519-a739-c52ee790d2db
2026-05-19 11:30:55 -07:00
Fusion (runfusion.ai)
80ffed7a47 fix(FN-5152): clarify newer-task near-duplicate archive rule
Fusion-Task-Id: FN-5152
Fusion-Task-Lineage: 954570d8-82e1-4519-a739-c52ee790d2db
2026-05-19 11:30:55 -07:00
Fusion (runfusion.ai)
2c6662f13b fix(FN-5152): complete Step 7 — clear verification lint issue
Fusion-Task-Id: FN-5152
Fusion-Task-Lineage: 954570d8-82e1-4519-a739-c52ee790d2db
2026-05-19 11:30:55 -07:00
Fusion (runfusion.ai)
8364be83d6 test(FN-5152): complete Step 6 — add near-duplicate reliability interaction tests
Fusion-Task-Id: FN-5152
Fusion-Task-Lineage: 954570d8-82e1-4519-a739-c52ee790d2db
2026-05-19 11:30:55 -07:00