763003c9b0c7cdf549bf380b7ded309a8ab292f9
11 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7611ce7baa |
FN-8841: route Plan Review no-op verdicts to terminal close
Allow validated duplicate and no-op Plan Review verdicts to complete work without implementation dispatch. - Add terminal no-op routes to built-in coding workflows and validate reviewer evidence. - Persist close verdicts, safely hold failed terminalizations, and guard pause races. - Document the verdict contract and cover route, validation, and completion behavior. - Add a patch changeset for the published Fusion package. Files changed: .changeset/fn-8841-plan-review-no-op.md | 7 + docs/workflow-steps.md | 14 + .../core/src/__tests__/builtin-workflows.test.ts | 24 ++ packages/core/src/types/task/task-review.ts | 7 +- packages/core/src/types/workflow/workflow-steps.ts | 2 +- .../src/workflows/builtin-coding-workflow-ir.ts | 3 + .../src/workflows/builtin-plan-review-group.ts | 3 +- .../builtin-stepwise-coding-workflow-ir.ts | 3 + packages/core/src/workflows/builtin-workflows.ts | 5 + .../engine/src/__tests__/plan-review-no-op.test.ts | 289 +++++++++++++++++++ .../workflow-step-verdict-parsing.test.ts | 18 ++ packages/engine/src/executor.ts | 318 +++++++++++++++++---- .../src/workflows/workflow-graph-executor.ts | 103 ++++++- .../src/workflows/workflow-graph-task-runner.ts | 6 + 14 files changed, 741 insertions(+), 61 deletions(-) Fusion-Task-Id: FN-8841 Fusion-Task-Lineage: bde2e001-9cd0-496e-8367-36540c9ac31d Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai> |
||
|
|
0cce560e4a |
fix: stop three bookkeeping faults from terminalizing or mis-scoping a run
Found by a subsystem audit of FN-8764's work-item and role-routing design, prompted by three production deadlocks already fixed in it. 1. executor.ts — closing out the continuation could skip handleGraphFailure. The two transitions that close a run's continuation sat outside the interpreter try/catch with no handler, unlike their siblings in the same function. The row is usually ALREADY terminal by then: the run's first fence write retires the continuation it resumed on, which is what makes the handover atomic. So `succeeded -> failed` hit the store's terminal guard and threw, escaping executeWorkflowGraph and skipping handleGraphFailure — a failed run's card was left sitting in its wip column, unparked, with no error recorded. Closing the continuation is bookkeeping and must never pre-empt the lifecycle action. 2. executor.ts — capacity attemptId dropped its run-id fallback. `resolvedRunId` is optional by construction (a definition load failure leaves it undefined) and this interpolated it raw, producing the literal attempt id `undefined:<nodeInstance>` shared by every task in the project that hit that failure. The lease is keyed on (projectId, attemptId) and returns "acquired" for a pre-existing row regardless of agent, so colliding tasks bypass both the project and per-agent caps and one task's release deletes another's live lease. The two durable writes on either side already used the fallback. 3. workflow-task-runtime.ts — failWorkItem dropped a promise bare. The write is deliberately fire-and-forget, but an unhandled rejection (most likely the terminal guard when a peer already closed the row) crossed into process-level unhandled-rejection territory while the caller had already returned "failed" as if it were persisted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
560256bb73 |
fix: resume the graph at a top-level node, not a foreach template node
A principal fence written for a node inside a foreach template stores the
TEMPLATE node id (step-execute) with the materialized instance in
nodeInstanceId (steps#0:step-execute). The template node lives under the
foreach's config.template and is never in ir.nodes, so handing it to the
interpreter as a start node resolved to nothing and threw WorkflowIrError.
executeWorkflowGraph's catch turned that into a terminal graph failure, so a
healthy card was parked on every dispatch:
[workflow-graph] FN-8825 could not resolve workflow — parking task instead of
legacy fallback: interpreter-error: Workflow IR missing start node
Latent since FN-8764 introduced these fences, and reachable only once a
step-execute fence could become the task's sole active continuation — which the
atomic-handover change in
|
||
|
|
ef8828f145 |
fix: unblock workflow execution stalled by silent role-routing deadlocks
Every task sat in progress with no session, no log, and no error after the FN-8764 role-agent rollout. Two independent deadlocks, both invisible: 1. The in-process runtime built its AgentStore but never passed it into TaskExecutorOptions, so the executor's fail-closed role-routing gate refused every classified node (execute/step-execute/review/merge). 2. A resumed run keeps the continuation work item it woke on active until the interpreter returns, so the next node's principal-fence upsert violated idx_workflow_work_items_one_active_task_continuation — a different index than its ON CONFLICT target — and raised. The run re-suspended on every dispatch; only an operator bouncing the card to the hold column cleared it. Both refusals were swallowed as recoverable "principal holds" that write no log, audit row, or task error, which is why a fully deadlocked board looked idle. - Wire agentStore into the executor; assert the shared instance at every runtime seam in the PG composition test. - Supersede an active work item for a node the run has already left, then retry the fence write once; never touch a claim on the node currently executing. - Record task:workflow-run-suspended and task:workflow-continuation-superseded; log principal holds, routing-unavailable faults, and fence-write errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
eaadd153b1 |
FN-8764: route workflow stages through durable role agents
Route workflow stages through task-scoped durable role agents. - Persist normalized multi-role agents and workflow principal fences with migrations. - Route planning, execution, review, and merge workflow nodes through authorized permanent principals with capacity leasing and recovery. - Retire ephemeral workflow-stage workers and expose role-aware agent configuration, workflow editing, and documentation. - Preserve lifecycle-column ratchet coverage by centralizing workflow-role classification rather than adding test exemptions. Files changed: .changeset/fn-8764-workflow-role-agents.md | 7 + CONCEPTS.md | 3 + docs/agents.md | 6 + docs/architecture.md | 6 + docs/cli-reference.md | 2 + docs/dashboard-guide.md | 4 + docs/settings-reference.md | 6 +- docs/storage.md | 2 + docs/workflow-steps.md | 6 + .../src/__tests__/extension-agent-update.test.ts | 11 +- packages/cli/src/__tests__/extension.test.ts | 18 +- packages/cli/src/extension.ts | 41 +- .../core/src/__tests__/agent-permissions.test.ts | 12 + .../core/src/__tests__/agent-role-policy.test.ts | 7 + packages/core/src/__tests__/agent-roles.test.ts | 21 + .../legacy-column-collection-gating-ledger.test.ts | 19 +- .../src/__tests__/postgres/schema-applier.test.ts | 16 +- .../core/src/__tests__/settings-parity.test.ts | 9 +- .../workflow-agent-node-classification.test.ts | 25 + .../src/__tests__/workflow-work-item-cas.test.ts | 38 ++ packages/core/src/agents/agent-permissions.ts | 11 +- packages/core/src/agents/agent-role-policy.ts | 39 +- packages/core/src/agents/agent-store.ts | 190 ++++++- .../core/src/async-stores/async-agent-store.ts | 6 + packages/core/src/config/settings-schema.ts | 5 +- packages/core/src/index.gate.ts | 2 +- packages/core/src/index.ts | 7 +- .../0045_fn_8764_multi_role_workflow_agents.sql | 20 + .../0046_fn_8764_workflow_principal_fence.sql | 49 ++ packages/core/src/postgres/schema-applier.ts | 22 +- packages/core/src/postgres/schema/project.ts | 21 + packages/core/src/store.ts | 2 +- .../task-store/async/async-workflow-workitems.ts | 49 +- packages/core/src/task-store/row-types.ts | 4 + packages/core/src/task-store/settings-helpers.ts | 16 +- packages/core/src/task-store/settings-ops-2.ts | 13 +- packages/core/src/task-store/settings-ops.ts | 16 +- packages/core/src/task-store/task-row-mappers.ts | 4 + .../src/task-store/workflow-task-create-ops.ts | 6 +- .../src/task-store/workflow-workitems-ops-2.ts | 25 +- packages/core/src/types.ts | 2 + packages/core/src/types/agents/agents.ts | 45 +- packages/core/src/types/merge/merge-queue.ts | 17 + packages/core/src/types/settings/settings-scope.ts | 9 +- packages/core/src/workflows/workflow-ir-types.ts | 58 +++ packages/core/src/workflows/workflow-ir.ts | 19 + .../dashboard/app/components/AgentDetailView.css | 14 + .../dashboard/app/components/AgentDetailView.tsx | 34 +- .../dashboard/app/components/NewAgentDialog.tsx | 28 +- .../app/components/WorkflowNodeEditor.tsx | 19 + .../__tests__/AgentDetailView.core.test.tsx | 4 +- .../app/components/__tests__/AgentsView.test.tsx | 2 +- .../__tests__/SettingsModal.general.test.tsx | 86 --- .../__tests__/SettingsModal.test-harness.tsx | 1 - .../components/agent-presets/agentCreatePayload.ts | 9 +- .../app/components/settings/section-keys.ts | 1 - .../settings/sections/GeneralSection.tsx | 8 - .../settings-default-descriptions.test.tsx | 1 - .../app/components/workflow-flow-mapping.ts | 7 + packages/dashboard/src/mission-routes.ts | 26 +- .../src/routes/__tests__/agent-core-routes.test.ts | 23 +- .../src/routes/register-agent-core-routes.ts | 42 +- ...gister-agent-import-export-generation-routes.ts | 21 - .../engine/src/__tests__/agent-action-gate.test.ts | 33 ++ .../engine/src/__tests__/agent-assignment.test.ts | 370 ------------- .../src/__tests__/ephemeral-worker-manager.test.ts | 575 --------------------- ...ecutor-ephemeral-disabled-dispatch-gate.test.ts | 223 -------- .../__tests__/executor-fast-mode-workflows.test.ts | 58 +++ .../engine/src/__tests__/log-severity-manifest.ts | 1 - .../__tests__/log-severity-spam-contract.test.ts | 3 - .../resolved-read-with-literal-filter.test.ts | 4 - .../__tests__/scheduler-ephemeral-toggle.test.ts | 175 ------- .../__tests__/scheduler-workflow-cutover.test.ts | 19 - .../src/__tests__/workflow-agent-capacity.test.ts | 47 ++ .../src/__tests__/workflow-agent-routing.test.ts | 137 +++++ .../src/__tests__/workflow-graph-foreach.test.ts | 15 + .../__tests__/workflow-graph-task-runner.test.ts | 73 +++ .../src/__tests__/workflow-task-runtime.test.ts | 95 ++++ .../src/__tests__/workflow-work-scheduler.test.ts | 20 + packages/engine/src/agents/agent-action-gate.ts | 64 +++ packages/engine/src/agents/agent-assignment.ts | 135 ----- packages/engine/src/agents/agent-reflection.ts | 1 + .../engine/src/agents/ephemeral-worker-manager.ts | 429 --------------- .../engine/src/agents/workflow-agent-capacity.ts | 113 ++++ .../engine/src/agents/workflow-agent-router.ts | 185 +++++++ packages/engine/src/execution/reviewer.ts | 26 +- packages/engine/src/executor.ts | 501 +++++++++++++++--- packages/engine/src/index.ts | 1 - packages/engine/src/merger.ts | 20 +- packages/engine/src/pi.ts | 11 + packages/engine/src/runtimes/in-process-runtime.ts | 37 -- packages/engine/src/scheduler.ts | 114 +--- packages/engine/src/triage.ts | 196 ++++++- .../src/workflows/workflow-graph-executor.ts | 109 +++- .../engine/src/workflows/workflow-graph-loop.ts | 13 +- .../src/workflows/workflow-graph-task-runner.ts | 12 + .../engine/src/workflows/workflow-task-runtime.ts | 125 ++++- .../src/workflows/workflow-work-scheduler.ts | 8 +- 98 files changed, 2722 insertions(+), 2468 deletions(-) Fusion-Task-Id: FN-8764 Fusion-Task-Lineage: 5527fccb-342d-46f6-8108-bbf89142efec Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai> |
||
|
|
4f4aef7173 |
FN-8811: preserve explicit shared-member review holds
Keep shared branch-group integration moving unless an operator explicitly holds the task. - Track auto-merge provenance and distinguish explicit user holds from inherited mission policy. - Preserve manual holds across workflow recovery, merge coordination, API updates, and dashboard status. - Add regression coverage, document the behavior, and quarantine the observed flaky test. Files changed: .changeset/fn-8811-shared-member-review-hold.md | 7 ++ docs/architecture.md | 4 +- docs/dashboard-guide.md | 1 + .../mission-store.sync-auto-merge.test.ts | 7 +- .../__tests__/postgres/mission-store.pg.test.ts | 1 + .../__tests__/postgres/store-movement.pg.test.ts | 20 ++++ packages/core/src/__tests__/task-merge.test.ts | 14 +++ .../core/src/async-stores/async-mission-store.ts | 6 +- packages/core/src/index.gate.ts | 1 + packages/core/src/index.ts | 1 + packages/core/src/merge/task-merge.ts | 20 +++- packages/core/src/missions/mission-store.ts | 6 +- packages/core/src/task-store/serialization.ts | 2 +- packages/core/src/task-store/task-creation.ts | 8 +- packages/core/src/types/task/task-core.ts | 12 ++- .../components/__tests__/TaskDetailModal.test.tsx | 63 ++++++++++++ .../dashboard/src/__tests__/routes-tasks.test.ts | 47 +++++++++ .../src/routes/register-task-workflow-routes.ts | 15 ++- ...cutor-live-branch-group-auto-merge-hold.test.ts | 87 +++++++++++++++++ .../src/__tests__/group-merge-coordinator.test.ts | 99 ++++++++++++++++++- .../engine/src/__tests__/project-engine.test.ts | 57 ++++++++++- .../self-healing-paused-abort-recovery.test.ts | 52 +++++++++- packages/engine/src/__tests__/self-healing.test.ts | 106 +++++++++++++++++++++ .../workflow-graph-executor-handlers.test.ts | 23 +++++ packages/engine/src/executor.ts | 37 ++++++- packages/engine/src/project-engine.ts | 25 +++-- packages/engine/src/self-healing.ts | 71 ++++++++++++-- .../src/workflow-node-runners/merge-runner.ts | 24 ++++- .../src/workflows/workflow-graph-executor.ts | 4 + .../src/workflows/workflow-graph-task-runner.ts | 6 ++ .../engine/src/workflows/workflow-node-handlers.ts | 5 +- packages/engine/vitest.config.ts | 11 ++- scripts/lib/test-quarantine.json | 5 + 33 files changed, 789 insertions(+), 58 deletions(-) Fusion-Task-Id: FN-8811 Fusion-Task-Lineage: 5c1609bf-3132-4988-a254-fedec6c0e33d Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai> |
||
|
|
ec10411c4c |
FN-8795: persist structured workflow review findings
Persist normalized actionable findings from review workflow nodes. - Normalize bounded finding IDs, text, locations, and severities in workflow results. - Surface individual findings for Review-tab selection and same-task revision. - Preserve findings through workflow retries and document the advisory contract. Files changed: .changeset/fn-8795-structured-review-findings.md | 7 +++ docs/dashboard-guide.md | 2 +- docs/workflow-steps.md | 4 +- .../src/__tests__/workflow-step-results.test.ts | 32 +++++++++++++- packages/core/src/index.gate.ts | 4 ++ packages/core/src/index.ts | 6 ++- packages/core/src/types.ts | 4 ++ packages/core/src/types/task/task-review.ts | 5 +++ packages/core/src/types/workflow/workflow-steps.ts | 20 +++++++++ .../core/src/workflows/workflow-step-results.ts | 50 +++++++++++++++++++++- .../dashboard/app/components/TaskReviewTab.tsx | 12 +++++- .../src/routes/register-task-workflow-routes.ts | 26 ++++++++++- .../workflow-malformed-verdict-gate.test.ts | 12 ++++++ packages/engine/src/executor.ts | 46 +++++++++++++++++--- .../src/workflows/workflow-graph-executor.ts | 11 +++++ 15 files changed, 227 insertions(+), 14 deletions(-) Fusion-Task-Id: FN-8795 Fusion-Task-Lineage: 09003b01-3f9a-4387-b6a7-f29066ce52f6 Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai> |
||
|
|
e75c788db2 |
FN-8794: add workflow review-kind markers
Classify workflow review nodes so review feedback can target their persisted results. - validate and type explicit plan/code review-kind markers in workflow IR - expose review-kind selection in the workflow editor and document the authoring contract - persist markers through task workflow routes and graph execution with regression coverage Files changed: .changeset/fn-8794-review-kind.md | 7 + docs/dashboard-guide.md | 4 + docs/workflow-steps.md | 10 + .../__tests__/workflow-ir-optional-group.test.ts | 17 ++ packages/core/src/__tests__/workflow-ir.test.ts | 83 +++++++++ packages/core/src/index.gate.ts | 2 +- packages/core/src/index.ts | 2 +- packages/core/src/types.ts | 2 + packages/core/src/types/workflow/workflow-steps.ts | 8 + .../src/workflows/builtin-code-review-group.ts | 1 + .../src/workflows/builtin-plan-review-group.ts | 1 + packages/core/src/workflows/workflow-ir-types.ts | 5 + packages/core/src/workflows/workflow-ir.ts | 24 +++ .../app/components/WorkflowNodeEditor.tsx | 17 ++ .../__tests__/WorkflowNodeEditor.test.tsx | 206 +++++++++++++++++++++ .../dashboard/src/__tests__/routes-tasks.test.ts | 166 ++++++++++++++++- .../src/routes/register-task-workflow-routes.ts | 82 ++++++-- .../workflow-graph-optional-group.test.ts | 177 +++++++++++++++++- .../src/workflows/workflow-graph-executor.ts | 20 +- 19 files changed, 801 insertions(+), 33 deletions(-) Fusion-Task-Id: FN-8794 Fusion-Task-Lineage: a7752469-59bc-406f-82e8-6ffde6c392ef Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai> |
||
|
|
9939897aab |
fix: prevent stale planning approvals and review churn (#3327)
## Summary Planning can no longer approve or execute against evidence from a superseded dependency episode. Dependency mutations, approval decisions, recovery, and execution admission now share serialized lifecycle rules, so stale planner work cannot restore an invalid approval or release an unplanned task. Review also converges instead of discovering one blocker per round. Planning performs a repository-grounded completeness pass up front; Plan Review batches all independently discoverable blockers and carries an episode-scoped decision ledger across revisions; code review traces changed invariants through production consumers and tests. Repeated feedback still advances the safety budget, while provider failures and superseded episodes stay outside the remediation ledger. The dashboard now exposes manual approval only for the intended exhausted-review state, and refusal/recovery audit events make rejected lifecycle transitions diagnosable without leaking prompt content. ## Validation - `pnpm verify:fast` — scoped typechecks/builds, CLI build, and boot smoke passed. - Focused Core and Engine regression suites — 511 tests passed. - `pnpm lint`, strict changeset validation, Core/Engine typechecks, and package builds passed. Fixes #3325. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Improved Plan Review approvals, rejections, and replan-cap handling across task workflows. * Added cumulative feedback and attempt tracking across repeated planning reviews. * Added safer recovery for stalled planning handoffs and interrupted approval updates. * **Bug Fixes** * Prevented stale approvals and unplanned execution after dependency changes. * Improved concurrent approval handling, retryability, and refusal-record deduplication. * Refined dashboard approval indicators and responsive approval views. * **Quality Improvements** * Strengthened planning and code-review completeness checks and blocking-finding coverage. * Preserved review history while clearly marking outdated approvals. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
9dc7b94c17 |
fix(FN-8768): resume manually approved plans
Persist exhausted Plan Review approval as audited terminal evidence and wake scheduler and deferred continuations immediately. Fusion-Task-Id: FN-8768 |
||
|
|
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** |