Commit Graph

2570 Commits

Author SHA1 Message Date
gsxdsm
ee6d7acec8 FN-6375: include attachment paths in recovery prompts
Workflow context-limit recovery prompts now direct agents to read task attachments from the project root.

- Pass the project root into reduced workflow step prompts so attachment directories can be absolute when available.
- Replace the autonomous-agent "ask for context" wording with direct file-reading guidance for attachments.
- Cover root-aware, fallback, placement, and context-limit recovery attachment prompt behavior.
- Add a patch changeset for the published Fusion package.

Files changed:
 .../fn-6375-workflow-attachment-recovery-prompt.md |  5 ++
 .../src/__tests__/step-session-executor.test.ts    | 70 +++++++++++++++++++---
 packages/engine/src/step-session-executor.ts       |  8 ++-
 3 files changed, 72 insertions(+), 11 deletions(-)

Fusion-Task-Id: FN-6375
Fusion-Task-Lineage: ed9a5367-1623-49cb-9c7f-116c59ce5117
2026-06-13 16:30:28 -07:00
gsxdsm
3098478d9e Merge origin/main: align merge-region visited nodes with collapse refactor
main's workflow-graph-executor now collapses the merge-policy region
(merge-gate, branch-group-*, merge-attempt) into a single synthetic
`merge` node. Reconcile the S05 work-item-driver test's visitedNodeIds
assertion to match, and union the `observed` recording-primitive fields
from both branches (executedTasks + merge attempt/run/workflow ids).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 15:47:01 -07:00
gsxdsm
43c54290a9 chore(release): v0.42.0
Version bump via changesets.
2026-06-13 12:11:05 -07:00
gsxdsm
97a49ac196 FN-6382: unquarantine stabilized flaky tests
Restore quarantined tests by fixing their flaky harness seams instead of extending the deletion ratchet.

- Mark active Vitest worker roots and skip live worker roots during prune cleanup.
- Make bubblewrap backend coverage deterministic with an injectable runner and restore it to the engine gate.
- Remove rescued core and bubblewrap tests from the quarantine ledger and Vitest excludes.

Files changed:
 .../core/src/__test-utils__/vitest-teardown.ts     | 10 +++++-
 packages/core/vitest.config.ts                     |  8 +----
 .../__tests__/sandbox/bubblewrap-backend.test.ts   | 29 +++++++++------
 packages/engine/src/sandbox/bubblewrap-backend.ts  |  9 +++--
 packages/engine/vitest.config.ts                   |  1 -
 scripts/__tests__/test-changed.test.mjs            | 23 ++++++++++++
 scripts/lib/test-quarantine.json                   | 34 ++----------------
 scripts/test-changed.mjs                           | 41 ++++++++++++++++++++++
 8 files changed, 102 insertions(+), 53 deletions(-)

Fusion-Task-Id: FN-6382

Fusion-Task-Lineage: 018dc7ac-1ef1-495e-a5fd-96ea44fcd43b
2026-06-13 11:39:37 -07:00
gsxdsm
0d882b4350 FN-6383: add branch canonicalization unit coverage
Expand executor tests around canonical Fusion branch naming behavior.

- Cover standard, lowercase, and case-only variant task IDs.
- Document current prefix behavior for branch-name inputs and malformed edge cases.
- Pin lowercase-only behavior without trimming or slugifying task ID text.

Files changed:
 .../executor-branch-canonicalization.test.ts       | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Fusion-Task-Id: FN-6383

Fusion-Task-Lineage: cb43e67d-2cb3-4e08-8ea3-eaa7939ae037
2026-06-13 11:08:56 -07:00
gsxdsm
f68775a5a6 FN-6376: preserve user-paused tasks during recovery
Ensure automated resume and recovery paths leave user-paused tasks paused.

- Skip user-paused tasks when cascading agent resume and approval-decision unpauses.
- Preserve userPaused during stuck-task recovery and log skipped recoveries for user-paused tasks.
- Add regression coverage across engine heartbeat, self-healing, and dashboard route surfaces.
- Document the invariant and add a patch changeset.

Files changed:
 .changeset/fn-6376-user-paused-stays-paused.md     |  5 ++++
 docs/architecture.md                               |  1 +
 .../src/__tests__/routes-agent-runs.test.ts        |  4 +++
 .../src/__tests__/routes-approval.test.ts          | 26 +++++++++++++++--
 .../src/routes/register-agent-runtime-routes.ts    |  2 +-
 .../src/routes/register-approval-routes.ts         |  2 +-
 .../src/__tests__/heartbeat-executor.test.ts       | 28 ++++++++++++++++++
 packages/engine/src/__tests__/self-healing.test.ts | 33 +++++++++++++++++++++-
 packages/engine/src/agent-heartbeat.ts             |  3 +-
 packages/engine/src/self-healing.ts                | 12 ++++++--
 10 files changed, 108 insertions(+), 8 deletions(-)

Fusion-Task-Id: FN-6376
Fusion-Task-Lineage: efa00cb1-58e1-496a-919b-69867f8bff3c
2026-06-13 10:44:01 -07:00
gsxdsm
e0ec3d1fbd FN-6368: route task chat steering to active sessions
Ensure task chat messages reach the live execution surface instead of waiting for a future session.

- Track seen steering comments for legacy, step-session, and workflow-step execution paths.
- Forward new task chat steering to active step sessions and workflow step sessions, including parallel step handles.
- Remove misleading inactive-session composer copy and cover the steering paths with regression tests.
- Add a patch changeset for the published Fusion package.

Files changed:
 .changeset/fn-6368-steering-running-session.md     |   5 +
 packages/dashboard/app/components/TaskChatTab.tsx  |  12 +-
 .../app/components/__tests__/TaskChatTab.test.tsx  |  18 +-
 .../src/__tests__/executor-step-session.test.ts    | 108 ++++++++++++
 .../engine/src/__tests__/executor-test-helpers.ts  |   3 +
 .../src/__tests__/step-session-executor.test.ts    |  40 +++++
 packages/engine/src/executor.ts                    | 186 ++++++++++++++-------
 packages/engine/src/step-session-executor.ts       |  16 ++
 8 files changed, 312 insertions(+), 76 deletions(-)

Fusion-Task-Id: FN-6368

Fusion-Task-Lineage: 610a6185-b136-4fea-a4bd-ea78ab5aab47
2026-06-13 09:41:20 -07:00
gsxdsm
00282fbf20 FN-6357: document external integration evidence format
Document the labeled provenance evidence layout expected by spec validation.

- Add an AGENTS.md example for required external integration evidence fields.
- Expand contributing guidance with accepted labels, URL expectations, and checksum rules.
- Add a regression test that keeps the documented example aligned with the evidence gate.

Files changed:
 AGENTS.md                                          | 14 ++++++++
 docs/contributing.md                               | 28 ++++++++++++++++
 .../src/__tests__/docs-evidence-example.test.ts    | 37 ++++++++++++++++++++++
 3 files changed, 79 insertions(+)

Fusion-Task-Id: FN-6357

Fusion-Task-Lineage: 788260ed-d5cf-4592-b117-40af5c45e0a1
2026-06-13 09:18:58 -07:00
gsxdsm
e305b1aa4c FN-6361: respect paused tasks during triage planning
Keep triage planning from advancing or continuing work after a task is paused.

- Abort active triage sessions and reviewer subagents when task updates mark the task paused.
- Skip approved-spec recovery and final approved-spec transitions while a task remains paused.
- Add regression coverage for paused planning, pause-driven aborts, and published package changeset metadata.

Files changed:
 .changeset/pause-triage-planning.md                |   5 +
 .../src/__tests__/triage-pause-abort.test.ts       | 237 +++++++++++++++++++++
 packages/engine/src/triage.ts                      |  57 +++++
 3 files changed, 299 insertions(+)

Fusion-Task-Id: FN-6361
Fusion-Task-Lineage: 33d849d5-1461-49ae-9fe0-be98b534ac35
2026-06-13 08:38:59 -07:00
gsxdsm
bffae81a98 FN-6277: track and reconcile legacy auto-merge stamps
Track legacy auto-merge stamp provenance and add safe operator cleanup.

- Add autoMergeProvenance storage and migration support so user overrides can be distinguished from legacy review-entry stamps.
- Mark existing ambiguous in-review autoMerge=true tasks as legacy stamps without changing behavior, and expose a dry-run/apply reconciliation API to clear them safely.
- Emit a non-mutating advisory when global auto-merge is disabled while legacy stamped review tasks remain.
- Cover migration, persistence, reconciliation, movement, merge resolution, and advisory behavior with regression tests and docs.

Files changed:
 .../fn-6277-legacy-automerge-stamp-cleanup.md      |   5 +
 docs/architecture.md                               |   2 +-
 docs/settings-reference.md                         |   2 +-
 packages/core/src/__tests__/db-migrate.test.ts     |  30 ++--
 packages/core/src/__tests__/db.test.ts             |  44 +++---
 packages/core/src/__tests__/goals-schema.test.ts   |   2 +-
 packages/core/src/__tests__/insight-store.test.ts  |  10 +-
 .../legacy-automerge-stamp-reconcile.test.ts       | 144 +++++++++++++++++++
 .../src/__tests__/merge-request-record.test.ts     |   2 +-
 packages/core/src/__tests__/mission-store.test.ts  |   2 +-
 packages/core/src/__tests__/run-audit.test.ts      |   4 +-
 .../core/src/__tests__/store-merge-queue.test.ts   |   2 +-
 packages/core/src/__tests__/store-movement.test.ts |  14 ++
 packages/core/src/__tests__/task-documents.test.ts |   2 +-
 packages/core/src/__tests__/task-merge.test.ts     |  16 ++-
 packages/core/src/db.ts                            |  10 +-
 packages/core/src/index.ts                         |   1 +
 packages/core/src/store.ts                         | 157 ++++++++++++++++++++-
 packages/core/src/task-merge.ts                    |   8 +-
 packages/core/src/types.ts                         |  10 +-
 .../automerge-toggle-legacy-advisory.test.ts       | 128 +++++++++++++++++
 packages/engine/src/project-engine.ts              |  68 ++++++++-
 22 files changed, 593 insertions(+), 70 deletions(-)

Fusion-Task-Id: FN-6277

Fusion-Task-Lineage: 22d36519-f2ba-4ca7-8a09-12fc803c9a5b
2026-06-13 05:06:05 -07:00
gsxdsm
7eafa91dd7 FN-6350: accept labeled external integration evidence
Relax the spec-review evidence detector so complete labeled Markdown evidence passes validation.

- Scan dedicated External Integration Evidence sections alongside existing prompt sections.
- Recognize labeled repo, docs, release/download, CLI name, and checksum evidence with flexible Markdown formatting.
- Add regression coverage for FN-6349-style evidence blocks and triage reviewer handoff.

Files changed:
 ...alidation-external-integration-evidence.test.ts | 51 +++++++++++++++++++
 ...triage-review-spec-external-integration.test.ts | 40 ++++++++++++++-
 .../external-integration-evidence.ts               | 59 +++++++++++++++++++---
 3 files changed, 143 insertions(+), 7 deletions(-)

Fusion-Task-Id: FN-6350

Fusion-Task-Lineage: 7d0d9a0a-1f51-41db-9434-d15496293c2c
2026-06-13 04:54:59 -07:00
gsxdsm
2a37ee4e59 FN-6341: settle cli-agent re-entry test promise
Stabilize the cli-agent re-entry regression test by awaiting the original run after the replacement session succeeds.

- Keep the first cli-agent run promise instead of dropping it with void.
- Assert the active task session still points at the first PTY before simulating re-entry.
- Kill and await the first session at the end so no hub or store work outlives teardown.

Files changed:
 packages/engine/src/__tests__/cli-agent-executor.test.ts | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-6341

Fusion-Task-Lineage: 3e365f21-0d05-496a-adec-aa782aa83503
2026-06-13 04:06:17 -07:00
gsxdsm
4e6df035c1 FN-6275: allow verified no-op completions
Allow executors to finish already-satisfied tasks without fabricating commits while preserving existing completion guards.

- Add leading sentinel parsing for premise-stale, no-op, duplicate, and redundant completion summaries.
- Permit zero-commit fn_task_done only for recognized sentinels or existing no-commit contracts, with audit log/activity details.
- Document the verified no-op completion contract and add regression coverage for accepted and refused paths.

Files changed:
 .changeset/fn-6275-no-op-completion.md             |   5 ++
 docs/architecture.md                               |   1 +
 .../src/__tests__/no-op-completion-marker.test.ts  |  55 ++++++++++++
 packages/core/src/agent-prompts.ts                 |   4 +
 packages/core/src/index.ts                         |   5 ++
 packages/core/src/no-op-completion-marker.ts       |  48 ++++++++++
 .../__tests__/executor-task-done-invariant.test.ts | 100 +++++++++++++++++++++
 .../engine/src/__tests__/executor-test-helpers.ts  |   1 +
 packages/engine/src/executor.ts                    |  64 ++++++++++++-
 9 files changed, 279 insertions(+), 4 deletions(-)

Fusion-Task-Id: FN-6275

Fusion-Task-Lineage: 0a2ec21b-415f-411c-bfcd-4f1c19a6a136
2026-06-13 02:54:57 -07:00
gsxdsm
0765913db9 Merge branch 'fix/fn-352-no-commit-coordination' 2026-06-13 00:03:17 -07:00
gsxdsm
000a73b3f0 Merge origin/main into fix/fn-352-no-commit-coordination
Reconcile the FN-352 no-commit coordination guard skip with main's
independently-landed FN-424 work. Both branches added a no_commits
guard bypass at the same fn_task_done call site:

- FN-352 (this branch): getNoCommitEligibilityReason(task) covering
  Review Level 1 coordination prompts with board-only scope and
  explicit no-source intent (e.g. "Do not change product source").
- FN-424 (main): evaluatePromptDerivedNoCommitEligibility(...) plus
  non-blocking audit logging of the skip.

Their prompt phrase-matching differs, so neither alone satisfies the
merged test file. Resolved by OR-ing both eligibility checks and
wrapping the skip in main's audit-logging block. Both helpers still
refuse the contradictory implementation+coordination prompt.

All 18 executor-task-done-invariant tests pass; engine typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 00:01:30 -07:00
gsxdsm
a9b11399d9 FN-6336: reattach orphaned assigned executions
Self-healing now resumes stranded assigned in-progress work when an agent has no active run or execution.

- Add a self-healing pass that groups stale assigned in-progress tasks by durable agent and calls the executor resume seam without moving tasks backward.
- Emit run-audit telemetry for reattached orphaned executions and wire the resume hook through the in-process runtime.
- Cover grace windows, pause/active-run/active-execution guards, task filtering, and registration order with engine tests.
- Document the recovery behavior and add a patch changeset for the published CLI package.

Files changed:
 .changeset/fn-6336-reattach-orphaned-executions.md |   5 +
 docs/agents.md                                     |   2 +
 docs/architecture.md                               |   2 +
 ...lf-healing-reattach-orphaned-executions.test.ts | 217 +++++++++++++++++++++
 packages/engine/src/run-audit.ts                   |   1 +
 packages/engine/src/runtimes/in-process-runtime.ts |   1 +
 packages/engine/src/self-healing.ts                | 122 ++++++++++++
 7 files changed, 350 insertions(+)

Fusion-Task-Id: FN-6336

Fusion-Task-Lineage: 6d8519b9-d8b0-4726-9b45-bfa445b7883e
2026-06-12 23:17:28 -07:00
gsxdsm
011b401764 Merge pull request #1668 from plarson/fix/fn-424-plan-only-no-commit
fix(FN-424): allow plan-only no-commit completion
2026-06-12 22:01:03 -07:00
gsxdsm
1450d39976 Merge origin/main into fix/fn-424-plan-only-no-commit
Resolve conflicts from main's FN-6232 single-source triage prompt refactor:
- Drop the inline FAST_TRIAGE_SYSTEM_PROMPT const removed by main; the fast
  triage prompt now lives in agent-prompts.ts (planning-fast seam).
- Migrate the PR's no-commit/operational-routing heuristic edits into the
  fast block of agent-prompts.ts (standard block already carried them).
- Point triage tests at FAST_PLANNING_PROMPT/TRIAGE_POLICY_PROMPT instead of
  the removed const.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 21:47:57 -07:00
gsxdsm
ac8ad834ce Merge branch 'main' into fix/fn-352-no-commit-coordination 2026-06-12 21:39:07 -07:00
gsxdsm
0457144111 Merge pull request #1665 from plarson/fix/insights-extract-response
fix(dashboard): repair insight extraction and research provider config
2026-06-12 21:36:20 -07:00
gsxdsm
9d0573a2ee Merge pull request #1663 from plarson/fix/fn-343-merge-worktree-cleanup
fix: classify harmless merge worktree cleanup failures
2026-06-12 21:34:51 -07:00
gsxdsm
167f9b0542 FN-6324: allow opted-in engineer backlog auto-claim
Engineer backlog auto-claim now respects an explicit opt-in while keeping the default executor-only behavior.

- Add engineerBacklogAutoClaim settings and runtime overrides for backlog pickup role checks.
- Update heartbeat auto-claim filtering, logs, and no-task prompt guidance for opted-in engineer agents.
- Cover executor/default engineer/opted-in engineer routing with core and heartbeat tests.
- Document the setting and record quarantined unrelated temp-root flakes seen during verification.

Files changed:
 .changeset/FN-6324-engineer-backlog-auto-claim.md  |  5 ++
 docs/agents.md                                     |  3 +
 docs/settings-reference.md                         |  1 +
 .../core/src/__tests__/agent-role-policy.test.ts   | 33 +++++++++-
 packages/core/src/agent-role-policy.ts             | 11 +++-
 packages/core/src/settings-schema.ts               |  1 +
 packages/core/src/types.ts                         |  4 ++
 packages/core/vitest.config.ts                     |  6 ++
 .../src/__tests__/heartbeat-executor.test.ts       | 70 ++++++++++++++++++++++
 packages/engine/src/agent-heartbeat.ts             | 65 +++++++++++++++-----
 scripts/lib/test-quarantine.json                   | 20 +++++++
 11 files changed, 199 insertions(+), 20 deletions(-)

Fusion-Task-Id: FN-6324

Fusion-Task-Lineage: 4d124d98-4ad1-44ce-a76c-f1db3199b3c6
2026-06-12 19:45:37 -07:00
gsxdsm
e17e8b34f8 FN-6319: quarantine flaky engine tests
Quarantine unrelated engine test flakes so the gate avoids known unstable fixtures.

- Add the soft-delete blocker residue reliability test to the quarantine ledger and reliability interaction exclusions.
- Add the bubblewrap sandbox backend test to the quarantine ledger and engine-core exclusions.

Files changed:
 packages/engine/vitest.config.ts |  6 +++++-
 scripts/lib/test-quarantine.json | 10 ++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-6319
Fusion-Task-Lineage: 9a47ae20-76b8-47d8-8858-f4fe51ea807e
2026-06-12 17:47:02 -07:00
Phil Larson
285f238e92 fix(FN-424): keep audit logging non-blocking 2026-06-12 16:08:00 -07:00
Phil Larson
f331419867 fix(FN-424): simplify prompt scope parsing 2026-06-12 15:59:58 -07:00
Phil Larson
8541db3185 fix(engine): normalize dashboard research providers 2026-06-12 15:57:12 -07:00
Phil Larson
c6bcbe26a2 fix(FN-352): address no-commit review feedback 2026-06-12 15:54:47 -07:00
Phil Larson
3a729f53a9 fix(FN-352): allow no-commit coordination completion 2026-06-12 15:51:50 -07:00
Phil Larson
834ea3c227 fix(FN-343): address follow-up review findings 2026-06-12 15:51:50 -07:00
Phil Larson
16d71e6773 fix(FN-343): address PR review feedback 2026-06-12 15:51:50 -07:00
Phil Larson
92c5503f88 test(FN-343): cover merger temp cleanup visibility
Fusion-Task-Id: FN-343

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-06-12 15:51:45 -07:00
Phil Larson
3cfc3972a5 fix(FN-343): classify pruned temp merge worktree removals
Fusion-Task-Id: FN-343

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-06-12 15:51:45 -07:00
Phil Larson
21afa84b2b test(FN-343): add regression for temp cleanup classification
Fusion-Task-Id: FN-343

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-06-12 15:51:40 -07:00
Phil Larson
02a85818c1 fix(FN-343): address follow-up review findings 2026-06-12 15:51:15 -07:00
Phil Larson
2ac9968ea5 fix(FN-343): address PR review feedback 2026-06-12 15:51:15 -07:00
Phil Larson
14cc9d82d1 test(FN-343): cover merger temp cleanup visibility
Fusion-Task-Id: FN-343

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-06-12 15:50:53 -07:00
Phil Larson
b094e0c765 fix(FN-343): classify pruned temp merge worktree removals
Fusion-Task-Id: FN-343

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-06-12 15:50:53 -07:00
Phil Larson
af830ac770 test(FN-343): add regression for temp cleanup classification
Fusion-Task-Id: FN-343

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-06-12 15:45:16 -07:00
Phil Larson
e9b48bd50c fix(FN-424): address no-commit review edge cases 2026-06-12 15:45:04 -07:00
Phil Larson
fb4a5e912a feat(FN-424): complete Step 3 — guide operational no-commit planning
Fusion-Task-Id: FN-424

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-06-12 15:02:41 -07:00
Phil Larson
ab35c87114 test(FN-424): prove no-commit guard preserves worktree checks
Fusion-Task-Id: FN-424

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-06-12 15:00:19 -07:00
Phil Larson
35502afdb8 fix(FN-424): align no-commit regression fixtures
Fusion-Task-Id: FN-424

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-06-12 14:58:40 -07:00
Phil Larson
cb128f5824 test(FN-424): cover plan-only no-commit finalization
Fusion-Task-Id: FN-424

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-06-12 14:58:39 -07:00
gsxdsm
039d3ce440 FN-6236: move fast triage into workflow settings
Move fast triage prompting into the workflow/settings prompt model.

- Add a core-owned fast triage prompt and expose the workflow prompt mode type.
- Add a fast-mode builtin workflow variant and route triage prompt selection through workflow settings.
- Remove the engine-local fast triage prompt constant and update triage tests for workflow-driven fast mode.
- Document the fast triage prompt mode setting and add a patch changeset.

Files changed:
 .changeset/FN-6236-fast-mode-workflow-variant.md   |   7 +
 docs/settings-reference.md                         |   2 +
 packages/core/src/__tests__/agent-prompts.test.ts  |  16 +-
 .../builtin-workflow-settings-triage.test.ts       |   5 +
 packages/core/src/agent-prompts.ts                 | 221 +++++++++++++++++++
 packages/core/src/builtin-workflow-prompts.ts      |  12 +-
 packages/core/src/builtin-workflow-settings.ts     |  18 +-
 packages/core/src/index.ts                         |   5 +
 packages/core/src/types.ts                         |   4 +
 .../triage-duplicate-search-regression.test.ts     |  18 +-
 .../triage-fast-mode-workflow-variant.test.ts      | 219 +++++++++++++++++++
 .../triage-planning-prompt-single-source.test.ts   |   8 +-
 packages/engine/src/__tests__/triage.test.ts       |  64 +++---
 packages/engine/src/triage.ts                      | 235 ++-------------------
 14 files changed, 565 insertions(+), 269 deletions(-)

Fusion-Task-Id: FN-6236

Fusion-Task-Lineage: 369954d8-41e7-4d88-aa6d-e6bbca077d50
2026-06-12 14:39:51 -07:00
gsxdsm
751d94244c FN-6294: collapse workflow merge primitives
Collapse built-in workflow merge-policy primitives back to the legacy merge seam until graph execution owns merge policy end-to-end.

- Treat all merge-policy primitive node kinds as a synthetic legacy merge node during graph traversal.
- Preserve shadow-stage parity by mapping the synthetic merge node into legacy stage transitions.
- Add regression coverage for success, failure, pre-merge review failure, and alternate merge-region entry points.
- Record a patch changeset for the published Fusion package.

Files changed:
 .changeset/fn-6294-merge-region-collapse.md        |   5 +
 .../workflow-graph-executor-handlers.test.ts       |  13 ++-
 .../workflow-graph-merge-region-collapse.test.ts   | 116 +++++++++++++++++++++
 packages/engine/src/executor.ts                    |  14 ++-
 packages/engine/src/workflow-graph-executor.ts     |  63 ++++++++++-
 5 files changed, 203 insertions(+), 8 deletions(-)

Fusion-Task-Id: FN-6294

Fusion-Task-Lineage: fe86b5e2-861f-448d-8db0-b0332e6ad76f
2026-06-12 14:21:18 -07:00
gsxdsm
ba610a1c0e FN-6296: fix stuck-kill force-requeue cleanup
Reap hung executor surfaces before requeueing stuck-kill timeout tasks.

- terminate spawned child agents and active session surfaces before clearing execution guards
- remove stale worktrees during force-requeue while preserving concurrent recovery ownership
- add regression coverage and architecture notes for the cleanup contract

Files changed:
 docs/architecture.md                               |   2 +
 .../engine/src/__tests__/executor-recovery.test.ts | 248 ++++++++++++++++++++-
 packages/engine/src/executor.ts                    |  61 ++++-
 3 files changed, 305 insertions(+), 6 deletions(-)

Fusion-Task-Id: FN-6296

Fusion-Task-Lineage: a393e2b1-a72c-4d7b-9de2-6bf7268986d4
2026-06-12 14:08:52 -07:00
gsxdsm
283adce4d0 FN-6295: move AI merge clean rooms into worktrees
Move AI-merge clean-room worktrees into the configured worktrees directory while preserving legacy cleanup.

- Resolve AI-merge roots through the configured worktrees directory using a hidden .ai-merge container.
- Keep local git excludes and stale cleanup compatible with legacy .fusion/ai-merge and tmpdir locations.
- Exclude the .ai-merge container from worktree pool and self-healing one-level sweeps.
- Add regression coverage for path resolution, cleanup, orphan reap, and cap enforcement behavior.
- Update architecture and agent guidance for the relocated clean-room root.

Files changed:
 AGENTS.md                                          |  2 +-
 docs/architecture.md                               |  4 +-
 .../engine/src/__tests__/merger-ai-cleanup.test.ts | 50 +++++++++----
 .../__tests__/self-healing-tempdir-sweep.test.ts   | 87 +++++++++++++++++++---
 .../engine/src/__tests__/worktree-paths.test.ts    | 24 ++++++
 .../engine/src/__tests__/worktree-pool.test.ts     | 55 ++++++++++++++
 packages/engine/src/merger-ai.ts                   | 27 +++++--
 packages/engine/src/self-healing.ts                | 25 +++----
 packages/engine/src/worktree-paths.ts              | 17 +++++
 packages/engine/src/worktree-pool.ts               | 10 +--
 10 files changed, 247 insertions(+), 54 deletions(-)

Fusion-Task-Id: FN-6295
Fusion-Task-Lineage: d95d32c2-3253-4964-b68a-252b4cb65109
2026-06-12 12:49:34 -07:00
gsxdsm
0897b2a0bf FN-6281: add bounded graph resume retries
Add a narrow persisted retry path for transient workflow-graph failures during resume after restart or unpause.

- Persist graphResumeRetryCount with schema migration, store round-tripping, manual retry reset, and task serialization coverage.
- Retry only no-progress execute-seam graph failures immediately following resume markers, then clear transient status/error and re-run within a capped budget.
- Preserve terminal graph failure handling for explicit reasons, durable task failures, completed progress, non-resume cases, and exhausted retry budgets.
- Document the resume-limbo retry contract and add a patch changeset for @runfusion/fusion.

Files changed:
 .changeset/fn-6281-graph-resume-retry.md           |   5 +
 docs/architecture.md                               |   1 +
 packages/core/src/__tests__/db-migrate.test.ts     |  30 +--
 packages/core/src/__tests__/db.test.ts             |  44 ++---
 packages/core/src/__tests__/goals-schema.test.ts   |   2 +-
 packages/core/src/__tests__/insight-store.test.ts  |  10 +-
 .../core/src/__tests__/manual-retry-reset.test.ts  |   1 +
 .../src/__tests__/merge-request-record.test.ts     |   2 +-
 packages/core/src/__tests__/mission-store.test.ts  |   2 +-
 packages/core/src/__tests__/run-audit.test.ts      |   4 +-
 .../core/src/__tests__/store-merge-queue.test.ts   |   2 +-
 .../core/src/__tests__/store-persistence.test.ts   |  22 +++
 packages/core/src/__tests__/task-documents.test.ts |   2 +-
 packages/core/src/db.ts                            |  10 +-
 packages/core/src/manual-retry-reset.ts            |   1 +
 packages/core/src/store.ts                         |  14 +-
 packages/core/src/types.ts                         |   5 +
 .../engine/src/__tests__/executor-recovery.test.ts | 201 +++++++++++++++++++++
 packages/engine/src/executor.ts                    |  54 ++++++
 19 files changed, 359 insertions(+), 53 deletions(-)

Fusion-Task-Id: FN-6281

Fusion-Task-Lineage: f9061445-8624-465a-9255-c3d02eac1bdb
2026-06-12 11:10:12 -07:00
gsxdsm
36ba1b9d68 FN-6292: prevent dependency-blocking file leases
Prevent dependency waiters from holding file-scope leases that can block their own dependencies.

- Exclude in-progress tasks with unmet scheduling dependencies from active overlap lease maps.
- Add self-healing recovery for existing dependency/lease circular waits with triple-proof auditing.
- Cover scheduler and self-healing behavior with regression tests and document the new audit events.

Files changed:
 AGENTS.md                                          |   1 +
 docs/architecture.md                               |   5 +-
 packages/engine/src/__tests__/scheduler.test.ts    | 108 +++++++++++++
 packages/engine/src/__tests__/self-healing.test.ts | 172 ++++++++++++++++++++-
 packages/engine/src/scheduler.ts                   |  67 +++++---
 packages/engine/src/self-healing.ts                | 132 ++++++++++++++++
 6 files changed, 462 insertions(+), 23 deletions(-)

Fusion-Task-Id: FN-6292
Fusion-Task-Lineage: 7c0e852d-bdb1-4775-a6b7-2b60b7583da1
2026-06-12 10:49:02 -07:00
gsxdsm
f7f2cae9d0 FN-6237: apply frontend UX criteria as workflow policy
Move frontend UX criteria out of triage self-instructions and into deterministic workflow policy.

- Add a shared frontend UX policy helper that matches frontend file scopes and injects the byte-equivalent checklist idempotently.
- Apply the policy during triage finalization and persist the updated PROMPT.md when applicable.
- Replace the legacy prompt-based injection instructions with a pointer to the deterministic policy.
- Cover path matching, insertion behavior, and checklist parity with focused core tests.
- Add a minor changeset for the published Fusion package.

Files changed:
 .changeset/fn-6237-frontend-ux-policy.md           |   5 +
 .../core/src/__tests__/frontend-ux-policy.test.ts  | 119 +++++++++++++++++
 packages/core/src/agent-prompts.ts                 |  29 +---
 packages/core/src/frontend-ux-policy.ts            | 148 +++++++++++++++++++++
 packages/core/src/index.ts                         |   1 +
 packages/engine/src/triage.ts                      |  19 ++-
 6 files changed, 291 insertions(+), 30 deletions(-)

Fusion-Task-Id: FN-6237

Fusion-Task-Lineage: 7ac95064-9ec6-4760-8609-20c35075aca1
2026-06-12 09:24:02 -07:00