Commit Graph

52 Commits

Author SHA1 Message Date
Fusion Agent
33f4797ceb FN-126: fix inert sync-lane validation
Prevent inert synchronization lanes from bypassing merge-gate validation while preserving task-lane cache and archive lifecycle behavior.

- Reject sync-resolved lane conversions in the static validator.
- Preserve task-lane cache emissions and active-session cleanup across task mutations and archival.
- Add regression coverage, baseline updates, documentation, and a release changeset.

Files changed:
 .changeset/fn-126-inert-sync-lane.md               |   7 +
 .../a-falling-count-is-not-evidence.md             |  12 +
 .../task-lane-cache-emitter-preservation.test.ts   | 269 +++++++++++++++++++++
 .../core/src/task-store/archive-lifecycle-2.ts     |   3 +-
 packages/core/src/task-store/moves.ts              |   3 +-
 packages/core/src/task-store/task-artifacts-ops.ts |   3 +-
 packages/core/src/task-store/task-update.ts       |   3 +-
 packages/core/src/task-store/update-task-deps.ts   |   3 +-
 ...xecutor-archive-releases-active-session.test.ts |  80 ++++++
 packages/engine/src/executor.ts                    |   4 +-
 .../src/executor/executor-side-effect-hosts.ts     |   2 +-
 .../executor/is-backward-move-out-of-planning.ts   |   7 +-
 .../src/executor/task-executor-graph-facades.ts    |   2 +-
 .../engine/src/executor/task-executor-imports.ts   |   1 -
 .../engine/src/executor/wire-executor-lifecycle.ts |  18 +-
 .../check-inert-sync-lane-conversions.test.mjs     |  83 +++++--
 scripts/check-inert-sync-lane-conversions.mjs      |  19 +-
 scripts/lib/inert-sync-lane-baseline.json          |   6 +-
 18 files changed, 479 insertions(+), 46 deletions(-)

Fusion-Task-Id: FN-126

Fusion-Task-Lineage: 0c7a1a3a-9446-44f8-955d-df6c402dfd31

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-23 01:36:12 +00:00
Fusion Agent
0b4dbd219b FN-125: prevent workflow agents from creating tasks
Stop workflow executor agents from creating ordinary tasks while preserving explicit self-spawned dependency handling.

- Gate task creation by session identity and execution context.
- Add self-spawned dependency support, validation, and persistence coverage.
- Update agent prompts, tools, documentation, and CLI integration.
- Add a published-package changeset.

Files changed:
 .changeset/fn-125-removal.md                       |  7 +++
 docs/agents.md                                     |  2 +-
 docs/dashboard-guide.md                            |  2 +-
 docs/settings-reference.md                         |  6 +-
 .../cli/skill/fusion/references/engine-tools.md    | 10 ++--
 .../extension-task-execution-task-creation.test.ts | 70 ++++++++++++++++++++++
 packages/cli/src/extension.ts                      | 49 +++++++++++++--
 .../postgres/store-self-spawned-dep.pg.test.ts     | 56 +++++++++++++++++
 .../src/__tests__/self-spawned-dependency.test.ts  | 18 ++++++
 .../__tests__/session-identity-registry.test.ts    | 14 ++++-
 packages/core/src/agents/agent-prompts.ts          | 27 ++++-----
 .../src/agents/task-execution-task-creation.ts     | 19 ++++++
 packages/core/src/index.ts                         |  7 +++
 packages/core/src/session-identity-registry.ts     |  7 +++
 packages/core/src/store.ts                         |  2 +
 packages/core/src/task-store/errors.ts             | 21 +++++++
 packages/core/src/task-store/task-update.ts        | 10 +++-
 packages/core/src/task-store/update-task-deps.ts   | 12 +++-
 .../__tests__/ephemeral-task-create-gate.test.ts   | 18 +++---
 .../src/__tests__/executor-review-verdicts.test.ts |  3 +-
 packages/engine/src/agent-tools.ts                 |  4 ++
 packages/engine/src/agents/agent-runtime.ts        |  2 +
 .../engine/src/execution/step-session-executor.ts  | 15 ++---
 .../executor/attempt-executor-verification-fix.ts  |  1 +
 .../engine/src/executor/create-spawn-agent-tool.ts |  1 +
 .../engine/src/executor/create-task-done-tool.ts   | 18 +++++-
 .../engine/src/executor/create-task-update-tool.ts | 12 +++-
 .../engine/src/executor/execute-workflow-step.ts   |  1 +
 packages/engine/src/executor/run-implementation.ts | 18 +++---
 packages/engine/src/executor/system-prompt.ts      | 21 +++----
 packages/engine/src/executor/task-add-dep-tool.ts  | 14 ++++-
 packages/engine/src/pi.ts                          | 15 ++++-
 32 files changed, 401 insertions(+), 81 deletions(-)

Fusion-Task-Id: FN-125

Fusion-Task-Lineage: da3d69f6-c9cb-45fd-8691-3dfaf7007514
Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-23 01:36:12 +00:00
Fusion Agent
10c399d01e FN-120: fix workspace review evidence and landing recovery
Harden workspace review evidence and automatic landing recovery across workflow execution and merge paths.

- Preserve per-repository review evidence and reroute recoverable workspace review failures.
- Improve workflow lifecycle validation, continuation handling, and automatic recovery for workspace landing.
- Add regression coverage and document the updated workspace behavior.

Files changed:
 .changeset/fn-120-workspace-review-landing.md      |   7 ++
 docs/architecture.md                               |   4 +
 ...e-empty-merge-boundary-finalization-livelock.md |   4 +
 docs/testing.md                                    |   4 +
 docs/workflow-steps.md                             |   4 +
 docs/workspaces.md                                 |   6 +
 .../__tests__/builtin-coding-workflow-ir.test.ts   |  11 +-
 ...workspace-worktrees-concurrent-merge.pg.test.ts |  20 +++
 packages/core/src/db/legacy-adoption.ts            |   4 +
 packages/core/src/store.ts                         |   5 +-
 .../task-store/async/async-workflow-workitems.ts   |  21 ++++
 packages/core/src/task-store/task-mutation-ops.ts  |  20 ++-
 .../src/task-store/workflow-workitems-ops-2.ts     |   6 +-
 .../workflows/builtin-coding-ideas-workflow-ir.ts  |   9 +-
 .../src/workflows/builtin-coding-workflow-ir.ts    |  20 ++-
 .../builtin-stepwise-coding-workflow-ir.ts         |  21 +++-
 ...tin-stepwise-final-review-coding-workflow-ir.ts |  13 +-
 .../src/workflows/workflow-lifecycle-validation.ts |  28 ++++-
 .../__tests__/builtin-workflows-lifecycle.test.ts  |   4 +
 .../engine/src/__tests__/project-engine.test.ts    |  79 ++++++++++++
 .../graph-node-missing-worktree-recovery.test.ts   |  32 ++++-
 .../src/__tests__/reviewer-workspace.test.ts       |   2 +
 .../src/__tests__/task-pipeline-smoke.test.ts      |  10 +-
 .../src/__tests__/workflow-task-runtime.test.ts    |  10 +-
 .../engine/src/__tests__/workspace-e2e.test.ts     |  29 +++++
 .../engine/src/__tests__/workspace-merger.test.ts  |   4 +-
 .../__tests__/workspace-review-evidence.test.ts    |  58 +++++++++
 packages/engine/src/execution/reviewer.ts          |   2 +
 .../create-authoritative-workflow-seams.ts         |  59 +++++----
 .../engine/src/executor/execute-workflow-graph.ts  |  29 ++++-
 packages/engine/src/executor/graph-failure-pure.ts |   6 +
 .../engine/src/executor/handle-graph-failure.ts    |  26 ++++
 ...-unusable-worktree-graph-failure-to-recovery.ts |  22 +++-
 .../engine/src/executor/run-graph-custom-node.ts   |   4 +-
 .../src/executor/workspace-review-per-repo.ts      |  55 +++++----
 packages/engine/src/merge/merger-ai.ts             | 137 ++++++++++-----------
 .../engine/src/merge/workspace-review-reroute.ts   |  52 ++++++++
 packages/engine/src/project-engine.ts              |  47 +++++++
 .../self-healing/auto-recover-worktree-session.ts  |   2 +-
 .../src/workflows/workflow-graph-executor.ts       |  28 ++++-
 .../engine/src/workflows/workflow-merge-nodes.ts   |   6 +-
 .../src/worktree/workspace-review-evidence.ts      | 110 +++++++++++++++++
 .../engine/src/worktree/worktree-acquisition.ts    |  24 +++-
 43 files changed, 874 insertions(+), 170 deletions(-)
Fusion-Task-Id: FN-120
Fusion-Task-Lineage: 61c36613-89bd-44ca-8676-de77662bf53e
Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-23 01:36:12 +00:00
gsxdsm
a010dc42bf FN-9185: enforce effective task concurrency limits
Unify task concurrency around authoritative project settings and expose the effective admission ceiling.

- Resolve maxConcurrent and maxWorktrees through a shared core capacity model with consistent defaults.
- Apply the effective limit across scheduler, engine, runtime, CLI, API, and project-manager admission paths.
- Surface configured and binding concurrency values in dashboard controls, status views, diagnostics, and documentation.
- Add regression coverage for settings persistence, routing, scheduling, UI surfaces, and worktree-bound capacity.

Files changed:
 .../fn-9185-max-concurrent-effective-limit.md      |   7 +
 docs/architecture.md                               |   8 +-
 docs/cli-reference.md                              |   1 +
 docs/dashboard-guide.md                            |   4 +
 docs/settings-reference.md                         |   4 +-
 .../dashboard-concurrency-settings.test.ts         | 166 +++++++++++++++++++++
 packages/cli/src/commands/dashboard.ts             |  28 ++--
 packages/cli/src/commands/onboard.ts               |   4 +-
 packages/cli/src/project-resolver.ts               |  27 +++-
 .../concurrency-capacity-resolver.test.ts          |  46 ++++++
 .../src/__tests__/worktree-capacity-limit.test.ts  |  51 +++++--
 packages/core/src/index.gate.ts                    |   2 +-
 packages/core/src/index.ts                         |   2 +-
 packages/core/src/workflows/workflow-capacity.ts   |  61 ++++++--
 packages/dashboard/app/App.tsx                     |   2 +
 .../app/__tests__/concurrency-ui-surfaces.test.tsx | 155 +++++++++++++++++++
 .../scheduling-effective-concurrency.test.tsx      |  48 ++++++
 packages/dashboard/app/api/projects/projects.ts    |  10 +-
 packages/dashboard/app/api/settings/settings.ts    |  14 +-
 packages/dashboard/app/components/Board.tsx        |   7 +-
 packages/dashboard/app/components/Column.tsx       |  13 +-
 .../dashboard/app/components/EngineControlMenu.tsx |  17 ++-
 .../command-center/CommandCenterControls.tsx       |  17 ++-
 .../components/command-center/areas/TeamArea.tsx   |  10 +-
 .../app/components/dashboard/MainContent.tsx       |   3 +
 .../dashboard/app/components/dashboard/types.ts    |   2 +
 .../settings/sections/SchedulingSection.tsx        |  12 +-
 packages/dashboard/app/hooks/useAppSettings.ts     |   9 +-
 packages/dashboard/app/hooks/useExecutorStats.ts   |  10 +-
 .../app/utils/__tests__/worktreeGrouping.test.ts   |  12 +-
 packages/dashboard/app/utils/worktreeGrouping.ts   |   8 +-
 packages/dashboard/src/routes.ts                   |   6 +-
 ...concurrency-authoritative-source-routes.test.ts |  90 +++++++++++
 .../register-config-mcp-pi-settings-routes.test.ts |  29 +++-
 .../register-config-mcp-pi-settings-routes.ts      |  17 ++-
 .../src/routes/register-project-routes.ts          |  14 +-
 .../concurrency-effective-limit-surfaces.test.ts   |  34 +++++
 .../src/__tests__/project-engine-manager.test.ts   |  19 +++
 .../__tests__/scheduler-workflow-cutover.test.ts   |   6 +-
 packages/engine/src/concurrency/concurrency.ts     |  23 ++-
 packages/engine/src/concurrency/hybrid-executor.ts |  35 ++++-
 .../engine/src/executor/create-spawn-agent-tool.ts |   8 +-
 packages/engine/src/project-engine-manager.ts      |  50 +++++--
 packages/engine/src/project-engine.ts              |  12 +-
 packages/engine/src/project/project-manager.ts     |  26 +++-
 packages/engine/src/runtimes/in-process-runtime.ts |  12 +-
 packages/engine/src/scheduler.ts                   |  31 ++--
 packages/engine/src/triage.ts                      |  15 +-
 48 files changed, 1028 insertions(+), 159 deletions(-)

Fusion-Task-Id: FN-9185
Fusion-Task-Lineage: 6294456c-d417-40a5-a5fa-2035c6b964a6
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-21 10:57:44 -07:00
Fusion Agent
c91e5ce42d FN-106: prevent workspace finalization livelock
Repair workspace merge-boundary finalization so empty repository sets cannot loop indefinitely.

- Track workspace merge readiness and durable per-repository obligations.
- Gate landing and recovery on scope, blockers, leases, and checkout ownership.
- Preserve remediation state, add recovery paths, documentation, and regression coverage.

Files changed:
 .../fn-106-workspace-finalization-livelock.md      |  7 ++
 docs/architecture.md                               |  6 ++
 ...e-empty-merge-boundary-finalization-livelock.md | 40 ++++++++++
 docs/workflow-steps.md                             |  4 +
 packages/cli/src/commands/__tests__/task.test.ts   |  2 +
 ...workspace-worktrees-concurrent-merge.pg.test.ts | 23 ++++++
 packages/core/src/store.ts                         |  9 ++-
 packages/core/src/task-store/task-mutation-ops.ts  | 49 +++++++++++-
 packages/core/src/task-store/task-update.ts        |  6 +-
 packages/core/src/types/task/task-core.ts          |  7 ++
 .../engine/src/__tests__/executor-test-helpers.ts  |  6 ++
 .../executor-workspace-main-checkout-guard.test.ts |  8 +-
 .../executor-workspace-session-cwd.test.ts         | 37 +++++++++
 .../engine/src/__tests__/project-engine.test.ts    | 14 +++-
 .../src/__tests__/reviewer-workspace.test.ts       | 72 ++++++++++++++++-
 .../__tests__/workspace-merge-readiness.test.ts    | 46 +++++++++++
 .../workspace-merger-idempotency.slow.test.ts      | 15 ++--
 .../src/__tests__/workspace-merger-lease.test.ts   |  4 +-
 .../workspace-root-worktree-routing.test.ts        | 47 +++++++++++
 .../create-authoritative-workflow-seams.ts         |  2 +
 .../engine/src/executor/create-task-done-tool.ts   | 15 ++++
 .../executor/ensure-graph-custom-node-worktree.ts  |  8 ++
 .../request-pre-merge-optional-step-fix.ts         | 49 +++++++++++-
 .../engine/src/executor/run-graph-custom-node.ts   | 24 ++++--
 packages/engine/src/executor/run-implementation.ts |  9 +++
 packages/engine/src/executor/send-task-back-for-fix.ts  |  4 +-
 .../src/executor/workspace-main-checkout-guard.ts  | 26 +++++-
 .../src/executor/workspace-review-remediation.ts   | 54 +++++++++++++
 .../src/executor/worktree-verify-invariants.ts     |  2 +-
 packages/engine/src/merge/merger-ai.ts             | 93 +++++++++++++++++-----
 .../engine/src/merge/workspace-merge-readiness.ts  | 64 +++++++++++++++
 packages/engine/src/project-engine.ts              | 37 +++++++--
 packages/engine/src/self-healing.ts                | 54 ++++++++++---
 .../engine/src/worktree/worktree-acquisition.ts   | 20 ++++-
 34 files changed, 787 insertions(+), 76 deletions(-)

Fusion-Task-Id: FN-106

Fusion-Task-Lineage: 70b5c13d-9e17-419d-90ac-7258697657ef

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-21 14:41:37 +00:00
Fusion Agent
3717fc5af1 FN-107: block single-repository worktree acquisition
Prevent single-repository worktree acquisition from proceeding without explicit multi-repository workspace context.

- Require workspace-aware acquisition for single-repository tasks.
- Propagate acquisition origin and workspace configuration through executor, merger, and recovery paths.
- Add regression coverage, documentation, and a release changeset for the blocked behavior.

Files changed:
 .changeset/fn-107-single-repo-worktree.md          |   7 ++
 docs/architecture.md                               |   4 +
 docs/testing.md                                    |   4 +
 packages/core/src/branch/branch-assignment.ts      |  12 +++
 packages/core/src/index.gate.ts                    |   1 +
 packages/core/src/index.ts                         |   1 +
 packages/core/src/task-store/task-creation.ts      |   4 +-
 packages/core/src/task-store/task-update.ts        |   4 +-
 .../src/routes/register-planning-subtask-routes.ts |   1 +
 .../engine/src/__tests__/executor-test-helpers.ts  |  12 +++
 .../engine/src/__tests__/executor-worktree.test.ts |  44 ++++++---
 .../src/__tests__/node-worktree-isolation.test.ts  |   7 +-
 .../task-branch-write-origin-census.test.ts        |  49 ++++++++++
 .../worktree-acquisition-workspace.test.ts         |   6 +-
 .../src/__tests__/worktree-acquisition.test.ts     | 103 ++++++++++++++++++---
 .../engine/src/executor/handle-graph-failure.ts    |  16 +++
 .../src/executor/workspace-config-resolver.ts      |   1 +
 .../executor/worktree-branch-conflict-handle.ts    |   1 +
 packages/engine/src/merger.ts                      |   3 +-
 packages/engine/src/self-healing.ts                |   6 +
 .../self-healing/auto-recover-worktree-session.ts  |  10 +-
 .../src/workflows/workflow-graph-executor.ts       |   7 +-
 .../engine/src/worktree/worktree-acquisition.ts    |  73 +++++++++++++-
 23 files changed, 334 insertions(+), 42 deletions(-)

Fusion-Task-Id: FN-107

Fusion-Task-Lineage: 80df9dae-59a0-416e-8a02-6ab2dba9bb00

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-21 14:41:37 +00:00
Fusion Agent
bbca7a1ffc FN-094: add mono- and multi-repository lifecycle parity
Extend workspace lifecycle behavior so mono-repository and multi-repository tasks share the same durable scope, workflow, review, and merge semantics.

- Add repository-scope persistence, migrations, serialization, and task mutation support.
- Align dashboard task creation, detail, and workspace worktree views with repository-aware lifecycle state.
- Extend executor, reviewer, merger, triage, and self-healing paths with parity coverage and tests.
- Document the lifecycle contract and publish the operator-facing changeset.

Files changed:
 .changeset/fn-094-multi-repository-lifecycle.md    |   7 +
 docs/agents.md                                     |   8 +
 docs/architecture.md                               |   6 +
 docs/dashboard-guide.md                            |   4 +
 docs/multi-project.md                              |   6 +
 docs/settings-reference.md                         |   2 +-
 docs/testing.md                                    |  12 ++
 docs/workspaces.md                                 |   6 +
 ...workspace-worktrees-concurrent-merge.pg.test.ts |  19 +++
 packages/core/src/index.ts                         |   2 +-
 .../core/src/postgres/migrations/0000_initial.sql  |   1 +
 .../0064_fn_094_task_repository_scope.sql          |   2 +
 packages/core/src/postgres/schema-applier.ts       |  13 +-
 packages/core/src/postgres/schema/project.ts       |   2 +
 packages/core/src/store.ts                         |  21 ++-
 .../core/src/task-store/branch-and-pr-entities.ts  |   2 +-
 packages/core/src/task-store/persistence.ts        |   4 +-
 packages/core/src/task-store/serialization.ts      |   2 +
 packages/core/src/task-store/task-creation.ts      |  31 ++++
 packages/core/src/task-store/task-mutation-ops.ts  | 131 +++++++++++++++-
 packages/core/src/task-store/task-row-mappers.ts   |   2 +-
 packages/core/src/task-store/task-update.ts        |  55 +++++--
 packages/core/src/tasks/repository-scope.ts        |  29 ++++
 packages/core/src/types.ts                         |   4 +
 packages/core/src/types/task/task-core.ts          |  35 ++++-
 packages/core/src/types/workflow/workflow-steps.ts |  21 +++
 packages/dashboard/app/api/tasks/tasks.ts          |  14 ++
 packages/dashboard/app/components/NewTaskModal.tsx |  16 +-
 .../dashboard/app/components/TaskDetailModal.css   |  27 ++++
 .../dashboard/app/components/TaskDetailModal.tsx   |  15 +-
 .../app/components/WorkspaceWorktreesSummary.tsx   |  68 ++++++++-
 .../app/components/__tests__/NewTaskModal.test.tsx |   1 +
 .../__tests__/WorkspaceWorktreesSummary.test.tsx   |  27 +++-
 .../src/routes/register-task-workflow-routes.ts    |  48 ++++++
 .../__tests__/executor-workspace-taskdone.test.ts  |  20 +++
 .../src/__tests__/reviewer-workspace.test.ts       | 170 ++++++++++++++++++++-
 .../src/__tests__/self-healing-workspace.test.ts   |   4 +
 .../workflow-graph-optional-group.test.ts          |  32 ++++
 .../workflow-graph-optional-step-fix.test.ts       |  58 +++++++
 .../engine/src/__tests__/workspace-e2e.test.ts     |  91 ++++++++++-
 .../__tests__/workspace-lifecycle-parity.test.ts   |  61 ++++++++
 .../src/__tests__/workspace-merger-lease.test.ts   |  25 +++
 .../__tests__/workspace-merger-scope-gates.test.ts |  58 +++++++
 .../engine/src/__tests__/workspace-merger.test.ts  |  59 ++++++-
 packages/engine/src/agent-tools.ts                 |  92 ++++++++++-
 packages/engine/src/execution/reviewer.ts          |  10 +-
 .../create-authoritative-workflow-seams.ts         |  95 ++++++++++--
 .../engine/src/executor/execute-workflow-graph.ts  |  37 ++++-
 .../request-pre-merge-optional-step-fix.ts         |  70 +++++++++
 .../engine/src/executor/run-graph-custom-node.ts   | 124 ++++++++++-----
 .../engine/src/executor/workflow-step-verdict.ts   |   6 +-
 .../src/executor/workspace-review-per-repo.ts      | 118 +++++++++++++-
 .../src/executor/worktree-task-done-scope-leak.ts  | 109 ++++++++++++-
 packages/engine/src/merge/merger-ai.ts             |  88 ++++++++++-
 packages/engine/src/self-healing.ts                |  19 ++-
 packages/engine/src/triage.ts                      |   9 ++
 .../src/workflows/workflow-graph-executor.ts       |  73 +++++++--
 .../engine/src/workflows/workflow-node-handlers.ts |  12 +-
 58 files changed, 1962 insertions(+), 121 deletions(-)

Fusion-Task-Id: FN-094

Fusion-Task-Lineage: 483f958f-cc67-474e-9383-26856c329543

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-21 04:35:58 +00:00
Fusion Agent
926dda6fc7 FN-078: repair multi-repository workspace merge coordination
Keep long-running workspace land operations live and enforce repository-local scope isolation.

- Renew workspace land leases throughout dependency sync, AI merge, push, and intent resolution.
- Abort stale land bodies before durable or remote commit points and fence lease-dependent writes.
- Centralize repository File Scope resolution across squash, completion, and checkout guards.
- Add regression coverage, architecture documentation, and a patch changeset.

Files changed:
 .changeset/fn-078-workspace-lease-and-scope.md     |   7 +
 docs/architecture.md                               |   3 +-
 .../executor-workspace-main-checkout-guard.test.ts |  13 ++
 .../__tests__/executor-workspace-taskdone.test.ts  |  21 +++
 .../src/__tests__/workspace-merger-lease.test.ts   | 195 ++++++++++++++++++++-
 .../src/executor/workspace-main-checkout-guard.ts  |   4 +-
 .../src/executor/worktree-task-done-scope-leak.ts  |   4 +-
 .../engine/src/merge/merger-ai-squash-gates.ts    |   9 +-
 packages/engine/src/merge/merger-ai.ts             |  55 +++++-
 packages/engine/src/worktree/workspace-paths.ts   |  26 +++
 10 files changed, 321 insertions(+), 16 deletions(-)

Fusion-Task-Id: FN-078

Fusion-Task-Lineage: 8ddfa438-d6c0-4d3a-972a-3594bfc05ffb

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-21 04:32:53 +00:00
Fusion Agent
be34be7430 FN-073: prevent durable blocks from missing dependencies
Reconcile missing dependency references so task completion and self-healing do not leave durable lifecycle blocks.

- Validate and repair dependency references during task creation and lifecycle operations.
- Reconcile missing dependencies during self-healing and preserve honest blocked completion behavior.
- Add PostgreSQL and executor regression coverage and document the recovery behavior.

Files changed:
docs/task-management.md                            |   5 +-
packages/core/src/__tests__/postgres/task-dependency-mutation.pg.test.ts   | 124 ++++++++++++++++++++
packages/core/src/task-store/archive-lifecycle-2.ts     |  71 +++++++++++-
packages/core/src/task-store/async/async-lifecycle.ts   |  19 ++++
packages/core/src/task-store/project-store-ops.ts  |  46 +++++++-
packages/core/src/task-store/task-creation.ts      |  43 ++++++-
packages/engine/src/__tests__/executor-task-done-blocked.test.ts   |  65 ++++++++++-
packages/engine/src/__tests__/missing-dependency-reconcile.test.ts |  63 +++++++++++
packages/engine/src/executor/create-task-done-tool.ts   |  25 ++++-
packages/engine/src/self-healing.ts                |  58 ++++++++++
10 files changed, 502 insertions(+), 17 deletions(-)

Fusion-Task-Id: FN-073

Fusion-Task-Lineage: 863a07f9-a9d4-4195-b09a-a318689c6382

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-21 04:32:52 +00:00
gsxdsm
07be287e32 FN-9175: isolate engine run-audit emitters
Make run-audit telemetry best-effort across engine lifecycle paths.

- centralize bounded sink handling for absent, throwing, rejecting, hanging, and late-settling audit writers
- route merger, recovery, scheduler, plugin, mission, project, and run-auditor emissions through the shared seam
- add hostile-sink regression coverage, emitter routing checks, documentation, and a patch changeset

Files changed:
 .../fn-9175-non-executor-run-audit-isolation.md    |   7 +
 AGENTS.md                                          |   7 +-
 docs/run-audit.md                                  |   4 +-
 .../src/__tests__/emit-bounded-run-audit.test.ts   |  31 ++-
 ...on-executor-run-audit-emitter-isolation.test.ts |  29 +++
 .../non-executor-run-audit-sink-health.test.ts     | 280 +++++++++++++++++++++
 packages/engine/src/__tests__/self-healing.test.ts |   7 +-
 .../engine/src/executor/emit-bounded-run-audit.ts  |  52 +---
 packages/engine/src/logger.ts                      |   3 +
 packages/engine/src/merge/merger-ai.ts             |  47 ++--
 packages/engine/src/merge/pr-reconcile.ts          |   5 +-
 packages/engine/src/merger.ts                      |  41 +--
 .../engine/src/missions/mission-execution-loop.ts  |   5 +-
 packages/engine/src/plugins/plugin-runner.ts       |   9 +-
 packages/engine/src/project-engine.ts              |  55 ++--
 packages/engine/src/scheduler.ts                   |  17 +-
 packages/engine/src/self-healing.ts                |  39 +--
 packages/engine/src/util/emit-bounded-run-audit.ts |  69 +++++
 packages/engine/src/util/run-audit.ts              |   9 +-
 19 files changed, 564 insertions(+), 152 deletions(-)

Fusion-Task-Id: FN-9175
Fusion-Task-Lineage: bf74cd37-19bd-4d99-a5d6-b05a4bb43576
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-19 22:37:12 -07:00
gsxdsm
e40bcebc27 FN-9161: support operator workspace branches
Allow workspace tasks to use one operator-selected branch consistently across every sub-repository while preserving ownership during recovery.

- validate and persist operator branch provenance at task creation and update boundaries
- reuse custom branches across workspace worktrees, PR flows, cleanup, and self-healing without deleting operator-owned refs
- expose branch validation in task forms and document the workspace behavior
- add coverage and a release changeset for shared custom branch handling

Files changed:
 .changeset/fn-9161-workspace-custom-branch.md      |  7 ++
 docs/workspaces.md                                 |  6 ++
 packages/cli/src/commands/pr.ts                    | 10 ++-
 packages/cli/src/commands/task-lifecycle.ts        | 10 +--
 packages/cli/src/commands/task.ts                  |  4 +-
 packages/cli/src/extension.ts                      |  2 +-
 .../core/src/__tests__/branch-assignment.test.ts   | 37 ++++++++++
 .../task-update-awaiting-approval-reason.test.ts   |  8 +++
 .../core/src/async-stores/async-mission-store.ts   |  1 +
 packages/core/src/branch/branch-assignment.ts      | 64 +++++++++++++++++
 packages/core/src/index.gate.ts                    |  7 ++
 packages/core/src/index.ts                         |  7 ++
 packages/core/src/missions/mission-store.ts        |  1 +
 packages/core/src/store.ts                         |  2 +-
 packages/core/src/task-store/branch-context.ts     | 35 +++++++--
 packages/core/src/task-store/merge-queue-ops.ts    | 31 ++++----
 packages/core/src/task-store/task-creation.ts      | 30 ++++++++
 packages/core/src/task-store/task-mutation-ops.ts  | 18 ++++-
 packages/core/src/task-store/task-update.ts        | 60 ++++++++++++++--
 packages/core/src/types.ts                         |  5 ++
 packages/core/src/types/task/task-core.ts          | 20 +++++-
 packages/dashboard/app/components/NewTaskModal.tsx | 25 +++++--
 packages/dashboard/app/components/TaskForm.tsx     | 18 ++++-
 .../app/components/__tests__/NewTaskModal.test.tsx | 12 ++++
 packages/dashboard/src/pr-conflict-resolver.ts     | 14 ++--
 packages/dashboard/src/routes/branch-selection.ts  |  7 ++
 .../dashboard/src/routes/register-git-github.ts    | 18 +++--
 .../src/routes/register-task-workflow-routes.ts    | 17 ++++-
 .../engine/src/__tests__/worktree-hooks.test.ts    |  6 ++
 .../engine/src/__tests__/worktree-pool.test.ts     |  8 +++
 .../src/auto-recovery-handlers/branch-worktree.ts  | 20 +++---
 .../engine/src/execution/step-session-executor.ts  |  6 +-
 .../src/executor/build-foreach-worktree-deps.ts    |  5 +-
 .../engine/src/executor/create-task-done-tool.ts   |  8 +--
 packages/engine/src/executor/dep-abort-cleanup.ts  |  4 +-
 packages/engine/src/executor/mark-stuck-aborted.ts |  2 +-
 .../src/executor/release-pre-execution-worktree.ts |  2 +-
 packages/engine/src/executor/run-implementation.ts | 14 ++--
 .../src/executor/task-done-refusal-handler.ts      |  4 +-
 .../executor/worktree-branch-conflict-handle.ts    | 10 +--
 .../src/executor/worktree-cleanup-conflicting.ts   | 39 +++++-----
 .../src/executor/worktree-create-conflict.ts       |  1 +
 .../engine/src/executor/worktree-stale-branch.ts   |  9 +++
 .../src/healing/restart-recovery-coordinator.ts    |  2 +-
 packages/engine/src/merger.ts                      | 33 +++++----
 .../src/recovery/foreign-only-contamination.ts     |  8 ++-
 packages/engine/src/self-healing.ts                | 82 +++++++++++++++-------
 .../engine/src/worktree/worktree-acquisition.ts    | 52 ++++++++++----
 packages/engine/src/worktree/worktree-backend.ts   | 42 ++++++++---
 packages/engine/src/worktree/worktree-hooks.ts     | 24 +++++--
 packages/engine/src/worktree/worktree-names.ts     | 13 ++++
 packages/engine/src/worktree/worktree-pool.ts      | 17 ++++-
 52 files changed, 708 insertions(+), 179 deletions(-)

Fusion-Task-Id: FN-9161

Fusion-Task-Lineage: 5b0b9ecc-bead-471f-96f7-bec6698b69fc

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-19 21:42:29 -07:00
Fusion Agent
7563fcfe1b FN-037: configure AI-authored task output language
Configure a persisted output-language setting and apply it across AI-authored task text and workflow summaries.

- Add project/global output-language settings with defaults, validation, UI controls, translations, and documentation.
- Propagate the selected language through planning, execution, review, summaries, and task creation.
- Add focused coverage for language resolution and update affected dashboard, engine, and localization tests.

Files changed:
 .changeset/fn-037-task-output-language.md          |   7 ++
 docs/settings-reference.md                         |   4 +
 docs/task-management.md                            |   4 +
 .../core/src/__tests__/ai-output-language.test.ts  |  21 +++++
 packages/core/src/ai/ai-output-language.ts         |  42 +++++++++
 packages/core/src/ai/ai-summarize.ts               |  16 +++-
 packages/core/src/config/settings-schema.ts        |   2 +
 packages/core/src/index.gate.ts                    |   2 +
 packages/core/src/index.ts                         |   2 +
 packages/core/src/task-store/settings-ops.ts       |   7 ++
 packages/core/src/task-store/task-creation.ts      |   4 +
 packages/core/src/types/settings/settings-scope.ts |   2 +
 .../app/__tests__/settings-sections.test.tsx       |  21 +++--
 .../__tests__/SettingsModal.models-auth.test.tsx   |  10 +-
 .../app/components/settings/section-keys.ts        |   2 +-
 .../sections/ProjectModelsSection.search.ts        |  13 ++-
 .../settings/sections/ProjectModelsSection.tsx     |  28 ++++--
 .../settings-default-descriptions.test.tsx         |   4 +-
 .../src/__tests__/github-tracking.test.ts          |   4 +-
 .../__tests__/planning-prompt-resolution.test.ts   |  29 ++++--
 .../src/__tests__/routes-planning.test.ts          |  32 ++++++-
 packages/dashboard/src/ai-session-store.ts         |  15 ++-
 packages/dashboard/src/github-tracking.ts          |   3 +
 packages/dashboard/src/planning.ts                 |  75 +++++++++++++--
 .../routes/register-ai-text-assistant-routes.ts    |  11 ++-
 .../src/routes/register-planning-subtask-routes.ts |   6 +-
 .../src/routes/register-task-workflow-routes.ts    |   9 +-
 packages/dashboard/src/shared/settings-sections.ts |   2 +-
 .../__tests__/ce-workflow-step-executor.test.ts    |  45 ++++++++-
 .../__tests__/executor-review-artifacts.test.ts    |  65 +++++++++++++
 packages/engine/src/__tests__/triage.test.ts       |   7 +-
 .../src/__tests__/workflow-task-runtime.test.ts    |  23 +++++
 .../create-authoritative-workflow-primitives.ts    |  14 ++-
 .../create-authoritative-workflow-seams.ts         |  17 +++-
 .../engine/src/executor/execute-workflow-graph.ts  |  19 +++-
 .../engine/src/executor/execute-workflow-step.ts   |  13 ++-
 packages/engine/src/executor/execution-prompt.ts   |  10 +-
 .../engine/src/executor/handoff-task-to-review.ts  |  10 +-
 .../engine/src/executor/run-graph-custom-node.ts   |   6 +-
 .../src/executor/task-executor-graph-facades.ts    |   8 +-
 packages/engine/src/triage.ts                      |  35 ++-----
 .../src/workflows/workflow-completion-summary.ts   | 101 ++++++++++++++++++---
 .../engine/src/workflows/workflow-task-runtime.ts  |  12 +++
 packages/i18n/locales/en/app.json                  |   7 +-
 packages/i18n/locales/es/app.json                  |   7 +-
 packages/i18n/locales/fr/app.json                  |   7 +-
 packages/i18n/locales/ko/app.json                  |   7 +-
 packages/i18n/locales/pt-BR/app.json               |  14 ++-
 packages/i18n/locales/zh-CN/app.json               |   7 +-
 packages/i18n/locales/zh-TW/app.json               |   7 +-
 packages/i18n/src/resources.d.ts                   |  13 ++-
 51 files changed, 680 insertions(+), 151 deletions(-)

Fusion-Task-Id: FN-037

Fusion-Task-Lineage: 968a707e-7ffe-43ba-b983-d679b031f7a5

Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-20 03:57:23 +00:00
Fusion Agent
bcc77c9608 FN-035: require automatic task recommendations
Require task recommendations to be explicitly enabled and consistently surfaced across execution and settings.

- Add the automatic task recommendations setting, persistence, validation, and localized UI copy.
- Gate executor recommendation prompts and completion-tool behavior on the setting.
- Update dashboard/API coverage, documentation, and regression tests.

Files changed:
 .changeset/fn-035-required-task-recommendations.md |  7 +++
 docs/dashboard-guide.md                            |  3 +-
 docs/settings-reference.md                         |  2 +
 .../postgres/settings-persistence.pg.test.ts       | 18 +++++++
 .../core/src/__tests__/settings-parity.test.ts     |  3 ++
 packages/core/src/config/settings-schema.ts        |  2 +
 packages/core/src/task-store/settings-ops.ts       | 16 ++++--
 packages/core/src/types/settings/settings-scope.ts |  8 +++
 .../app/__tests__/settings-save-split.test.ts      | 16 ++++++
 .../__tests__/SettingsModal.general.test.tsx       | 36 +++++++++++++
 .../app/components/settings/section-keys.ts        |  1 +
 .../settings/sections/GeneralSection.search.ts     | 10 ++++
 .../settings/sections/GeneralSection.tsx           | 15 +++++-
 .../settings-default-descriptions.test.tsx         |  2 +
 .../register-settings-memory-worktrunk.test.ts     | 28 ++++++++++
 .../src/routes/register-settings-memory-routes.ts  |  5 ++
 ...cutor-prompt-completion-recommendations.test.ts | 31 +++++++++++
 .../executor-task-recommendations.test.ts          | 61 ++++++++++++++++++++--
 .../engine/src/executor/create-task-done-tool.ts   | 18 +++++--
 packages/engine/src/executor/system-prompt.ts      | 20 +++++--
 packages/i18n/locales/en/app.json                  |  3 ++
 packages/i18n/locales/es/app.json                  |  3 ++
 packages/i18n/locales/fr/app.json                  |  3 ++
 packages/i18n/locales/ko/app.json                  |  3 ++
 packages/i18n/locales/pt-BR/app.json               |  5 +-
 packages/i18n/locales/zh-CN/app.json               |  3 ++
 packages/i18n/locales/zh-TW/app.json               |  3 ++
 packages/i18n/src/resources.d.ts                   |  3 ++
 28 files changed, 307 insertions(+), 21 deletions(-)

Fusion-Task-Id: FN-035
Fusion-Task-Lineage: 336d4d99-3105-43df-b82c-ca413b9c5892
Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-20 03:57:23 +00:00
Fusion Agent
3f85c4cf84 FN-034: route workspace tasks through repository worktrees
Route multi-repository planning and graph execution through declared repository worktrees instead of workspace roots.

- Acquire declared repository worktrees for planning and custom graph nodes.
- Filter planning coordinator selection to configured repositories and preserve workspace routing metadata.
- Add workspace worktree recovery, concurrency coverage, and release documentation.

Files changed:
 .changeset/fn-034-workspace-worktree-routing.md    |   7 ++
 docs/architecture.md                               |   1 +
 ...workspace-worktrees-concurrent-merge.pg.test.ts |  36 +++++++
 packages/core/src/store.ts                         |  10 ++
 packages/core/src/task-store/task-mutation-ops.ts  |  60 +++++++++++-
 .../executor-workspace-session-cwd.test.ts         |  29 ++++--
 packages/engine/src/__tests__/self-healing.test.ts |  17 ++--
 .../workspace-root-worktree-routing.test.ts        | 107 +++++++++++++++++++++
 .../create-authoritative-workflow-seams.ts         |  48 ++++++---
 .../executor/ensure-graph-custom-node-worktree.ts  |  45 +++++++-
 .../executor/ensure-task-worktree-for-planning.ts  |  38 ++++++--
 .../src/executor/reset-steps-if-work-lost.ts       |  12 ++-
 .../engine/src/executor/run-graph-custom-node.ts   |  83 ++++++++++++++--
 packages/engine/src/executor/run-implementation.ts |  59 ++++++++++--
 .../src/executor/workspace-config-resolver.ts      |  30 +++++-
 .../src/executor/workspace-review-per-repo.ts      |  29 +++++-
 .../executor/worktree-missing-session-recovery.ts  |  26 ++++-
 packages/engine/src/self-healing.ts                |  50 +++++++---
 .../self-healing/auto-recover-worktree-session.ts  |  31 +++++-
 .../engine/src/worktree/worktree-acquisition.ts    |  65 +++++++++++-
 20 files changed, 702 insertions(+), 81 deletions(-)

Fusion-Task-Id: FN-034
Fusion-Task-Lineage: 59c5f273-d676-4b7f-b006-c12dc6c3abe6
Co-authored-by: Fusion <noreply@runfusion.ai>
2026-08-20 03:56:41 +00:00
gsxdsm
3dea1bb851 FN-9172: isolate executor run-audit emissions
Keep executor lifecycle transitions moving when run-audit sinks fail or stall.

- Add a shared bounded, best-effort executor audit emission seam.
- Route executor lifecycle audit writes through sink isolation.
- Cover absent, throwing, rejecting, hanging, and late-settling sinks.
- Document the emitter policy and publish a patch changeset.

Files changed:
 .changeset/fn-9172-executor-run-audit-isolation.md |   7 +
 AGENTS.md                                          |   7 +
 docs/run-audit.md                                  |   6 +-
 .../src/__tests__/emit-bounded-run-audit.test.ts   |  58 +++++
 .../executor-run-audit-emitter-isolation.test.ts   | 252 +++++++++++++++++++++
 .../src/executor/acquire-session-registry-path.ts  |   5 +-
 .../engine/src/executor/completion-finalization.ts |   3 +-
 .../engine/src/executor/create-task-done-tool.ts   |   3 +-
 .../engine/src/executor/emit-bounded-run-audit.ts  |  48 ++++
 .../executor/emit-merge-boundary-unproven-audit.ts |  68 ++----
 .../engine/src/executor/execute-workflow-graph.ts  |   5 +-
 .../engine/src/executor/handle-graph-failure.ts    |  18 +-
 ...dle-stale-in-review-parse-pause-abort-replay.ts |   7 +-
 ...ndle-stale-in-review-plan-pause-abort-replay.ts |   7 +-
 .../maybe-dispatch-workflow-work-engine.ts         |   7 +-
 .../src/executor/no-merge-complete-column.ts       |   3 +-
 .../reenter-paused-aborted-workflow-node.ts        |   7 +-
 .../src/executor/required-artifact-recovery.ts     |   3 +-
 packages/engine/src/executor/run-implementation.ts |   5 +-
 19 files changed, 433 insertions(+), 86 deletions(-)

Fusion-Task-Id: FN-9172

Fusion-Task-Lineage: 80c67c36-3bbb-4274-ac4c-9808c4cda3ce

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-19 20:35:19 -07:00
gsxdsm
2a31505823 FN-9163: Add repositories to existing workspace tasks
Enable validated workspace membership additions and make active tasks discover new repositories safely.

- add idempotent direct-child Git repository validation and workspace configuration updates
- expose repository discovery and addition through Settings and dashboard API routes
- refresh workspace membership during acquisition while blocking additions after review or landing begins
- document the workflow and cover core, dashboard, and engine behavior with focused tests

Files changed:
 .changeset/fn-9163-workspace-add-repo.md           |   7 ++
 docs/dashboard-guide.md                            |   2 +
 docs/settings-reference.md                         |   2 +-
 docs/workspaces.md                                 |  12 +-
 .../core/src/__tests__/workspace-add-repo.test.ts  |  12 ++
 packages/core/src/git/git-repository.ts            |  68 ++++++++++-
 packages/core/src/index.gate.ts                    |   3 +
 packages/core/src/index.ts                         |   3 +
 packages/dashboard/app/api/agents/agents.ts        |  11 +-
 .../settings/sections/GeneralSection.tsx           |   3 +
 .../settings/sections/WorkspaceReposCard.css       |   6 +
 .../settings/sections/WorkspaceReposCard.tsx       |  46 ++++++++
 .../__tests__/workspace-repos-card.test.tsx        |  49 ++++++++
 .../src/__tests__/workspace-add-repo-route.test.ts |  65 ++++++++++
 .../dashboard/src/routes/register-git-github.ts    |  35 +++++-
 .../__tests__/workspace-add-repo-midflight.test.ts | 131 +++++++++++++++++++++
 packages/engine/src/agent-tools.ts                 |  27 ++++-
 packages/engine/src/executor/deps-bags.ts          |  44 ++++++-
 packages/engine/src/executor/run-implementation.ts |   2 +
 19 files changed, 512 insertions(+), 16 deletions(-)

Fusion-Task-Id: FN-9163

Fusion-Task-Lineage: 7456f55f-b7c8-4076-994f-42994d8babb0

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-19 19:59:04 -07:00
gsxdsm
3b0a6b795f FN-9162: Group workspace worktrees under configurable roots
Configure collision-safe workspace and repository subfolders beneath custom worktree roots.

- add shared workspace layout helpers and export them through runtime and gate barrels
- route acquisition, pinning, cleanup, archive, and extension discovery through grouped paths
- allow absolute worktree roots in settings and document the workspace layout
- protect shared-root containers from destructive sweeps and cover multi-repository behavior

Files changed:
 .changeset/fn-9162-workspace-worktree-root.md      |   7 ++
 docs/settings-reference.md                         |   2 +-
 docs/workspaces.md                                 |   6 ++
 .../extension-workspace-worktree-root.test.ts      |  81 +++++++++++++++++
 packages/cli/src/extension.ts                      |  53 ++++++++++-
 packages/core/src/__tests__/pi-extensions.test.ts  |  46 +++++++++-
 .../core/src/__tests__/worktree-layout.test.ts     |  49 ++++++++++
 packages/core/src/index.gate.ts                    |  13 +++
 packages/core/src/index.ts                         |   9 ++
 packages/core/src/plugins/pi-extensions.ts         |  12 ++-
 packages/core/src/task-store/archive-lifecycle.ts  |  11 +--
 packages/core/src/tasks/worktree-layout.ts         |  77 ++++++++++++++++
 .../dashboard/app/components/SettingsModal.tsx     |   4 +-
 .../settings/sections/WorktreesSection.tsx         |   2 +-
 .../worktree-acquisition-workspace.test.ts         |  55 ++++++++++-
 .../engine/src/__tests__/worktree-paths.test.ts    |  19 +++-
 .../engine/src/__tests__/worktree-pinning.test.ts  |  17 ++++
 .../engine/src/__tests__/worktree-pool.test.ts     |  19 +++-
 .../src/executor/workspace-main-checkout-guard.ts  |   2 +-
 packages/engine/src/self-healing.ts                |  20 +++-
 .../engine/src/worktree/worktree-acquisition.ts    | 101 +++++++++++++++------
 packages/engine/src/worktree/worktree-names.ts     |  14 +--
 packages/engine/src/worktree/worktree-paths.ts     |  75 ++++++++++++---
 packages/engine/src/worktree/worktree-pinning.ts   |  10 +-
 packages/engine/src/worktree/worktree-pool.ts      |  44 ++++++---
 25 files changed, 656 insertions(+), 92 deletions(-)

Fusion-Task-Id: FN-9162

Fusion-Task-Lineage: b5f5e247-577c-4357-9ffe-97e2447b4fd4

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-19 19:46:35 -07:00
gsxdsm
5ba0b0cffc FN-9168: Record terminal merge-boundary parks in run audit
Add failure-isolated audit visibility for merge-boundary proof failures without changing terminal park behavior.

- Emit a redacted event from retry-boundary and graph-terminal park paths.
- Bound audit sink latency and isolate absent, throwing, rejecting, or hung sinks.
- Add reason-code coverage, catalogue documentation, and a patch changeset.

Files changed:
 .changeset/fn-9168-merge-boundary-audit.md         |  7 ++
 AGENTS.md                                          |  1 +
 docs/run-audit.md                                  |  1 +
 .../src/__tests__/executor-graph-boundary.test.ts  | 33 ++++++---
 .../__tests__/merge-boundary-unproven-park.test.ts | 78 +++++++++++++++++++-
 .../executor/emit-merge-boundary-unproven-audit.ts | 82 ++++++++++++++++++++++
 .../engine/src/executor/handle-graph-failure.ts    | 23 +++++-
 .../executor/route-graph-merge-failure-to-retry.ts | 36 +++++++++-
 .../engine/src/executor/workflow-merge-boundary.ts | 38 ++++++++--
 .../engine/src/run-audit/run-audit-catalogue.ts    |  5 +-
 packages/engine/src/util/run-audit.ts              | 10 +++
 11 files changed, 293 insertions(+), 21 deletions(-)

Fusion-Task-Id: FN-9168

Fusion-Task-Lineage: cdeb5c1f-4b22-4531-878e-b18955e6ea5a

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-19 19:34:53 -07:00
gsxdsm
7b55a02e51 FN-9157: fix workflow merge boundary proof and retry routing
Make workflow merge admission accept valid foreach completion and terminate retries when proof is unavailable.

- Treat fully terminal live foreach steps as implementation proof for Review Level 0 workflows.
- Preserve merge-boundary-unproven as a terminal graph failure and park blocked retries visibly.
- Add unit, graph-boundary, and PostgreSQL regression coverage plus operator documentation and a patch changeset.

Files changed:
 .changeset/fn-9157-merge-boundary.md               |  7 +++
 docs/architecture.md                               |  4 ++
 docs/workflow-steps.md                             |  6 ++
 .../src/__tests__/workflow-merge-proof.test.ts     | 11 +++-
 packages/core/src/workflow-merge-proof.ts          | 20 +++++--
 .../src/__tests__/executor-graph-boundary.test.ts  | 64 +++++++++++++++++++++-
 ...xecutor-merge-boundary-foreach-proof.pg.test.ts | 10 ++++
 .../__tests__/merge-boundary-unproven-park.test.ts | 48 ++++++++++++++++
 .../create-authoritative-workflow-primitives.ts    | 13 ++++-
 .../create-authoritative-workflow-seams.ts         |  6 +-
 .../executor/evaluate-workflow-merge-boundary.ts   | 18 +++++-
 .../executor/route-graph-merge-failure-to-retry.ts | 26 ++++++++-
 packages/engine/src/executor/task-predicates.ts    |  2 +
 .../engine/src/executor/workflow-merge-boundary.ts | 29 +++++++---
 .../engine/src/workflows/workflow-merge-nodes.ts   | 13 +++++
 15 files changed, 253 insertions(+), 24 deletions(-)

Fusion-Task-Id: FN-9157

Fusion-Task-Lineage: 7c68dfe2-28fb-4353-9ae6-df0ddbaf799a

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-19 18:16:49 -07:00
gsxdsm
9f5f981e33 FN-9114: expose enabled skills and enforce agent skill reads
Make project-enabled skills available across agent sessions while preserving explicit per-agent skills as observable read-first requirements.

- resolve all enabled discovered skills without using agent metadata as an availability filter
- carry forced skill intent through PI, plugin, chat, workflow, merger, and heartbeat session paths
- report resolved and unavailable forced skills in session summaries and diagnostics
- document the updated skill model and add release notes and regression coverage

Files changed:
 .changeset/fn-9114-forced-skills.md                |   7 +
 docs/PLUGIN_AUTHORING.md                           |   2 +-
 docs/agents.md                                     |  10 +-
 docs/diagnostics.md                                |   2 +-
 docs/settings-reference.md                         |   2 +-
 packages/core/src/__tests__/skill-settings.test.ts |   9 +
 .../dashboard/src/__tests__/chat-manager.test.ts   |  26 ++-
 packages/dashboard/src/chat.ts                     |  10 +
 .../engine/src/__tests__/agent-skills-flow.test.ts |  14 +-
 .../compound-engineering-skill-resolution.test.ts  |   2 +-
 .../engine/src/__tests__/heartbeat-skills.test.ts  |  41 ++++
 .../__tests__/hermes-runtime-integration.test.ts   |  63 +++++-
 .../engine/src/__tests__/merger-skills.test.ts     |  33 ++-
 packages/engine/src/__tests__/pi.test.ts           |  35 ++-
 .../__tests__/plugin-skill-body-delivery.test.ts   |   8 +-
 .../src/__tests__/plugin-skill-integration.test.ts |   3 +-
 .../src/__tests__/session-skill-context.test.ts    |  40 ++--
 .../engine/src/__tests__/skill-resolver.test.ts    |  38 +++-
 .../__tests__/step-execute-skill-loading.test.ts   |   6 +
 packages/engine/src/agents/agent-runtime.ts        |   2 +
 .../engine/src/agents/agent-session-helpers.ts     |  88 ++++++-
 .../src/cli-runtime/session-skill-context.ts       | 117 ++++------
 packages/engine/src/cli-runtime/skill-resolver.ts  | 252 +++++++++------------
 .../engine/src/executor/execute-workflow-step.ts   |  14 ++
 packages/engine/src/executor/run-implementation.ts |   5 +
 packages/engine/src/pi.ts                          |  28 ++-
 26 files changed, 576 insertions(+), 281 deletions(-)

Fusion-Task-Id: FN-9114

Fusion-Task-Lineage: fe63ebd1-f947-40d7-be7b-c13d7f1c35c9

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-15 21:57:22 -07:00
gsxdsm
66bbeaa28d FN-9108: Restore routed workflow-principal session identity
Restore routed principal attribution throughout workflow prompt and review sessions.

- Thread the graph-selected principal into workflow-step execution.
- Resolve principal runtime configuration, skills, telemetry, and session attribution consistently.
- Fail closed when the routed principal is unavailable and add regression coverage.
- Add a patch changeset for the restored behavior.

Files changed:
 .../fn-9108-workflow-principal-session-identity.md |   7 +
 .../executor-workflow-step-principal.test.ts       | 154 +++++++++++++++++++++
 .../engine/src/executor/execute-workflow-step.ts   |  34 ++++-
 .../engine/src/executor/run-graph-custom-node.ts   |  11 +-
 4 files changed, 198 insertions(+), 8 deletions(-)

Fusion-Task-Id: FN-9108

Fusion-Task-Lineage: ec668551-8ff4-4ced-8c7f-a4aa04eb044f

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-15 17:45:32 -07:00
gsxdsm
802a4249fb FN-9106: Route non-continuable step sessions through retry recovery
Recover poisoned step-session transcripts before the generic failure sink can retain them.

- Apply bounded fresh-session recovery to incomplete step-session execution failures.
- Preserve completed-work handling ahead of retry classification.
- Add regression coverage and production-shaped executor fixtures.
- Document the published patch behavior in a changeset.

Files changed:
 .changeset/fn-9106-non-continuable-step-session.md |  7 ++++
 .../post-done-continuation-no-wedge.test.ts        | 48 +++++++++++++++++++++-
 packages/engine/src/executor/run-implementation.ts | 11 +++++
 3 files changed, 65 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-9106

Fusion-Task-Lineage: 537ea415-96dd-4b66-ab5d-84dc4603388b

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-15 17:13:20 -07:00
gsxdsm
5e5b0dbb8f FN-9098: bridge scoped Fusion tools into Cursor
Publish engine-owned Fusion tools to Cursor through a crash-safe, worktree-scoped MCP bridge.

- preserve operator MCP configuration with locking, journaling, quarantine, and lease reconciliation
- enforce identity-scoped fn_* provenance so injected custom and MCP tools are never exposed
- secure loopback dispatch with per-session tokens, heartbeats, cleanup, and normalized tool events
- document the Cursor contract and cover bridge lifecycle, config hygiene, and failure handling

Files changed:
 .changeset/fn-9098-cursor-mcp-bridge.md            |   7 +
 docs/cursor-cli-contract.md                        | 140 ++-------------
 docs/mcp.md                                        |   4 +
 .../src/__tests__/agent-session-helpers.test.ts    |  24 +++
 .../src/__tests__/step-session-executor.test.ts    |  16 ++
 .../src/__tests__/web-fetch-universal.test.ts      |   4 +-
 packages/engine/src/agent-heartbeat.ts             |   3 +-
 packages/engine/src/agents/agent-runtime.ts        |   9 +
 .../engine/src/agents/agent-session-helpers.ts     |  26 +--
 packages/engine/src/execution/reviewer.ts          |   1 +
 .../engine/src/execution/step-session-executor.ts  |  31 ++--
 .../engine/src/executor/execute-workflow-step.ts   |   4 +-
 packages/engine/src/merger.ts                      |   4 +-
 plugins/fusion-plugin-cursor-runtime/README.md     |  18 +-
 plugins/fusion-plugin-cursor-runtime/package.json  |   2 +-
 .../src/__tests__/cursor-mcp-config.test.ts        | 100 +++++++++++
 .../cursor-mcp-server-failure.stream.jsonl         |   3 +
 .../fixtures/cursor-mcp-tool-call.stream.jsonl     |   4 +
 .../src/__tests__/runtime-adapter.test.ts          |  57 +++++-
 .../src/__tests__/worktree-hygiene.test.ts         |  52 ++++++
 .../src/cursor-mcp-config.ts                       | 196 +++++++++++++++++++++
 .../src/mcp-schema-server.cjs                      | 155 ++++++++++++++++
 .../src/prompt-transport.ts                        |   4 +-
 .../src/runtime-adapter.ts                         |  67 +++++--
 .../src/tool-bridge.ts                             |  48 +++++
 .../src/tool-mapping.ts                            |  11 ++
 plugins/fusion-plugin-cursor-runtime/src/types.ts  |   6 +-
 .../src/worktree-hygiene.ts                        | 117 ++++++++++++
 28 files changed, 934 insertions(+), 179 deletions(-)

Fusion-Task-Id: FN-9098

Fusion-Task-Lineage: 11b6cb10-ce0e-4f33-9007-c83f2bbf82ea

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-15 16:51:54 -07:00
gsxdsm
56a087dac9 fix(engine): restore shipped behaviors dropped by the wave-18 executor peel
Full-suite repair, engine harness cluster (~85 red suites). Two causes:
(1) graph dispatch now fails closed without options.agentStore
(FN-8764/FN-8821, intended) — the shared executor test harness now
provisions the workflow-routing agent-store fixture for bare
TaskExecutor constructions, with explicit opt-out for the two tests
asserting the fail-closed park; (2) the wave-18 'pure peel' (#3317)
rebuilt executor.ts from a stale base and silently deleted shipped
behaviors, restored here: FN-8864 agent-activity writers (task
started/handed-off, workflow gate pass/fail, gate principal attribution
via executor/workflow-gate-activity.ts), FN-8768 Plan Review group
recognition, convergence primer, and modified-file review scoping,
FN-6782's fire-time guard on transient resume-after-restart retries,
FN-8868 session usage telemetry boundaries, recommendation-route
withheld-tool guidance, and the per-instance worktree retry cap.
Stale expectations updated for intended changes (FN-8823 shared-member
hold, FN-9060 zero-acquire fail-closed, heartbeat tool inventory,
peeled-module seams, PG harness provisioning). Verified: 23 files /
711 tests green, engine typecheck clean, merge gate green.

Known follow-ups (not addressed here): step-session error routing may
still bypass FN-5866 non-continuable classification
(post-done-continuation-no-wedge red), scheduler mission-loop trigger
gap (mission-validation-trigger-gap red), and executeWorkflowStep lost
routed workflow-principal session identity threading (untested drop
from the same peel).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-15 15:52:52 -07:00
gsxdsm
43889bc684 FN-9058: block workspace main-checkout edits
Prevent workspace tasks from completing after task-era edits in configured sub-repository main checkouts.

- Detect dirty and recent commit evidence across every workspace main checkout before invariant checks.
- Block attributable edits with bounded retries while warning safely for inconclusive evidence.
- Add audit telemetry, documentation, changeset, and real-git regression coverage.

Files changed:
 .../fn-9058-workspace-main-checkout-guard.md       |   7 +
 AGENTS.md                                          |   1 +
 docs/architecture.md                               |   1 +
 .../engine/src/__tests__/_workspace-fixture.ts     |   3 +-
 .../executor-workspace-main-checkout-guard.test.ts | 164 +++++++++++++++++++++
 packages/engine/src/executor/execution-prompt.ts   |   3 +-
 .../src/executor/workspace-main-checkout-guard.ts  | 128 ++++++++++++++++
 .../src/executor/worktree-verify-invariants.ts     |  45 +++++-
 packages/engine/src/util/run-audit.ts              |   2 +
 9 files changed, 351 insertions(+), 3 deletions(-)

Fusion-Task-Id: FN-9058

Fusion-Task-Lineage: b5dd58bd-4bd9-41fd-b3d5-e07270f3abca

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-15 00:41:44 -07:00
gsxdsm
6896f1d7f3 FN-9045: wire workspace mode toggle to workspace config
Connect workspace-mode settings updates to the runtime workspace configuration lifecycle.

- Synchronize workspace.json and config.json when workspace mode changes.
- Reconcile settings events and executor state after successful or failed toggles.
- Add dashboard route, UI copy, localization, documentation, and regression coverage.

Files changed:
 .changeset/fn-9045-workspace-mode-toggle.md        |   7 +
 docs/settings-reference.md                         |   2 +-
 .../settings-workspace-toggle-side-effect.test.ts  | 178 +++++++++++++++++++++
 .../src/__tests__/workspace-mode-toggle.test.ts    |  71 ++++++++
 packages/core/src/git/git-repository.ts            | 147 ++++++++++++++++-
 packages/core/src/index.gate.ts                    |   6 +
 packages/core/src/index.ts                         |   6 +
 packages/core/src/task-store/settings-ops.ts       |  86 +++++++++-
 packages/core/src/types/settings/settings-scope.ts |  11 +-
 .../settings/sections/GeneralSection.tsx           |  10 +-
 .../settings-workspace-mode-route.test.ts          | 148 +++++++++++++++++
 .../src/routes/register-settings-memory-routes.ts  |  18 +++
 .../executor-workspace-toggle-invalidation.test.ts |  64 ++++++++
 .../engine/src/executor/task-executor-state.ts     |   6 +
 .../src/executor/workspace-config-resolver.ts      |  16 +-
 packages/engine/src/runtimes/in-process-runtime.ts |  12 ++
 packages/i18n/locales/en/app.json                  |   2 +-
 packages/i18n/locales/es/app.json                  |   4 +-
 packages/i18n/locales/fr/app.json                  |   4 +-
 packages/i18n/locales/ko/app.json                  |   4 +-
 packages/i18n/locales/pt-BR/app.json               |   4 +-
 packages/i18n/locales/zh-CN/app.json               |   4 +-
 packages/i18n/locales/zh-TW/app.json               |   4 +-
 23 files changed, 791 insertions(+), 23 deletions(-)

Fusion-Task-Id: FN-9045

Fusion-Task-Lineage: e382726f-8409-4983-94ef-93f341a6adbf

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-14 23:33:36 -07:00
gsxdsm
db8e715452 FN-9056: reclaim safe terminal workspace worktrees
Reclaim safely abandoned workspace worktrees and canonical task branches without disrupting live or recoverable tasks.

- Tear down eligible complete, idle failed, and soft-deleted per-repository worktrees with bounded retries.
- Veto live, paused, scheduled-recovery, ambiguous, and unsafe-path cleanup candidates.
- Verify failed-task landing evidence against each repository integration branch before deleting canonical branches.
- Cover liveness and stale landed-SHA safety regressions.

Files changed:
 .changeset/fn-9056-workspace-terminal-teardown.md  |   7 +
 AGENTS.md                                          |   2 +-
 docs/architecture.md                               |   1 +
 .../src/__tests__/self-healing-workspace.test.ts   | 319 ++++++++++++++++++++-
 .../engine/src/executor/cleanup-task-worktree.ts   |   8 +-
 packages/engine/src/self-healing.ts                | 268 ++++++++++++-----
 packages/engine/src/util/run-audit.ts              |   7 +-
 7 files changed, 525 insertions(+), 87 deletions(-)

Fusion-Task-Id: FN-9056

Fusion-Task-Lineage: 4353f7d9-063b-442b-88d3-6f3da1c9aae8

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-14 23:14:19 -07:00
gsxdsm
ebd345da0f FN-9060: reconcile zero-acquire workspace completion reviews
Align workspace completion and per-repo review behavior for tasks with no acquired worktrees.

- Centralize zero-acquire classification for completion and review paths.
- Approve proven commit-free tasks and immediately route deterministic unavailable reviews.
- Add regression coverage, workflow documentation, and a patch changeset.

Files changed:
 .changeset/fn-9060-workspace-zero-acquire.md       |  7 +++
 docs/workflow-steps.md                             |  2 +-
 .../__tests__/executor-workspace-taskdone.test.ts  | 14 +++++
 .../src/__tests__/executor-workspace.test.ts       | 10 ++--
 .../src/__tests__/reviewer-workspace.test.ts       | 37 +++++++++++++-
 .../src/__tests__/workflow-step-review.test.ts     | 14 +++++
 .../src/__tests__/workspace-zero-acquire.test.ts   | 59 ++++++++++++++++++++++
 packages/engine/src/execution/reviewer.ts          |  7 +++
 .../create-authoritative-workflow-seams.ts         | 26 ++++++++--
 .../src/executor/workspace-review-per-repo.ts      | 32 +++++++++---
 .../engine/src/executor/workspace-zero-acquire.ts  | 53 +++++++++++++++++++
 .../engine/src/executor/worktree-verify-invariants.ts | 31 ++++++++----
 .../engine/src/workflows/workflow-node-handlers.ts | 14 +++--
 13 files changed, 274 insertions(+), 32 deletions(-)

Fusion-Task-Id: FN-9060

Fusion-Task-Lineage: eb88f881-7db2-49d2-b79a-796eacd4fa40

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-14 22:16:44 -07:00
gsxdsm
495845023d FN-9061: gate workspace foreach worktree isolation
Reject unsupported workspace projects before per-instance foreach worktree allocation.

- Add a workspace-isolation guard at graph execution and worktree allocation seams.
- Propagate workspace configuration probing through foreach dependencies.
- Cover workspace and non-workspace behavior, and document the limitation.

Files changed: .../fn-9061-foreach-workspace-isolation-gate.md    |  7 +++
 docs/workflow-steps.md                             |  2 +
 .../workflow-foreach-workspace-isolation.test.ts   | 72 ++++++++++++++++++++++
 .../src/__tests__/workflow-graph-foreach.test.ts   | 56 +++++++++++++++++
 .../src/executor/build-foreach-worktree-deps.ts    | 34 +++++++++-
 packages/engine/src/executor/deps-bags.ts          |  1 +
 .../src/workflows/workflow-graph-executor.ts       |  3 +
 .../engine/src/workflows/workflow-graph-foreach.ts | 17 +++++
 .../src/workflows/workflow-graph-task-runner.ts    |  2 +
 9 files changed, 193 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-9061

Fusion-Task-Lineage: 38772936-a45f-41f1-b7ee-7999997404db

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-14 21:44:18 -07:00
gsxdsm
25b03d6e70 FN-9043: fix workspace completion commit detection
Resolve workspace configuration consistently so task completion observes commits across acquired repositories.

- Add a host-scoped, memoized workspace configuration resolver and preserve live configuration through executor dependency bags.
- Resolve workspace configuration before planning, worktree, graph, cleanup, and task-done paths.
- Aggregate workspace commit observations and cover partial-repository completion cases.

Files changed:
 .changeset/fn-9043-workspace-no-commits.md         |   7 ++
 .../executor-workspace-config-propagation.test.ts  | 116 +++++++++++++++++++++
 .../engine/src/executor/cleanup-task-worktree.ts   |   6 +-
 .../create-authoritative-workflow-seams.ts         |   6 +-
 packages/engine/src/executor/deps-bags.ts          |  74 ++++++++++---
 .../executor/ensure-graph-custom-node-worktree.ts  |  14 ++-
 .../executor/ensure-task-worktree-for-planning.ts  |   8 +-
 packages/engine/src/executor/get-worktree-path.ts  |   3 +
 packages/engine/src/executor/mark-stuck-aborted.ts |   6 +-
 .../engine/src/executor/run-graph-custom-node.ts   |   8 +-
 packages/engine/src/executor/run-implementation.ts |   6 +-
 .../src/executor/workspace-config-resolver.ts      |  40 +++++++
 .../src/executor/worktree-task-done-scope-leak.ts  |   8 +-
 .../src/executor/worktree-verify-invariants.ts     |  44 ++++----
 14 files changed, 287 insertions(+), 59 deletions(-)

Fusion-Task-Id: FN-9043

Fusion-Task-Lineage: fc012b8e-c9cb-47e8-81a7-c9590a63a980

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-14 14:24:26 -07:00
gsxdsm
ea53cbd4ff FN-9021: send mailbox notices for task recommendations
Completed tasks now optionally send captured recommendations to the operator mailbox.

- Add idempotent, non-blocking mailbox notices after accepted task completion.
- Expose a project setting and localized dashboard control for recommendation notices.
- Cover notification dispatch, settings parity, and completion-path behavior with tests.

Files changed:
 .../fn-9021-recommendation-mailbox-notice.md       |   7 ++
 docs/dashboard-guide.md                            |   2 +-
 docs/settings-reference.md                         |   1 +
 .../core/src/__tests__/settings-parity.test.ts     |   2 +
 .../__tests__/task-recommendation-notice.test.ts   |  77 +++++++++++++
 packages/core/src/config/settings-schema.ts        |   2 +
 packages/core/src/index.ts                         |   9 ++
 packages/core/src/task-recommendation-notice.ts    | 122 +++++++++++++++++++++
 packages/core/src/types/settings/settings-scope.ts |   6 +
 .../__tests__/SettingsModal.general.test.tsx       |  10 ++
 .../app/components/settings/section-keys.ts        |   1 +
 .../settings/sections/GeneralSection.tsx           |  15 +++
 .../settings-default-descriptions.test.tsx         |   1 +
 .../executor-task-recommendations.test.ts          |  39 ++++++-
 .../executor/completion-recommendation-notice.ts   |  52 +++++++++
 .../engine/src/executor/create-task-done-tool.ts   |  12 ++
 packages/engine/src/executor/plan-review-no-op.ts  |  12 ++
 packages/engine/src/runtimes/in-process-runtime.ts |  14 +++
 packages/i18n/locales/en/app.json                  |   4 +-
 packages/i18n/locales/es/app.json                  |   4 +-
 packages/i18n/locales/fr/app.json                  |   4 +-
 packages/i18n/locales/ko/app.json                  |   4 +-
 packages/i18n/locales/pt-BR/app.json               |   4 +-
 packages/i18n/locales/zh-CN/app.json               |   4 +-
 packages/i18n/locales/zh-TW/app.json               |   4 +-
 packages/i18n/src/resources.d.ts                   |  40 ++++++-
 26 files changed, 442 insertions(+), 10 deletions(-)

Fusion-Task-Id: FN-9021
Fusion-Task-Lineage: f6c5c93c-a3b6-470b-9efb-79e6b4003985
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-12 21:15:53 -07:00
gsxdsm
167e17c697 fix(engine): resume planned mission follow-ups 2026-08-11 17:53:40 -07:00
gsxdsm
43141467fb FN-8955: harden reviewer verdict extraction
Recover structured reviewer verdicts from prose containing malformed brace or quote characters.

- Scan and recover JSON verdict candidates after parser desynchronization.
- Prevent unreadable structured verdicts from being treated as prose approvals.
- Cover malformed prose and multi-finding verdict recovery across review gates.

Files changed:
 .changeset/fn-8955-verdict-extractor.md            |  7 ++
 docs/workflow-steps.md                             |  4 +-
 packages/engine/src/__tests__/reviewer.test.ts     | 65 +++++++++++++++
 .../workflow-malformed-verdict-gate.test.ts        | 14 ++++
 .../workflow-step-verdict-parsing.test.ts          | 86 ++++++++++++++++++--
 packages/engine/src/execution/reviewer.ts          | 92 ++++++++++++++++++++--
 .../engine/src/executor/workflow-step-verdict.ts   | 16 ++--
 7 files changed, 267 insertions(+), 17 deletions(-)

Fusion-Task-Id: FN-8955

Fusion-Task-Lineage: 84107fd2-b7f3-4162-9e8c-2ec24600d9d5

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-11 15:01:52 -07:00
gsxdsm
66c51038a5 fix(engine): bind self-owned worktree liveness probe (#3419)
## Summary
Supersedes #3416 — the fork head is not writable from maintainers, so
this branch carries the same fix merged onto current `main`.

## Changes
- Bind the self-owned worktree liveness probe in task-executor pure
facades (from #3416).
- Merge current main so the lifecycle-column census baseline stays
green.

## Test plan
- [x] `pnpm check:lifecycle-columns` clean after merge
- [ ] CI green

Closes context from #3416.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed cleanup for self-owned worktrees so it no longer crashes before
checking whether an active session is present.
* Improved safety during worktree reconciliation by correctly verifying
that the worktree is still active before removal.

* **Documentation**
  * Added a changeset documenting the worktree cleanup fix.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: BESA-Franz <49682134+BESA-Franz@users.noreply.github.com>
2026-08-11 11:28:42 -10:00
gsxdsm
9f24a517cf FN-8956: track resolved review findings
Add durable, scoped resolution states for workflow review findings.

- Persist reviewer-applied and superseded finding receipts without making them actionable.
- Scope supersession claims to a named prior workflow result, preserving duplicate IDs in other review lanes.
- Render informational resolution badges and reject resolved items from revision requests.

Files changed: .changeset/fn-8956-review-finding-resolution.md    |   7 +
 docs/dashboard-guide.md                            |   2 +-
 docs/workflow-steps.md                             |   8 +-
 .../src/__tests__/review-severity-gate.test.ts     |  25 ++++
 .../src/__tests__/workflow-step-results.test.ts    |  45 +++++-
 packages/core/src/index.gate.ts                    |   6 +
 packages/core/src/index.ts                         |   6 +
 packages/core/src/types.ts                         |   2 +
 packages/core/src/types/task/task-review.ts        |   4 +
 packages/core/src/types/workflow/workflow-steps.ts |  15 +-
 .../src/workflows/builtin-code-review-group.ts     |   2 +-
 .../src/workflows/builtin-plan-review-group.ts     |   2 +-
 .../core/src/workflows/review-severity-gate.ts     |  37 ++++-
 .../core/src/workflows/workflow-step-results.ts    |  54 ++++++-
 packages/dashboard/app/api/agents/run-audit.ts     |   1 +
 .../dashboard/app/components/TaskReviewTab.css     |  22 +++
 .../dashboard/app/components/TaskReviewTab.tsx     |  36 +++--
 .../components/__tests__/TaskReviewTab.test.tsx    |  46 ++++++
 .../dashboard/src/__tests__/routes-tasks.test.ts   |  48 ++++++
 .../src/routes/register-task-workflow-routes.ts    |  14 +-
 .../__tests__/review-finding-supersession.test.ts  | 163 +++++++++++++++++++++
 .../__tests__/review-findings-injection.test.ts    |  22 +++
 .../workflow-step-verdict-parsing.test.ts          |  16 +-
 .../engine/src/executor/execute-workflow-graph.ts  | 129 ++++++++--------
 .../engine/src/executor/execute-workflow-step.ts   |  25 +++-
 .../engine/src/executor/run-graph-custom-node.ts   |   7 +
 .../executor/workflow-step-failure-injection.ts    |   8 +-
 .../engine/src/executor/workflow-step-verdict.ts   |  17 ++-
 .../src/workflows/workflow-graph-executor.ts       |  15 ++
 packages/i18n/locales/en/app.json                  |   4 +-
 packages/i18n/locales/es/app.json                  |   4 +-
 packages/i18n/locales/fr/app.json                  |   4 +-
 packages/i18n/locales/ko/app.json                  |   4 +-
 packages/i18n/locales/pt-BR/app.json               |   4 +-
 packages/i18n/locales/zh-CN/app.json               |   4 +-
 packages/i18n/locales/zh-TW/app.json               |   4 +-
 36 files changed, 703 insertions(+), 109 deletions(-)

Fusion-Task-Id: FN-8956

Fusion-Task-Lineage: 80568280-85aa-4a49-a60a-99b75f88f486

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-11 13:34:27 -07:00
gsxdsm
5a1853cac6 FN-8934: add memory pre-steering across agent prompts
Add bounded memory-first guidance and consolidation observability across agent workflows.

- Apply mode-aware memory pre-steering to execution, triage, reviewer, heartbeat, and merger prompts.
- Export and test shared memory nudges while documenting memory inclusion settings.
- Expose agent memory consolidation history through dashboard API and detail UI.

Files changed:
 .changeset/fn-8934-memory-pre-steering.md          |  7 ++
 docs/agents.md                                     |  4 +
 docs/settings-reference.md                         |  2 +
 .../core/src/__tests__/memory-pre-steering.test.ts | 28 +++++++
 packages/core/src/__tests__/project-memory.test.ts | 22 ++++++
 packages/core/src/index.gate.ts                    |  7 ++
 packages/core/src/index.ts                         |  7 ++
 packages/core/src/memory/index.ts                  |  1 +
 packages/core/src/memory/memory-pre-steering.ts    | 41 ++++++++++
 packages/core/src/memory/project-memory.ts         | 19 +++++
 packages/dashboard/app/api/agents/agents.ts        | 12 +++
 packages/dashboard/app/api/legacy.ts               |  2 +
 .../dashboard/app/components/AgentDetailView.css   | 41 ++++++++++
 .../dashboard/app/components/AgentDetailView.tsx   | 56 +++++++++++++-
 ...etailView.memory-consolidation-history.test.tsx | 58 +++++++++++++++
 .../__tests__/AgentDetailView.test-helpers.ts      |  3 +
 .../register-agent-memory-consolidations.test.ts   | 87 ++++++++++++++++++++++
 .../register-agent-reflection-rating-routes.ts     | 36 +++++++++
 .../memory-pre-steering-injection.test.ts          | 50 +++++++++++++
 packages/engine/src/__tests__/reviewer.test.ts     | 18 +++++
 packages/engine/src/__tests__/triage.test.ts       | 18 ++++-
 packages/engine/src/agent-heartbeat.ts             | 14 +++-
 .../engine/src/agents/agent-heartbeat-prompts.ts   |  2 +
 packages/engine/src/agents/agent-instructions.ts   | 16 ++--
 packages/engine/src/execution/reviewer.ts          | 31 +++++---
 packages/engine/src/executor/execution-prompt.ts   |  6 +-
 packages/engine/src/merger.ts                      |  9 ++-
 packages/engine/src/triage.ts                      | 12 ++-
 28 files changed, 577 insertions(+), 32 deletions(-)

Fusion-Task-Id: FN-8934

Fusion-Task-Lineage: a062cc6b-1277-4d36-9926-b3ecba4945eb

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-11 04:57:14 -07:00
gsxdsm
06ea444339 fix: uncap workflow principals and auto-resume stranded continuations
Two independent wedges kept cards silently stuck on the board.

1. Workflow principals were capped. `WorkflowAgentCapacity.acquire` enforced
   `settings.maxConcurrent` as a project session budget plus an optional
   per-agent `maxWorkflowSessions`, and `routeWorkflowPrincipal`'s availability
   test applied the same per-agent ceiling. The workflow roles stand in for
   STAGES, not workers, and there is typically one agent per role - so the cap
   serialized the entire board behind a single Workflow Executor regardless of
   maxConcurrent/maxWorktrees. Admission now always succeeds; the lease survives
   as bookkeeping (it is what activeSessions counts and what the renewal timer
   keeps warm). `maxProjectSessions` is removed from the input rather than
   defaulted, so it cannot be reintroduced without deleting the contract, and
   the agent-capacity re-route loops in triage and graph admission are deleted
   with the refusal they existed to work around.

2. Continuations that stop in `running` or `held` were never re-polled. The
   scheduler's due-poll takes only `runnable`/`retrying`; a row claimed through
   a path that leaves `leaseExpiresAt` NULL keeps `state: "running"` forever
   after its process dies, and `acquireWorkflowWorkItemLease` can only re-take a
   `held` row whose blockedReason matches workflow-principal-%. Observed live:
   seven cards `running` behind leases from a process that exited ~9h earlier,
   two `held` with a NULL blockedReason for 46h, none emitting a single
   run-audit row while stranded. A further 33 active-state rows belonged to
   archived+soft-deleted tasks (the FK cascade only fires on hard delete).

   New sweep `reconcileStrandedWorkflowContinuations` (startup + periodic)
   re-queues both stranded shapes and retires dead tasks' rows, gated by the
   canonical liveness triple, a 10-minute grace matching the capacity lease
   duration, and a compare-and-set on the scanned state so a real claim wins.
   The decision is the pure `evaluateStrandedContinuationReclaim`, shared with
   its tests so coverage cannot drift from behavior - the drift that let the
   FN-8923 sweep ship covering one ninth of this problem.

Verified: pnpm lint, engine typecheck, pnpm test:gate (606 tests), verify:fast,
and the new suite under mutation (removing either guard fails 3 cases). The two
pre-existing failures in self-healing-orphaned-pending-step-results.test.ts
reproduce identically at HEAD without these changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 02:02:51 -07:00
gsxdsm
7b3bd75268 fix(engine): wire the Plan Review replan cap and tombstone its dead predecessor
Investigating the "dead cap" turned up the opposite of what it looked like, plus a
worse problem next to it.

The Plan Review replan loop was NOT unbounded. U3 re-owned the cap-park in the
graph: requestPreMergeOptionalStepFix parks via parkPlanReviewReplanCapExhausted
at awaiting-approval with reason plan-review-replan-cap, on both an explicit
finite budget and the unbounded default. That capability has been live throughout.

What was actually dead:

1. PLAN_REVIEW_GATE_REPLAN_CAP = 8 — an unread constant belonging to the
out-of-graph triage gate (runPlanReviewBeforeExecution) that U10/R4 deleted. Its
companion column Task.planReviewReplanCount was persisted, serialized and reset
but never incremented or compared. A constant and a column that look like a live
safety ceiling while enforcing nothing are worse than no ceiling: they answer "is
this loop bounded?" with a confident yes. Deleted, ratcheted in
legacy-tombstones.test.ts, and the column documented as legacy/never-written with
the live owner named.

2. planReviewReplanCap — an operator-facing setting, declared, validated,
documented in settings-reference.md and editable in the Workflow Editor, that
NOTHING read. Lowering it changed nothing. The unbounded backstop was instead
hardcoded to PLAN_REVIEW_FEEDBACK_HISTORY_LIMIT — a bound on how much reviewer
PROSE is replayed into the next planning prompt, whose own comment says it is
"bounded independently of persistence and retry accounting". Two unrelated
concerns shared one number, so trimming prompt history would have silently
tightened a safety ceiling.

The backstop now resolves from the setting, defaulting to the new
DEFAULT_PLAN_REVIEW_REPLAN_CAP = 15 — the previously-effective value, so this is a
pure re-wiring rather than a silent behavior change. The existing 15-attempt
regression test passes unchanged, which is the evidence for that. 0 is honored as
park-on-first-REVISE. An explicit planReviewMaxRevisions / node maxRevisions
budget remains a stricter, earlier gate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 13:39:55 -07:00
gsxdsm
c05d44d44a fix(engine): bound planning retries and cap the planning turn
Three changes to the triage planning path.

1. Unclassified planning failures are bounded. specifyTask's catch-all branch —
the one reached by every error the classifiers above do not recognize — restored
the card's claimable status and wrote nothing else: no counter, no
nextRecoveryAt, no park. Triage rediscovery re-admitted the card on the very next
poll, and replaceActiveTaskWorkflowContinuation replaced the terminal work item
with a fresh one carrying no attempt count, so nothing recorded that the task had
already failed N times. It now consumes the same recoveryRetryCount/nextRecoveryAt
budget the transient branch uses (MAX_RECOVERY_RETRIES = 3, 60s/120s/300s jittered
backoff) and parks status:"failed" with a PLANNING_FAILED_EXHAUSTED: error once
spent — status:"failed" is what suppresses rediscovery. Classifying one error
string fixes one symptom; this budget is what makes the NEXT unrecognized error
fail safely instead of looping for a day.

2. The planning turn has a ceiling. Fusion set no timeout on it at all:
workflowStepTimeoutMs covers pre-merge workflow steps only, and the provider SDK's
300s APIConnectionTimeoutError caps time-to-first-byte and is cleared once headers
arrive, after which the stream is uncapped. configureHttpDispatcher, which would
install undici idle timeouts, is only called from pi's CLI entrypoints and never
in the in-process engine. Observed consequence: single attempts ran to 126 minutes,
with failed-attempt durations spread smoothly from 1 to 126 min and no clustering —
the signature of nothing enforcing a bound. New workflow-native planningTimeoutMs
(default 90 min) aborts the session; the failure consumes one bounded attempt.

The default is deliberately generous rather than tight. Successful planning work
items measured over 7 days ran p50 12.7 / p90 39.5 / p99 105.7 minutes, so a
tighter bound would abort legitimate plans and pay for the restart — the churn
this work exists to remove. It bounds hung turns, not slow ones.

3. [event:task:moved] executor tracing dropped from log to debug. It fires on
every dispatch, rebound, requeue, archive and self-healing move across every task,
which made it the loudest line in engine output and buried operator-actionable
events. No test pins the level; the information remains at debug.

Also fixes a test break shipped in 963dba6f80: the review blocking-severity
settings landed inside BUILTIN_REVIEW_REVISION_SETTINGS, whose contents
builtin-workflow-settings-triage.test.ts asserts exactly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 13:27:10 -07:00
gsxdsm
963dba6f80 feat: gate review verdicts on finding severity and preserve remediation sessions
Review remediation loops were the dominant cost of task wall-clock: over 14 days,
tasks with >=5 post-review fix rounds were 22% of tasks but consumed 78% of all
task active time, and 311 of 331 recorded findings were spec-internal-consistency
complaints that changed no delivered behavior.

Two causes compounded. Plan/Code Review remediation was unbounded by default, and
the review policy ordered a full re-derivation of the artifact after every edit
("distrust the edit ... fresh holistic pass"), so each round surfaced a fresh crop
of previously-acceptable observations as new blockers.

Make the already-persisted WorkflowReviewFinding.severity load-bearing instead of
decorative: a REVISE only blocks when it carries a finding at or above the review
kind's threshold (plan: P0+P1, code: P0). Non-blocking findings are still parsed,
persisted, and handed to the implementer as advisory notes in PROMPT.md. Fails
closed — a REVISE with no findings, or with any unclassified finding, still blocks,
so prose-only and custom reviewers keep full blocking power. The gate only ever
relaxes a verdict, never promotes one.

Reviewer prompts now request the structured findings schema (Plan Review emitted
none before), define severity by consequence as P0/P1/P2, omit nits entirely rather
than filing them as low-severity findings, and use an incremental re-review contract.
Remediation renders findings grouped by priority and sanctions an explicit decline
with rationale, so a disputed finding has a terminal state.

Also preserve the implementation session across a review bounce: sendTaskBackForFix
no longer nulls sessionFile when preserving resume state, and the executor's finally
no longer clears it on a review handoff. Remediation rounds continue the conversation
instead of re-reading the repo and re-deriving the change they just wrote. The resume
prompt now directs a PROMPT.md re-read, without which a resumed agent would never see
the new findings.

New per-workflow settings planReviewBlockingSeverity / codeReviewBlockingSeverity;
set either to "any" to restore the previous behavior.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 11:28:32 -07:00
gsxdsm
e6b6223d30 fix(engine): stop per-poll symbol-lock renewal log and activityLog spam
Renewal runs every poll for every implementation-column task with declared
symbols, and a lost lock never recovers by renewing — renewSymbolLocks reports
the same lost set on each pass, so the warning and its store.logEntry companion
repeated forever: log-pane spam plus unbounded activityLog growth for a stuck
task. The two error paths had the same shape on any persistent failure.

Extract the executor's suppression into a shared createRepeatSuppressedLog and
use it in both: first occurrence per task/signature logs at full level, repeats
drop to debug(), a changed lost set or error message logs again, and a clean
renewal clears the memo. The logEntry write is gated on the same decision.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 10:33:35 -07:00
gsxdsm
a2deae041a fix(engine): stop per-poll executor dispatch-blocked log spam
The unmet-dependency and ephemeral-disabled pre-dispatch gates re-run on every
dispatch attempt for a blocked task but only change state on the first, so every
later pass re-logged the same line at default level and drowned the log pane.

Route both through logDispatchBlockedOnce: first block per task/reason logs at
log(), identical repeats drop to debug() (FUSION_DEBUG=executor), a changed
reason logs again, and the marker clears when the gate passes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 10:11:11 -07:00
gsxdsm
e610c72034 FN-8943: reconcile spec-lock divergence history
Preserve prior divergence when a task is re-locked after plan changes.

- Persist immutable spec locks, current-plan evidence, and drift reports.
- Reconcile retained divergence into re-approved alignment state across engine, API, and dashboard views.
- Fence Plan Review acceptance and schema upgrades while retaining migration identity parity.

Files changed:
 .changeset/fn-8845-spec-lock-drift-report.md       |   7 +
 .changeset/fn-8943-spec-lock-divergence.md         |   7 +
 docs/architecture.md                               |  17 +-
 docs/dashboard-guide.md                            |   3 +
 docs/missions.md                                   |   4 +
 .../core/src/__tests__/planner/spec-lock.test.ts   | 158 ++++++++++++++
 .../src/__tests__/postgres/schema-applier.test.ts  |  30 ++-
 .../postgres/task-dependency-mutation.pg.test.ts   |  74 +++++++
 packages/core/src/index.gate.ts                    |   4 +
 packages/core/src/index.ts                         |   4 +
 packages/core/src/planner/drift-report.ts          | 152 +++++++++++++
 packages/core/src/planner/spec-lock.ts             | 182 ++++++++++++++++
 .../migrations/0050_spec_lock_drift_report.sql     |  29 +++
 .../0051_spec_lock_source_revision_bigint.sql      |   3 +
 packages/core/src/postgres/schema-applier.ts       |  25 ++-
 packages/core/src/postgres/schema/project.ts       |  13 ++
 packages/core/src/store.ts                         | 242 ++++++++++++++++++++-
 .../core/src/task-store/branch-and-pr-entities.ts  |  32 ++-
 packages/core/src/task-store/project-store-ops.ts  |  34 ++-
 packages/core/src/task-store/task-update.ts        |  66 +++++-
 packages/core/src/task-store/update-task-deps.ts   |  31 ++-
 packages/dashboard/app/api.ts                      |   3 +
 packages/dashboard/app/api/tasks/tasks.ts          |  22 ++
 .../dashboard/app/components/MissionManager.css    |  21 ++
 .../dashboard/app/components/MissionManager.tsx    |  41 +++-
 .../dashboard/app/components/TaskDetailModal.css   |  26 +++
 .../dashboard/app/components/TaskDetailModal.tsx   |  62 +++++-
 .../__tests__/TaskDetailModal.spec-lock.test.tsx   |  80 +++++++
 .../__tests__/TaskDetailModal.test-helpers.ts      |   2 +
 .../src/__tests__/plan-approval-status.pg.test.ts  |  81 ++++++-
 .../src/routes/register-task-workflow-routes.ts    |  59 ++++-
 .../src/__tests__/mission-feature-sync.test.ts     |  15 +-
 .../src/__tests__/spec-drift-reconciler.test.ts    | 108 +++++++++
 .../engine/src/executor/execute-workflow-graph.ts  |  49 ++++-
 .../engine/src/missions/mission-feature-sync.ts    |  55 ++++-
 packages/engine/src/project-engine.ts              |  33 +++
 packages/engine/src/spec-drift-reconciler.ts       | 105 +++++++++
 packages/engine/src/triage.ts                      |  29 +++
 38 files changed, 1842 insertions(+), 66 deletions(-)

Fusion-Task-Id: FN-8943

Fusion-Task-Lineage: 2a7f8a38-99aa-4c4b-8c36-41d14c466d21

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-10 02:56:58 -07:00
gsxdsm
37d32357e9 fix(workflow): keep assigned tasks executing instead of holding on a dead principal
Workflow principal routing conflated two different questions: whether an agent
CAN run a node, and whether it can run it RIGHT NOW. Both produced a hold, and a
named principal never falls through to the role pool — so an agent that could
never satisfy the node wedged the task permanently.

FN-8869, FN-8928, and FN-8845 were each explicitly assigned to a permanent
engineer-role agent (which the assignment policy allows). Their `step-execute`
nodes took that owner as `task-assignee` authority, found no `executor` tag, and
held closed. Each card re-dispatched and re-held every ~15 minutes for hours
while two idle `Workflow Executor` pool agents were never consulted. The only
thing still touching them was the owner's hourly heartbeat, which logged
"progressing, no blockers" and exited: heartbeat observation had replaced
execution.

- Structural incapability (wrong role, agent deleted, authority edited away) is
  no longer authority for the node. Routing continues to the column binding and
  then the role pool.
- A resumed continuation whose fence proves stale discards it and re-routes,
  instead of re-asserting a dead principal on every dispatch.
- Availability is unchanged and still fail-closed: a role-capable principal that
  is paused, disabled, or at session capacity holds, and is never silently
  replaced by a pool member.
- An explicitly assigned engineer-role agent is now valid task-assignee
  authority for an executor node, so the assigned agent executes its own task
  continuously under graph dispatch. The role pool stays strict, since automatic
  backlog pickup by engineers is a separate opt-in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 00:58:43 -07:00
Phil Larson
b30508c685 fix(executor): preserve external checkout ownership guards (#3404)
## Summary
- keep operator-routed external checkouts out of managed worktree
preflight, cleanup, and lost-work reconciliation paths
- mark injected custom graph worktree creation as native so workspace
mode accepts the managed backend
- add an extraction regression guard for the ownership fences

## Test plan
- `pnpm --filter @fusion/engine exec vitest run
src/executor/__tests__/external-checkout-extraction-guards.test.ts
--silent=passed-only --reporter=dot`
- `pnpm --filter @fusion/engine typecheck`
- `pnpm check:changesets`
- targeted ESLint on the changed TypeScript files


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* External execution checkouts are no longer treated as Fusion-managed
worktrees.
* Prevented unnecessary Git checks, cleanup, and reconciliation during
retries, pauses, recovery, and stuck-task handling.
* Invalid external checkout configurations now fail safely with an
error.
* Graph-injected worktrees now use the native worktree backend for
consistent setup.
* **Tests**
* Added coverage verifying external checkouts remain excluded from
managed worktree operations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-09 19:40:01 -10:00
gsxdsm
351c3b7e28 fix(executor): restore two fixes dropped by the U4 executor peel
PR #3317 rewrote executor.ts from a pre-change base. A refactor rebased off a
stale base does not conflict — it deletes. An audit of every commit touching
executor.ts before the peel found two landed fixes silently removed:

- FN-8850 completion recommendations: the `fn_task_done` VALIDATOR survived the
  peel but the engine-appended prompt section asking the executor to produce
  recommendations did not. Nothing failed — recommendations were still accepted,
  no test covered the prompt wiring, and capture simply stopped. Restored
  verbatim in executor/system-prompt.ts, next to the validator it pairs with.
- The WorktreeBaseRefreshError guard (a06a4988d9): without it a pre-session
  checkout refusal falls through to the generic terminal sink and parks the task
  `failed`, which is the path that produced 99 parks and 47 operator alerts over
  2026-08-01..09. Restored in executor/run-implementation.ts as a wait.

Everything else from that window verified intact: external checkout routing
(#3398/#3400/#3401), FN-8864/FN-8868 agent activity telemetry, FN-8863
remediation holds, FN-8841 CLOSE_NO_OP, FN-8870 approval mail, FN-8910 held-task
remediation — line-level diffs looked missing only because the peel rewrote
`this.` to `deps.`.

Adds executor-prompt-completion-recommendations.test.ts to pin the prompt
wiring, since the absence of coverage is what let it disappear silently.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-09 19:10:45 -07:00
gsxdsm
51a5e1c275 fix(agents): separate heartbeat runtime from workflow routability
runtimeConfig.enabled answered two different questions. Every consumer in the
engine reads it as "run this agent's own durable heartbeat loop" — heartbeat
scheduling, error recovery, self-healing, in-process runtime — except the
workflow router, which also read it as "may own a workflow stage".

That conflation caused both failures:

- Built-in owners ship with the heartbeat off, which is CORRECT (they are
  invoked by the workflow engine and must not run autonomous loops or auto-claim
  work). That silently made every built-in role unroutable and deadlocked the
  board.
- Enabling the heartbeat to restore routing then gave four agents autonomous
  loops and auto-claiming nobody asked for.

Separate the flag:

- runtimeConfig.enabled governs the heartbeat runtime ONLY
- isWorkflowPrincipalEligible answers routability, and treats the four built-in
  role owners as routable structurally — there is no fallback if a role cannot
  route, so "unroutable" is not a state an operator can meaningfully select
- provision built-ins { enabled: false, autoClaimRelevantTasks: false }
- paused/errored still outranks the exemption, so it can never resurrect a
  broken principal

Removes the earlier write-seam coercion that forced enabled:true — the invariant
is now structural rather than fought for on every write.

Also re-applies the principal-hold backoff ladder (15s -> 5m, checked before
graph entry) into executor/execute-workflow-graph.ts. PR #3317's executor peel
rewrote executor.ts from a pre-change base and dropped it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-09 19:03:23 -07:00
gsxdsm
1cf86baa1c refactor: package code organization wave 18 (executor pure peels) (#3317)
## Summary

Wave 18 continues the package code-organization program after wave 17
domain folders (U4 Slice A from
`docs/plans/2026-07-14-001-refactor-package-code-organization-plan.md`).

### What changed
Peel **pure, behavior-preserving** helpers out of
`packages/engine/src/executor.ts` into domain modules under
`packages/engine/src/executor/`, with **stable re-exports** from
`executor.ts` so deep imports and `vi.mock("../executor.js")` keep
working.

| New module | Symbols |
|------------|---------|
| `executor/task-done-refusal.ts` | `evaluateTaskDoneRefusal`,
`determineRevisionResetStart`, skip-bypass refusal helper |
| `executor/workflow-feedback-paths.ts` |
`extractReferencedPathsFromWorkflowFeedback`,
`isAlwaysAllowedScopeLeakPath`, `workflowPathMatchesDeclaredScope` |
| `executor/workflow-step-verdict.ts` |
`FUSION_WORKFLOW_STEP_CONVENTIONS_PREAMBLE`, `parseWorkflowStepVerdict`
/ `parseWorkflowStepOutput`, step outcome types |
| `executor/await-input-parse.ts` | `parseAwaitInputSentinel`,
`parseAwaitInputQuestionToolCall` |
| `executor/no-commit-eligibility.ts` | `getNoCommitEligibilityReason`
(+ prompt heuristics) |

`executor.ts` live LOC ~**22817 → ~22427** (first pure-peel batch; more
peels needed to approach the 2k cap).

### Shims
- `old path` `executor.ts` public exports → `new path` `executor/*.ts` →
delete-when consumer deep-imports are re-pointed (not this PR)

### Test plan
- [x] `@fusion/engine` typecheck
- [x] Oracle: task-done refusal, skip-bypass, workflow malformed
verdict, scope-leak allowlist, executor-step-session, executor-prompt
- [x] `vitest --project=engine-core` (merge-gate curated suite)
- [ ] CI merge gate

**Stack:** wave17 (merged) → **this PR**

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Improved recognition of workflow outcomes from structured and
conversational responses.
* Added support for extracting questions from await-input responses and
tool calls.
* Improved workflow feedback handling for referenced files and declared
scope patterns.
* Added clearer guidance for task execution, approvals, verification,
and available tools.

* **Bug Fixes**
* Prevented completion when required review approvals are missing or
revisions remain pending.
* Improved handling of workflows that legitimately require no code
changes.
  * Added clearer refusal messages and more reliable revision restarts.
  * Sanitized repository paths in Git remediation instructions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-09 15:46:09 -10:00
gsxdsm
cb57093d03 refactor: domain folder layout (types, API, core, engine) (#2398)
## Summary

Wave 17 organizes Fusion into **domain folders** (stacks on #2397).

### Layout
- **core/types/** — board, task, agents, settings, merge, workflow,
mesh, …
- **core/src/** — agents, ai, async-stores, workflows, tasks, config,
db, …
- **dashboard/app/api/** — client, tasks, agents, git, missions,
planning, …
- **engine/src/** — agents, auth, execution, merge, missions, overseer,
worktree, …

Root keepers retained for large entrypoints (`store.ts`, `executor.ts`,
`merger.ts`, …).

Public barrels (`@fusion/core`, `@fusion/engine`, `app/api.ts` → legacy)
stay stable.

## Test plan
- [x] `@fusion/core` typecheck
- [x] `@fusion/engine` typecheck (pre-existing playwright-core noise
only)
- [ ] CI merge gate

**Stack:** #2394 → #2397 → **this PR**
2026-08-03 00:20:53 -07:00
gsxdsm
3f763cba87 U8: the graph owns the pending-review park — ownership ledger 28 → 27 (#2590)
The routing move this unit has been building toward, landing on the path
the engine actually runs. **Includes #2578's commit** (the live-path fix
it depends on) — merge that first, or this supersedes it.

## What changes

Three things together, because a half-routed move is a card that
silently does not advance:

1. The **live** implementation primitive (`runCodingSession`) returns
`{outcome: "failure", value: "review-pending"}` for that ending.
2. The primitive step handler stops flattening every ending to
`step-done`/`step-failed`, so the value survives the foreach —
`runForeach` propagates a failing instance's value as the node's own —
and reaches an edge.
3. The inline `handoffTaskToReview` in `runImplementation` is
**deleted**. The phase reports and stops, which is all an implementation
phase should do.

Built-in workflows route to the `review-pending-handoff` node added in
#2519/#2546, which performs the handoff and ends the run: the same two
effects in the same order, with the graph as the owner.

## Proof, end to end

FN-5436 — the test that blocked this move twice and was right both times
— now passes, with a **stronger** assertion than it had:

```ts
expect(store.moveTask).toHaveBeenCalledWith("FN-5436-B", "in-review",
  expect.objectContaining({
    workflowMoveSource: "workflow-graph",
    workflowMoveMetadata: expect.objectContaining({ nodeId: "review-pending-handoff" }),
  }));
```

The old two-argument `moveTask(id, "in-review")` could not distinguish a
graph-owned park from an out-of-band one — which is the entire
distinction this unit exists to make. The invariant (park in review,
never `failed`) is unchanged; the owner is now proven.

## Every ratchet fired, and each records a real change

| Ratchet | Before | After | Why |
|---|---|---|---|
| Ownership ledger — `runImplementation` review handoffs | 3 | **2** |
the handoff left the phase |
| Ownership ledger — `handleGraphFailure` | 0 | **1** | the named compat
classifier |
| Ledger headline — executor-owned dispositions | 28 | **27** | first
decrement of the unit |
| Out-of-band exit list | 2 | **1** | pending-review is graph-owned now
|
| Primitive routing pin | "must not reroute" | routes *only* the moved
ending | declared, not discovered |

None was relaxed. The `handleGraphFailure` 0 → 1 is the honest one: for
a user-authored graph without the edge this is a **relocation, not an
elimination** — the transition is still executor-performed, but from one
named classifier in the failure ladder rather than a call buried two
thousand lines into a session loop. The ledger says so rather than
letting the headline number imply more progress than there is.

## Why it took four attempts

Recorded because the reason is reusable: the value was being produced on
`createAuthoritativeWorkflowSeams`, a handler that never runs (#2578).
Every earlier attempt was correct code on a dead path, and the only
thing that showed it was instrumenting until a negative result was
proven observable rather than assumed.

## Verification

- step-session + exit-events + primitive-exit-events + ownership ledger
+ graph-requeue-gate + task-done-blocked — **83 tests green**
- `pnpm test:gate` green (10 / 482 / 71); `pnpm lint` clean; `tsc
--noEmit` clean
- Changeset included (`patch`, `internal`)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Improved handling of tasks awaiting review so they are correctly
routed to the review workflow.
* Tasks now remain in review instead of being marked as failed when no
follow-up review route is configured.
* Review handoffs now include workflow ownership and provenance details.
* Preserved standard failure handling for tasks that are not awaiting
review.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-29 20:59:06 -07:00