Commit Graph

7145 Commits

Author SHA1 Message Date
Fusion (runfusion.ai)
1e1e6f9c13 feat(FN-4835): complete Step 7 — add changeset and delivery notes
Fusion-Task-Id: FN-4835
Fusion-Task-Lineage: 09eb6339-a476-4cf1-b7e5-e60fa6c263ce
2026-05-17 00:14:58 -07:00
Fusion (runfusion.ai)
f8457d1130 test(FN-4835): cover streamed-text precedence in chat hooks
Fusion-Task-Id: FN-4835
Fusion-Task-Lineage: 09eb6339-a476-4cf1-b7e5-e60fa6c263ce
2026-05-17 00:14:58 -07:00
Fusion (runfusion.ai)
7351852a61 feat(FN-4835): complete Step 4 — prefer streamed accumulator on done
Fusion-Task-Id: FN-4835
Fusion-Task-Lineage: 09eb6339-a476-4cf1-b7e5-e60fa6c263ce
2026-05-17 00:14:58 -07:00
Fusion (runfusion.ai)
c1cbb668ea feat(FN-4850): complete Step 4 — add changeset
Fusion-Task-Id: FN-4850
Fusion-Task-Lineage: 903d8e4e-eba7-413e-86d8-94eae7318952
2026-05-17 00:06:26 -07:00
Fusion (runfusion.ai)
c491dac28f test(FN-4850): add active worktree rename and copy diff coverage
Fusion-Task-Id: FN-4850
Fusion-Task-Lineage: 903d8e4e-eba7-413e-86d8-94eae7318952
2026-05-17 00:06:26 -07:00
Fusion (runfusion.ai)
19b9ea4464 feat(FN-4850): complete Step 1 — deterministic rename detection
Fusion-Task-Id: FN-4850
Fusion-Task-Lineage: 903d8e4e-eba7-413e-86d8-94eae7318952
2026-05-17 00:06:25 -07:00
Fusion
aa6d1c9851 fix(FN-4847): discard foreign branch and recreate on branch-conflict-unrecoverable
Production failure shape:
  Auto-recovery failed: branch conflict unrecoverable \u2014
  Branch fusion/fn-4847 is already checked out at /.../deft-crane
  (tip a881ccc86660, 24 stranded commits since 0b28388876).
  Run branch recovery and explicitly choose whether to reclaim or
  discard prior work.

The 24 stranded commits are cross-task contamination residue from the
FN-4781/FN-4804/FN-4814 worktree-race era \u2014 they are NOT FN-4847's work.
Previously this paused the task with pausedReason='branch-conflict-
unrecoverable' and the task got stuck forever waiting for human
adjudication.

User intent (FN-4847): 'just create a new branch and keep going and
discard the old one'. Implementation:

1. auto-recovery.ts:actionForMode \u2014 in 'deterministic-only' mode (the
   default), branch-conflict-unrecoverable now returns 'retry' (was
   'pause'). This routes the failure to the handler instead of pausing.

2. auto-recovery-handlers/branch-worktree.ts \u2014 'live-foreign' inspection
   no longer emits irreducible-pause. Instead:
   - Check FN-4811 active-session registry. If the foreign worktree is
     bound to a live executor/merger session, do NOT force-remove it
     (would yank the live agent's filesystem). Just requeue and let
     downstream conflict-recovery handle it.
   - Otherwise: force-delete the foreign worktree (--force) + prune git
     worktree admin entries + force-delete the branch. Errors at each
     step are best-effort and logged.
   - Emit new audit event 'branch-worktree:foreign-branch-discarded'
     with stranded-commit count, live-ownership flag, success flags.
   - Requeue task to 'todo' with preserveProgress, clearing
     branch+baseCommitSha.

3. run-audit.ts \u2014 register new DatabaseMutationType.

4. executor-worktree.test.ts \u2014 update the 'records recovery context'
   test to assert the new retry+requeue contract (was asserting the old
   pause-with-status-failed contract).

Verification:
  - Targeted suite (4 files, 343 tests): pass.
  - pnpm --filter @fusion/engine build: clean.
  - pnpm lint: clean.

Fusion-Task-Id: FN-4847
2026-05-16 23:53:56 -07:00
Fusion (runfusion.ai)
01f0bf625a fix(FN-4826): complete Step 6 — stabilize audit emission and tests
Fusion-Task-Id: FN-4826
Fusion-Task-Lineage: b08a58c8-66ab-43d4-bdf9-69d2b56b7bcc
2026-05-16 23:45:17 -07:00
Fusion (runfusion.ai)
9e5a516997 feat(FN-4826): complete Step 5 — document handoff telemetry
Fusion-Task-Id: FN-4826
Fusion-Task-Lineage: b08a58c8-66ab-43d4-bdf9-69d2b56b7bcc
2026-05-16 23:45:17 -07:00
Fusion (runfusion.ai)
1553f1dd0d test(FN-4826): complete Step 4 — cover handoff telemetry paths
Fusion-Task-Id: FN-4826
Fusion-Task-Lineage: b08a58c8-66ab-43d4-bdf9-69d2b56b7bcc
2026-05-16 23:45:17 -07:00
Fusion (runfusion.ai)
3453e77396 feat(FN-4826): complete Step 3 — emit mesh lease handoff telemetry
Fusion-Task-Id: FN-4826
Fusion-Task-Lineage: b08a58c8-66ab-43d4-bdf9-69d2b56b7bcc
2026-05-16 23:45:17 -07:00
Fusion (runfusion.ai)
56aca02250 feat(FN-4826): complete Step 2 — emit scheduler handoff events
Fusion-Task-Id: FN-4826
Fusion-Task-Lineage: b08a58c8-66ab-43d4-bdf9-69d2b56b7bcc
2026-05-16 23:45:17 -07:00
Fusion (runfusion.ai)
0705f42a38 feat(FN-4826): complete Step 1 — declare mutation types
Fusion-Task-Id: FN-4826
Fusion-Task-Lineage: b08a58c8-66ab-43d4-bdf9-69d2b56b7bcc
2026-05-16 23:45:17 -07:00
Fusion (runfusion.ai)
3605c67925 feat(FN-4791): add core secrets store for secure key-value storage
Adds a new secrets store module to `@fusion/core` (277 lines in `secrets-store.ts`) and exports it from the package index.

Fusion-Task-Id: FN-4791

Fusion-Task-Lineage: 7ff20b8a-37e1-46c6-8003-b542df9f98b1
2026-05-16 23:44:47 -07:00
Fusion (runfusion.ai)
e1667a789d test(FN-4815): complete Step 2 — add duplicate-search regression coverage
Fusion-Task-Id: FN-4815
Fusion-Task-Lineage: dc29e38d-5914-40c2-b9f7-3504606d91a3
2026-05-16 23:31:56 -07:00
Fusion (runfusion.ai)
e3aeec999c feat(FN-4815): complete Step 1 — add duplicate scenario fixture
Fusion-Task-Id: FN-4815
Fusion-Task-Lineage: dc29e38d-5914-40c2-b9f7-3504606d91a3
2026-05-16 23:31:56 -07:00
gsxdsm
6d6a0242f0 feat(FN-4846): merge fusion/fn-4846 2026-05-16 23:20:31 -07:00
gsxdsm
7988a48576 feat(FN-4844): merge fusion/fn-4844 2026-05-16 23:20:13 -07:00
Fusion (runfusion.ai)
a3e47645b6 test(FN-4833): add node sync auth ownership backstops
- Add node settings sync round-trip tests covering outbound push and pull flows
- Assert outbound node sync and auth routes send the target node Bearer apiKey
- Reject inbound requests authenticated with a remote node key and outbound requests targeting the local or missing node
- Verify auth-sync diagnostics stay redacted and do not leak credentials

Fusion-Task-Id: FN-4833
2026-05-16 22:59:37 -07:00
Fusion (runfusion.ai)
8c3c0206f1 feat(FN-4836): consolidate settings round-trip/default tests with it.each m
Refactors the settings store tests in `packages/core` by consolidating round-trip and default value coverage into structured `it.each` matrices, trimming the test file by roughly 60 lines while maintaining equivalent coverage.

Fusion-Task-Id: FN-4836
2026-05-16 22:47:24 -07:00
Fusion (runfusion.ai)
5cd0e66654 feat(FN-4839): harden real-git test timeouts across engine suites
Hardens test timeouts across 12 reliability and integration test files (branch-conflict recovery, merger diff/overlap guards, self-healing, worktree hydration, workflow/file-scope interactions), covering both real-git and mock-based test lanes with consistent timeout adjustments to reduce flakiness.

Fusion-Task-Id: FN-4839
2026-05-16 22:36:57 -07:00
gsxdsm
df998cb54f feat(FN-4829): merge fusion/fn-4829 2026-05-16 22:26:42 -07:00
Fusion (runfusion.ai)
8ae7f3d97f feat(FN-4837): complete Step 3/4 — shared db cache lane and reset invariants
Fusion-Task-Id: FN-4837
Fusion-Task-Lineage: 93dda830-5658-4894-ad91-ac2c891d2436
2026-05-16 22:19:58 -07:00
Fusion (runfusion.ai)
139e25fcf3 feat(FN-4837): complete Step 2 — migrate store tests to shared harness
Fusion-Task-Id: FN-4837
Fusion-Task-Lineage: 93dda830-5658-4894-ad91-ac2c891d2436
2026-05-16 22:19:57 -07:00
Fusion (runfusion.ai)
743324f8ab feat(FN-4837): complete Step 1 — shared store harness
Fusion-Task-Id: FN-4837
Fusion-Task-Lineage: 93dda830-5658-4894-ad91-ac2c891d2436
2026-05-16 22:19:57 -07:00
Fusion (runfusion.ai)
d4c4d6d7f0 docs(FN-4824): add reliability cross-reference and changeset
Fusion-Task-Id: FN-4824
Fusion-Task-Lineage: 65f53a33-0939-4b6f-b62b-4a255ad14d9e
2026-05-16 21:53:18 -07:00
Fusion (runfusion.ai)
1aeb070083 test(FN-4824): reliability-interaction coverage for cross-node assignment wakes
Fusion-Task-Id: FN-4824
Fusion-Task-Lineage: 65f53a33-0939-4b6f-b62b-4a255ad14d9e
2026-05-16 21:53:18 -07:00
Fusion (runfusion.ai)
46a50c123f feat(FN-4824): forward task assignment events across remote runtime
Fusion-Task-Id: FN-4824
Fusion-Task-Lineage: 65f53a33-0939-4b6f-b62b-4a255ad14d9e
2026-05-16 21:53:18 -07:00
Fusion (runfusion.ai)
39a87a8925 docs(FN-4824): land cross-node assignment-wake contract
Fusion-Task-Id: FN-4824
Fusion-Task-Lineage: 65f53a33-0939-4b6f-b62b-4a255ad14d9e
2026-05-16 21:53:18 -07:00
Fusion (runfusion.ai)
d724008af8 test(FN-4838): complete Step 2 — speed up activity log retention test
Fusion-Task-Id: FN-4838
Fusion-Task-Lineage: 53dcdc36-5818-40ca-a113-27b01989dc1c
2026-05-16 21:46:45 -07:00
Fusion (runfusion.ai)
8cc969cbbb feat(FN-4838): complete Step 1 — add activity log limit test seam
Fusion-Task-Id: FN-4838
Fusion-Task-Lineage: 53dcdc36-5818-40ca-a113-27b01989dc1c
2026-05-16 21:46:44 -07:00
Fusion (runfusion.ai)
2ac207c5b0 feat(FN-4834): complete Step 4 — document init failure outcome diagnostics
Fusion-Task-Id: FN-4834
Fusion-Task-Lineage: 714c9c73-ca66-4c3f-980c-d03e6b50316a
2026-05-16 21:34:26 -07:00
Fusion (runfusion.ai)
70728db098 fix(FN-4834): align reliability fixture task fields with task typing
Fusion-Task-Id: FN-4834
Fusion-Task-Lineage: 714c9c73-ca66-4c3f-980c-d03e6b50316a
2026-05-16 21:34:25 -07:00
Fusion (runfusion.ai)
594ec3e515 test(FN-4834): complete Step 2 — add reliability init stderr regression coverage
Fusion-Task-Id: FN-4834
Fusion-Task-Lineage: 714c9c73-ca66-4c3f-980c-d03e6b50316a
2026-05-16 21:34:25 -07:00
Fusion (runfusion.ai)
ed8c8752f0 feat(FN-4834): complete Step 1 — surface init diagnostics in task log
Fusion-Task-Id: FN-4834
Fusion-Task-Lineage: 714c9c73-ca66-4c3f-980c-d03e6b50316a
2026-05-16 21:34:25 -07:00
Fusion (runfusion.ai)
405d24f9ab fix(FN-4823): tighten lease recovery audit semantics
Fusion-Task-Id: FN-4823
Fusion-Task-Lineage: 0034c04f-df82-4a1b-9f25-b93643a2c157
2026-05-16 21:26:04 -07:00
Fusion (runfusion.ai)
a9dfb17b3d test(FN-4823): expand central-claim recovery coverage
Fusion-Task-Id: FN-4823
Fusion-Task-Lineage: 0034c04f-df82-4a1b-9f25-b93643a2c157
2026-05-16 21:26:04 -07:00
Fusion (runfusion.ai)
bbcc0a269c feat(FN-4823): wire central claim store into mesh lease manager
Fusion-Task-Id: FN-4823
Fusion-Task-Lineage: 0034c04f-df82-4a1b-9f25-b93643a2c157
2026-05-16 21:26:04 -07:00
Fusion (runfusion.ai)
6fa9aef630 feat(FN-4823): complete lease recovery central-claim reconciliation
Fusion-Task-Id: FN-4823
Fusion-Task-Lineage: 0034c04f-df82-4a1b-9f25-b93643a2c157
2026-05-16 21:26:04 -07:00
Fusion (runfusion.ai)
0b28388876 feat(FN-4804): complete Step 4 — add changeset
Fusion-Task-Id: FN-4804
Fusion-Task-Lineage: d2a98aa6-1c5c-427b-ba72-f5d229fdeeb9
2026-05-16 21:17:15 -07:00
Fusion (runfusion.ai)
9845678953 test(FN-4804): add quick chat dropdown regression coverage
Fusion-Task-Id: FN-4804
Fusion-Task-Lineage: d2a98aa6-1c5c-427b-ba72-f5d229fdeeb9
2026-05-16 21:17:15 -07:00
Fusion (runfusion.ai)
f5540a2a33 feat(FN-4804): complete Step 1 — preserve explicit session picks
Fusion-Task-Id: FN-4804
Fusion-Task-Lineage: d2a98aa6-1c5c-427b-ba72-f5d229fdeeb9
2026-05-16 21:17:15 -07:00
Fusion
5c36c0f15f fix(FN-4811): scope-leak guard always allows .changeset/ paths
The [scope-leak] reviewLevel=N enforcement=warn warning was firing on
many in-progress tasks for off-scope .changeset/FN-XXXX-*.md files (the
production signature on FN-4789, FN-4801, FN-4818 \u2014 their branches all
contained .changeset/FN-4811-*.md files from the in-progress fix stack).

By convention every task may add its own changeset entry under
.changeset/ per AGENTS.md 'Finalizing Changes' section, so .changeset/
files are now treated as always-allowed by the scope-leak guard
regardless of the task's declared file scope.

Cross-task changeset leakage is still caught by stronger downstream
guards (file-scope invariant at squash, post-merge audit) at much
higher signal-to-noise. This change only suppresses the noisy
per-execution warning that was flooding logs without adding any
defensive value.

Adds a new exported helper isAlwaysAllowedScopeLeakPath() so the
allowlist surface is easy to extend. Test coverage in
scope-leak-changeset-allowlist.test.ts.

Also (incorporated from interrupted merge state): loosens the
executing-task-lock.test.ts assertion that one losing-instance store
sees zero work-log entries rather than the brittle exact-count of
mockedCreateFnAgent invocations (the no-fn_task_done retry path can
fire on the winning instance, so the count varies).

Fusion-Task-Id: FN-4811
2026-05-16 21:15:10 -07:00
Fusion
b6df11a6a8 fix(FN-4811): process-wide executingTaskLock blocks parallel execute() across instances
Investigating FN-4814 + FN-4811 re-failures after commit 8bef30655 (which
added per-instance synchronous this.executing.add) revealed the per-instance
guard was insufficient. FN-4809 log at 02:48:17-18 UTC:

  02:48:17  [-]                Resuming execution after unpause
  02:48:17  [-]                Step 4 (Testing & Verification) -> pending
  02:48:17  [-]                Step 4 (Testing & Verification) -> pending
  02:48:17  [6097725-y2nb]     Executor detected stale merge state ...
  02:48:18  [6097816-9gde]     Executor detected stale merge state ...

Both runs y2nb and 9gde reached executor.ts:2661 (which is INSIDE execute(),
past the synchronous this.executing.add claim). The only viable explanation
is that there is more than one TaskExecutor instance in the same Node
process (engine restart race, multi-project hybrid runtime, or similar code
path). Each instance has its own executing Set, so the per-instance guard
doesn't help.

Fix: module-level singleton executingTaskLock in active-session-registry.ts,
shared across all TaskExecutor instances. execute() synchronously tryClaim()s
the lock; if false, bails. Every existing this.executing.delete() site also
calls executingTaskLock.release(). Per-instance this.executing kept because
many other call sites use it (this.executing.has at handler gates,
stuck-detector, resumeTaskForAgent, etc.).

Test setup (resetExecutorMocks in executor-test-helpers.ts) clears the lock
between tests so process-wide state doesn't leak (executor-pause and
executor-prompt tests would otherwise show 'expected 2 createFnAgent calls
but got 0' / 'expected not called but called 3 times' flakes).

Tests:
  - executing-task-lock.test.ts: 2 cases. Key case creates TWO TaskExecutor
    instances and races them on the same task ID, asserts only ONE actually
    runs. Verified FAILS on prior code (8bef30655) and PASSES on fix.

Verification:
  - Targeted suite (4 files, 170 tests): pass.
  - pnpm --filter @fusion/engine build: clean.
  - pnpm lint: clean.

Fusion-Task-Id: FN-4811
2026-05-16 21:06:51 -07:00
Fusion (runfusion.ai)
7ab3f7a750 feat(FN-4790): complete Step 5 — documentation and delivery
Fusion-Task-Id: FN-4790
Fusion-Task-Lineage: 4daf3560-7b02-4fbf-9e0a-45e048b795a1
2026-05-16 21:00:48 -07:00
Fusion (runfusion.ai)
30bf7df2bf test(FN-4790): complete Step 3 — add secrets crypto coverage
Fusion-Task-Id: FN-4790
Fusion-Task-Lineage: 4daf3560-7b02-4fbf-9e0a-45e048b795a1
2026-05-16 21:00:48 -07:00
Fusion (runfusion.ai)
5475c76e7e feat(FN-4790): complete Step 2 — export secrets crypto API
Fusion-Task-Id: FN-4790
Fusion-Task-Lineage: 4daf3560-7b02-4fbf-9e0a-45e048b795a1
2026-05-16 21:00:48 -07:00
Fusion (runfusion.ai)
63abf5cac4 feat(FN-4790): complete Step 1 — implement secrets crypto primitive
Fusion-Task-Id: FN-4790
Fusion-Task-Lineage: 4daf3560-7b02-4fbf-9e0a-45e048b795a1
2026-05-16 21:00:48 -07:00
Fusion (runfusion.ai)
27dd927213 feat(FN-4830): complete Steps 4-7 stale lock recovery delivery
Fusion-Task-Id: FN-4830
Fusion-Task-Lineage: d9b8ad72-669f-488e-8e85-be2dce9b8341
2026-05-16 20:54:39 -07:00
Fusion (runfusion.ai)
161cb565e6 feat(FN-4830): complete Step 3 — executor stale-lock recovery
Fusion-Task-Id: FN-4830
Fusion-Task-Lineage: d9b8ad72-669f-488e-8e85-be2dce9b8341
2026-05-16 20:54:34 -07:00