Commit Graph

111 Commits

Author SHA1 Message Date
gsxdsm
d450dbe971 FN-8829: add task recommendations
Add persistent task recommendations that agents can create, resolve, and display in task details.

- Persist recommendation state and expose task recommendation API routes.
- Generate recommendations from executor task completions with duplicate suppression.
- Add localized dashboard recommendation tab and settings control with coverage.

Files changed:
 .changeset/fn-8829-recommendations.md              |   7 +
 docs/dashboard-guide.md                            |   1 +
 docs/settings-reference.md                         |   1 +
 .../postgres/settings-persistence.pg.test.ts       |  10 +
 .../postgres/task-recommendations.pg.test.ts       | 191 +++++++++
 .../core/src/__tests__/settings-parity.test.ts     |   2 +
 packages/core/src/config/settings-schema.ts        |   2 +
 packages/core/src/index.ts                         |   2 +-
 .../0047_fn_8829_task_recommendations.sql          |   3 +
 packages/core/src/postgres/schema-applier.ts       |  32 +-
 packages/core/src/postgres/schema/project.ts       |   2 +
 packages/core/src/store.ts                         |  12 +-
 packages/core/src/task-store/persistence.ts        |   4 +-
 packages/core/src/task-store/serialization.ts      |   1 +
 packages/core/src/task-store/settings-ops.ts       |  22 +
 packages/core/src/task-store/task-mutation-ops.ts  |  78 +++-
 packages/core/src/task-store/task-row-mappers.ts   |   2 +-
 packages/core/src/task-store/task-update.ts        |  51 ++-
 packages/core/src/types.ts                         |   4 +
 packages/core/src/types/settings/settings-scope.ts |   6 +
 packages/core/src/types/task/task-core.ts          |  18 +
 .../__tests__/App.openTasksInRightSidebar.test.ts  |   3 +-
 packages/dashboard/app/__tests__/api-tasks.test.ts |  31 ++
 packages/dashboard/app/api/legacy.ts               |   1 +
 packages/dashboard/app/api/tasks/tasks.ts          |  24 ++
 .../dashboard/app/components/TaskDetailModal.tsx   |  43 +-
 .../app/components/TaskRecommendationsTab.css      |  71 ++++
 .../app/components/TaskRecommendationsTab.tsx      | 127 ++++++
 .../__tests__/SettingsModal.general.test.tsx       |  11 +
 .../TaskDetailModal.recommendations.test.tsx       | 111 +++++
 .../app/components/settings/section-keys.ts        |   1 +
 .../settings/sections/GeneralSection.tsx           |  14 +
 .../settings-default-descriptions.test.tsx         |   1 +
 packages/dashboard/app/hooks/useModalManager.ts    |   6 +
 packages/dashboard/app/plugins/types.ts            |   7 +-
 .../__tests__/task-recommendation-routes.test.ts   | 472 +++++++++++++++++++++
 .../src/routes/register-task-workflow-routes.ts    | 263 +++++++++++-
 .../executor-task-recommendations.test.ts          | 128 ++++++
 packages/engine/src/executor.ts                    |  66 ++-
 packages/i18n/locales/en/app.json                  |  15 +-
 packages/i18n/locales/es/app.json                  |  16 +-
 packages/i18n/locales/fr/app.json                  |  16 +-
 packages/i18n/locales/ko/app.json                  |  16 +-
 packages/i18n/locales/zh-CN/app.json               |  16 +-
 packages/i18n/locales/zh-TW/app.json               |  16 +-
 packages/i18n/src/resources.d.ts                   |  12 +
 46 files changed, 1908 insertions(+), 30 deletions(-)

Fusion-Task-Id: FN-8829
Fusion-Task-Lineage: 5f60a1fb-9cf8-4577-9bfd-c20a2d402333
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-08 01:59:38 -07:00
gsxdsm
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>
2026-08-07 01:36:34 -07:00
gsxdsm
b9c5df04af FN-8791: prevent NUL-containing chat checkpoints from crashing
Prevent malformed tool output from breaking chat checkpoint persistence.

- Sanitize NUL characters at chat JSONB persistence boundaries without mutating clean values.
- Observe rejected best-effort checkpoint writes so streaming sessions do not emit unhandled rejections.
- Add PostgreSQL, dashboard, and sanitizer regression coverage with operator-facing release notes.

Files changed:
 .changeset/fn-8791-chat-nul-checkpoint.md          |  7 ++
 .../reliability/chat-jsonb-nul-sanitization.md     | 44 +++++++++++
 packages/core/src/__tests__/nul-sanitize.test.ts   | 21 ++++-
 .../chat-store-content-search-edit.pg.test.ts      | 91 +++++++++++++++++++++-
 packages/core/src/async-stores/async-chat-store.ts | 61 ++++++++++-----
 packages/core/src/postgres/nul-sanitize.ts         | 17 ++--
 .../dashboard/src/__tests__/chat-manager.test.ts   | 90 +++++++++++++++++++++
 packages/dashboard/src/chat.ts                     | 21 ++++-
 8 files changed, 322 insertions(+), 30 deletions(-)

Fusion-Task-Id: FN-8791

Fusion-Task-Lineage: 51e13634-04cc-4827-b72f-f33e40760940

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-04 19:15:20 -07:00
gsxdsm
1dc636b8b4 FN-8785: deduplicate queued dependency and scope logs
Persist queue episodes atomically so repeated scheduler and self-healing passes do not duplicate diagnostics.

- Add a queued-episode signature with PostgreSQL migration and task serialization support.
- Route dependency and file-scope queue transitions through the atomic deduplication API.
- Cover repeated and concurrent queue transitions, and update scheduler mocks for the new store API.

Files changed:
 .changeset/fn-8785-queued-log-deduplication.md     |   7 +
 docs/architecture.md                               |   1 +
 .../postgres/queued-episode-transition.pg.test.ts  | 158 +++++++++++++++++++++
 .../src/__tests__/postgres/schema-applier.test.ts  |   9 +-
 .../core/src/postgres/migrations/0000_initial.sql  |   1 +
 .../0044_fn_8785_queued_episode_signature.sql      |   3 +
 packages/core/src/postgres/schema-applier.ts       |  12 +-
 packages/core/src/postgres/schema/project.ts       |   1 +
 packages/core/src/store.ts                         |   5 +-
 packages/core/src/task-store/audit-ops.ts          |  80 +++++++++++
 packages/core/src/task-store/persistence.ts        |   2 +
 packages/core/src/task-store/serialization.ts      |   1 +
 packages/core/src/types/task/task-core.ts          |   5 +
 ...executor-outer-dispatch-dependency-gate.test.ts |  39 +++--
 .../engine/src/__tests__/executor-test-helpers.ts  |   7 +
 .../__tests__/scheduler-overlap-starvation.test.ts |  43 +++++-
 .../__tests__/scheduler-workflow-cutover.test.ts   |  35 +++--
 .../self-healing-completion-fanout.test.ts         |  37 +++++
 packages/engine/src/__tests__/self-healing.test.ts |  25 +++-
 packages/engine/src/executor.ts                    |  16 ++-
 packages/engine/src/scheduler.ts                   |  26 ++--
 packages/engine/src/self-healing.ts                | 117 +++++----------
 22 files changed, 491 insertions(+), 139 deletions(-)

Fusion-Task-Id: FN-8785
Fusion-Task-Lineage: 8d68c243-f24e-4db4-bd1d-b7eda01309f6
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-04 11:52:15 -07:00
gsxdsm
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 -->
2026-08-04 00:20:08 -07:00
gsxdsm
bb17baaacf FN-8768: recover planning handoffs after dependency reseeds
Prevent dependency reseeds from leaving completed planning work without a dispatchable continuation.

- Serialize dependency invalidation with workflow claims and retire only pending continuations.
- Persist dispatch-deduplication state and recover legacy reseeded planning handoffs safely.
- Add PostgreSQL migration, integration coverage, architecture guidance, and a patch changeset.

Files changed:
 .changeset/fn-8768-planning-reseed.md              |   7 ++
 docs/architecture.md                               |  10 +-
 .../core/src/__test-utils__/pg-test-harness.ts     |   8 ++
 .../__tests__/postgres/backend-resolver.test.ts    |   5 +
 .../src/__tests__/postgres/schema-applier.test.ts  |  17 ++-
 .../postgres/task-dependency-mutation.pg.test.ts   |  42 ++++++-
 .../__tests__/task-update-lanes-resolved.test.ts   |  20 +++-
 packages/core/src/postgres/advisory-locks.ts       | 122 +++++++++++++++++++++
 packages/core/src/postgres/backend-resolver.ts     |  13 ++-
 packages/core/src/postgres/data-layer.ts           |   4 +
 packages/core/src/postgres/embedded-lifecycle.ts   |   6 +
 .../migrations/0043_fn8768_dispatch_dedupe.sql     |  17 +++
 packages/core/src/postgres/schema-applier.ts       |  13 ++-
 packages/core/src/postgres/schema/project.ts       |  15 +++
 packages/core/src/store.ts                         |  56 +++++++++-
 packages/core/src/task-store/audit-ops.ts          |  49 +++++++++
 .../core/src/task-store/branch-and-pr-entities.ts  |  30 +++++
 packages/core/src/task-store/project-store-ops.ts  |  55 ++++++++--
 packages/core/src/task-store/task-update.ts        |  30 ++++-
 packages/core/src/task-store/update-task-deps.ts   |  30 ++++-
 packages/engine/src/__tests__/triage.test.ts       |  66 ++++++++++-
 packages/engine/src/execution/hold-release.ts      |  45 ++++++++
 packages/engine/src/scheduler.ts                   |   3 +-
 packages/engine/src/triage.ts                      |  87 ++++++++++++++-
 24 files changed, 713 insertions(+), 37 deletions(-)

Fusion-Task-Id: FN-8768

Fusion-Task-Lineage: 539ef649-5a13-4eaa-a695-bc68370fed22

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-03 19:31:03 -07: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
73fe461db5 fix: demote routine engine log noise to debug
Keep the default TUI for lifecycle transitions (Starting/Specifying/Worktree created/merge/move). Demote expected skips, schedule-trigger echoes, session setup bookkeeping, warm worktree reuse, and fn_run_verification command-fail detail. Pin via severity manifest and contract tests.
2026-08-02 23:18:07 -07:00
gsxdsm
39368f4bb8 FN-8694: add content-addressed validation memoization
Memoizes mission validation inputs and bounds repeat failures.

- Persist validator input fingerprints and atomically admit validation runs.
- Reuse unchanged static passes while enforcing per-fingerprint failure budgets.
- Add migration coverage, execution-loop tests, and operator documentation.

Files changed:
 .changeset/fn-8694-validation-memoization.md       |   7 +
 docs/missions.md                                   |   6 +
 docs/storage.md                                    |   6 +
 .../__tests__/postgres/mission-store.pg.test.ts    |  40 +++-
 packages/core/src/async-mission-store-queries.ts   |  24 ++-
 packages/core/src/async-mission-store.ts           |  65 +++++-
 packages/core/src/mission-store.ts                 |  10 +-
 packages/core/src/mission-types.ts                 |  19 ++
 .../0042_fn_8694_validator_input_fingerprint.sql   |   9 +
 packages/core/src/postgres/schema-applier.ts       |  13 +-
 packages/core/src/postgres/schema/project.ts       |   5 +
 .../src/__tests__/mission-execution-loop.test.ts   |  72 ++++++-
 packages/engine/src/mission-execution-loop.ts      | 217 +++++++++++++++++----
 13 files changed, 443 insertions(+), 50 deletions(-)

Fusion-Task-Id: FN-8694

Fusion-Task-Lineage: 92a790d5-f2fc-4e71-b9ee-8334ff38b20d

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-01 12:40:24 -07:00
gsxdsm
006cc40454 FN-8685: add durable cross-process task deletion consumers
Deliver durable, replay-safe cross-process task deletion observation.

- Add PostgreSQL lifecycle consumer cursors, leases, acknowledgements, retention, and recovery.
- Start named consumers in dashboard, serve, and engine runtime paths.
- Preserve delete integration metadata while suppressing replayed GitHub and GitLab side effects.
- Cover outbox identity, observed delivery, fencing, and reconciliation behavior.

Files changed:
 ...fn-8685-cross-process-task-deleted-observers.md |   7 +
 .../fn-8685-task-deleted-outbox-consumers.md       |   7 +
 docs/architecture.md                               |   8 +-
 ...tgres-cross-process-task-deleted-observation.md |   8 +-
 docs/storage.md                                    |  10 +-
 packages/cli/src/commands/dashboard.ts             |   9 +-
 packages/cli/src/commands/serve.ts                 |   9 +-
 packages/cli/src/project-context.ts                |   9 +-
 .../task-deleted-outbox-consumer.pg.test.ts        | 157 ++++++++
 ...-deleted-observed-dispatch-side-effects.test.ts |  36 ++
 .../task-lifecycle-consumer-identity.test.ts       |  22 ++
 packages/core/src/index.ts                         |  11 +
 .../0041_fn_8685_task_lifecycle_consumers.sql      |  88 +++++
 packages/core/src/postgres/schema-applier.ts       |  16 +-
 packages/core/src/postgres/schema/project.ts       |  45 +++
 packages/core/src/postgres/startup-factory.ts      |   4 +
 packages/core/src/store.ts                         |  54 ++-
 .../__tests__/lifecycle-outbox-writer.test.ts      |   4 +-
 .../core/src/task-store/archive-lifecycle-2.ts     |   1 +
 packages/core/src/task-store/lifecycle-ops.ts      |  13 +-
 packages/core/src/task-store/lifecycle-outbox.ts   |   2 +
 packages/core/src/task-store/project-store-ops.ts  |   4 +-
 .../src/task-store/task-deleted-outbox-consumer.ts | 333 +++++++++++++++++
 .../task-store/task-lifecycle-consumer-identity.ts |  32 ++
 .../task-store/task-lifecycle-consumer-registry.ts | 396 +++++++++++++++++++++
 .../task-store/task-lifecycle-event-retention.ts   | 104 ++++++
 packages/core/src/task-store/task-mutation-ops.ts  |   1 +
 packages/dashboard/src/github-tracking-state.ts    |  12 +-
 packages/dashboard/src/gitlab-delete-close.ts      |   3 +
 packages/dashboard/src/gitlab-split-close.ts       |   7 +-
 packages/dashboard/src/project-store-resolver.ts   |   9 +-
 packages/engine/src/project-manager.ts             |   4 +-
 packages/engine/src/project-runtime.ts             |   2 +-
 packages/engine/src/runtimes/in-process-runtime.ts |  17 +-
 packages/engine/src/self-healing.ts                |  27 ++
 35 files changed, 1439 insertions(+), 32 deletions(-)

Fusion-Task-Id: FN-8685
Fusion-Task-Lineage: 63eca9ac-d2af-44b0-ba79-388a950148d3
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-01 06:09:04 -07:00
gsxdsm
8c9346ee94 FN-8684: persist task deletion events transactionally
Persist task-deletion lifecycle events through a transactional PostgreSQL outbox.

- Add the task lifecycle outbox schema, migration, and atomic writer.
- Route deletion notice persistence through the transaction and preserve non-blocking cleanup.
- Cover outbox behavior, schema installation, and caller attribution with tests.

Files changed:
 .changeset/fn-8684-task-deleted-outbox-writer.md   |   7 +
 docs/architecture.md                               |   6 +
 docs/storage.md                                    |   6 +
 .../src/__tests__/postgres/schema-applier.test.ts  |  82 ++++++++-
 .../task-delete-caller-attribution.test.ts         |  12 +-
 .../task-delete-nonblocking-cleanup.test.ts        |  13 +-
 .../core/src/__tests__/task-delete-notice.test.ts  |   7 +-
 .../0040_fn_8684_task_lifecycle_outbox.sql         |  44 +++++
 packages/core/src/postgres/schema-applier.ts       |  15 +-
 packages/core/src/postgres/schema/project.ts       |  27 +++
 .../__tests__/lifecycle-outbox-writer.test.ts      | 201 +++++++++++++++++++++
 .../core/src/task-store/archive-lifecycle-2.ts     |  93 ++++++++--
 packages/core/src/task-store/async-persistence.ts  |  26 ++-
 packages/core/src/task-store/lifecycle-outbox.ts   |  46 +++++
 14 files changed, 557 insertions(+), 28 deletions(-)

Fusion-Task-Id: FN-8684

Fusion-Task-Lineage: 1869d221-2d8a-48fb-b245-9cd1af56bda0

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-01 04:24:05 -07:00
gsxdsm
7334cffebd FN-8660: add credential instance selection persistence
Persist optional credential-instance selections across model configuration without changing runtime credential behavior.

- Add credential instance IDs to global, project, task, preset, and workflow IR model lanes.
- Preserve selected instance IDs through model resolution and task persistence.
- Add PostgreSQL migration coverage, unit tests, documentation, and a minor changeset.

Files changed:
 .../fn-8660-credential-instance-selection.md       |  7 ++
 docs/settings-reference.md                         | 17 +++++
 .../core/src/__tests__/model-resolution.test.ts    | 37 ++++++++++
 .../credential-instance-selection.pg.test.ts       | 81 +++++++++++++++++++++
 .../postgres/settings-persistence.pg.test.ts       | 83 ++++++++++++++++++++++
 .../src/__tests__/workflow-ir-settings.test.ts     | 66 +++++++++++++++++
 packages/core/src/builtin-workflow-settings.ts     | 41 +++++++++++
 packages/core/src/model-resolution.ts              | 57 ++++++++++++++-
 .../0039_fn_8660_credential_instance_selection.sql |  9 +++
 packages/core/src/postgres/schema-applier.ts       | 14 +++-
 packages/core/src/postgres/schema/project.ts       |  4 ++
 packages/core/src/settings-schema.ts               | 25 +++++++
 packages/core/src/store.ts                         |  2 +-
 .../core/src/task-store/archive-lifecycle-2.ts     |  8 +++
 .../core/src/task-store/branch-and-pr-entities.ts  |  2 +-
 packages/core/src/task-store/persistence.ts        |  8 +++
 packages/core/src/task-store/serialization.ts      |  6 ++
 packages/core/src/task-store/settings-ops.ts       | 30 ++++++++
 packages/core/src/task-store/task-creation.ts      | 18 ++++-
 packages/core/src/task-store/task-mutation-ops.ts  |  6 +-
 packages/core/src/task-store/task-row-mappers.ts   |  6 +-
 packages/core/src/task-store/task-update.ts        | 24 +++++++
 packages/core/src/types/archive-planning.ts        |  5 ++
 packages/core/src/types/settings-scope.ts          | 40 +++++++++++
 packages/core/src/types/task-core.ts               | 30 ++++++++
 packages/core/src/types/workflow-steps.ts          |  9 +++
 packages/core/src/workflow-ir.ts                   | 18 +++++
 packages/core/src/workflow-settings.ts             | 10 +++
 28 files changed, 650 insertions(+), 13 deletions(-)

Fusion-Task-Id: FN-8660

Fusion-Task-Lineage: a3f625eb-018c-4084-954e-488b1d37691e

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-31 23:08:51 -07:00
gsxdsm
577dcb6c0c FN-8643: correct TaskWedgeNotifications FNXC timestamp
Correct the TaskWedgeNotifications migration-baseline stamp and remove its obsolete future-date allowance.

- Set the baseline FNXC annotation to its intended non-future timestamp.
- Remove the resolved migration from the future-date baseline allowlist.

Files changed:
 packages/core/src/postgres/migrations/0000_initial.sql | 2 +-
 scripts/lib/fnxc-future-dates-baseline.json            | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

Fusion-Task-Id: FN-8643

Fusion-Task-Lineage: 0f27e9e6-0581-4e38-8005-e93f94ad4f78

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-31 19:32:55 -07:00
gsxdsm
fd795883c5 feat(missions): per-mission taskPrefix override for triaged task ids (#2347)
## Summary
Maintainer re-land of
[#2334](https://github.com/Runfusion/Fusion/pull/2334) (fork
`flexi767:feat/per-mission-task-prefix`) after resolving merge conflicts
with current `main`.

Fork push was unavailable despite `maintainerCanModify`, so this branch
carries the conflict resolution.

### Feature
- Optional per-mission `taskPrefix` for triaged task ids (inherits
project prefix when unset)
- Dashboard MissionManager + routes + store/triage plumbing
- Postgres migration for `project.missions.task_prefix`

### Conflict resolution
- Main claimed migration **0026** (bigint counters) and **0027**
(workflow IR pin)
- Mission task-prefix migration renumbered **0026 → 0028**
- Baseline `0000_initial.sql` includes `task_prefix` on missions
- `legacy.ts` keeps code-org re-exports; `missions.ts` carries
`taskPrefix` on create/update types

## Test plan
- [ ] CI green (lint/typecheck/build/gate)
- [ ] Create mission with custom prefix; triage feature → task ids use
that prefix
- [ ] Clear mission prefix via PATCH null; new tasks inherit project
prefix

Closes / supersedes #2334 once this lands (or re-point the fork PR).

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

* **New Features**
* Missions can now set an optional per-mission task ID prefix
(overriding the project default).
* Added task prefix support to mission create/edit UI and dashboard
APIs, including normalized uppercase values and validation.
* **Bug Fixes**
* Improved commit hook generation for custom prefixes and special
characters, with safer shell handling to prevent unsafe interpretation.
* **Chores**
* Added PostgreSQL migration and schema-applier support to persist and
propagate mission task prefixes, including upgrade/backfill coverage.
* **Tests**
* Added backend and UI/API test coverage for task-prefix creation,
clearing, and ID minting behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-30 21:35:23 -07:00
gsxdsm
dc50425e98 docs: correct 104 future-dated FNXC timestamps across 61 files (#2680)
## What

The FNXC convention exists so a reader can place a note against the
change that motivated it. A stamp dated *after* the edit landed defeats
exactly that.

This is program-wide drift, not one author's slip — I contributed to it
in my own commits this week, which is how I noticed it.

## Measured, on this tree

**104 stamps across 61 files** dated later than the day they were
written, from one day ahead to **2026-10-19 (81 days)**:

| count | date | count | date | count | date |
|---|---|---|---|---|---|
| 50 | 2026-07-31 | 6 | 2026-08-05 | 3 | 2026-08-13 |
| 17 | 2026-08-01 | 1 | 2026-08-07 | 1 | 2026-08-19 |
| 7 | 2026-08-02 | 1 | 2026-08-12 | 2 | 2026-08-26 |
| 11 | 2026-08-03 | | | 3 | 2026-10-19 |

An earlier number I circulated was ~70. That came from a narrower
pathspec and was wrong; **104** is the measurement.

## How

Each stamp is rewritten to the date of the commit that introduced **that
line**, via per-line `git blame` — deliberately *not* stamped uniformly
with today's date. A uniform stamp swaps a wrong date for a different
wrong date and flattens the ordering that makes these comments
navigable; blame preserves it. Times of day are untouched, and a blame
date in the future is clamped rather than trusted.

## Why the verification is listed

A docs sweep across 61 files is precisely where a stray edit hides, so
the safety claims are mechanical rather than asserted:

- every changed line begins with a comment marker — **no code touched**;
- **no test asserts an FNXC date later than today**, so no `toContain`
assertion on embedded source text can be silently invalidated (several
such assertions do exist);
- CSS files, which carry several of those assertions, are outside the
pathspec.

## Verified

lint clean · merge gate green (487 + 158 + 10 + 71) · `census --strict`
exit 0 · tsc clean for core, engine, and dashboard
(`tsconfig.app.json`).

**No behavior change.** Comment text only.

## Not done here

A guard preventing recurrence. A check that rejects an FNXC stamp dated
after the commit would stop this returning, but it needs a decision
about where it runs (lint rule vs. gate) and it is a behavior change to
CI — it does not belong riding inside the sweep it would police.
2026-07-30 02:38:58 -07:00
Phil Larson
a54d60ee70 fix(core): restore standalone central backend initialization (#2596)
## Summary

- restore the owned PostgreSQL backend bootstrap for layer-less
`CentralCore.init()` callers
- fix node, mesh, and project CLI commands returning empty state and
logging `backendHandle is only available in backend mode` during cleanup
- add a hermetic regression test for standalone backend ownership and
shutdown

PR #2454 accidentally added an unconditional early return immediately
before the existing standalone bootstrap. Runtime pool sharing remains
unchanged: `attachBackendLayer()` releases the central-only connections
before adopting the project store layer.

## Verification

- RED: regression failed because `createCentralBackendLayer` had zero
calls
- GREEN: focused regression passes
- `pnpm --filter @fusion/core typecheck`
- `pnpm --filter @fusion/core build`
- `pnpm test` with `FUSION_PG_TEST_SKIP=1`: 482 engine + 132 Core gate +
71 CLI shape + changed regression passed; isolation clean
- changeset format check passed

The local PostgreSQL merge-gate harness is unavailable without
credentials (`empty password returned by client`), so its 10 tests were
explicitly skipped rather than misreported.

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

* **Bug Fixes**
* Restored PostgreSQL central registry access for standalone
Node/mesh/project CLI commands without marking the host offline on
shutdown.
* Improved CentralCore lifecycle handling: concurrent `init()`
coalesces, and operations are blocked once `close()` is requested/in
progress.
* Refined embedded PostgreSQL runtime shutdown: owner stop is
coordinated with lease release, registrations are rejected while
stopping, and shutdown/teardown uses lease lifecycle consistently.
Embedded start failures now treat stopping as retryable.
* **Tests**
* Expanded coverage for CentralCore close/init/attach races and embedded
PostgreSQL lease/shutdown coordination scenarios.
* **Documentation**
  * Updated Changeset notes to clarify CLI and shutdown semantics.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-29 22:41:17 -07:00
gsxdsm
969c2cdf1d capacity part 4: drop the central global_concurrency table (migration 0037) (#2555)
Final piece of the cross-project cap removal. Enforcement (#2509),
settings/API/UI (#2529) are merged; this removes the storage.

Nothing read the table. `global_max_concurrent` held the deleted
machine-wide cap; `currently_active`/`queued_count` were written only by
`acquireGlobalSlot`/`releaseGlobalSlot`, measured earlier in this
program to have **no production caller**, so those counters were
fiction. Live “N running (all projects)” telemetry comes from
`CentralCore.getLiveRunningAgentCounts` and is unaffected.

Dropped rather than left unread: a lingering table with
plausible-looking counters invites a future reader to trust it — the
same trap as a readable-but-ignored settings key.

## The trap this hit, because the first attempt looked correct

`schema-applier.ts` warns that *“migrations are registered here
explicitly (not auto-discovered from the migrations dir), so a new .sql
file that is not wired through a version constant + bookkeeping check
silently never runs.”*

My first pass added the `.sql`, updated the drizzle model and bumped the
baseline — **and the table was still present in a fresh database**. It
was caught only because the test asserts the table is *gone*
(`to_regclass(...) IS NULL`) rather than merely unreferenced; an
absence-of-reference assertion would have passed while the table
survived.

Now registered properly: `DROP_GLOBAL_CONCURRENCY_VERSION = "0037"`,
explicit path constant, applied-check, bookkeeping insert.

The historical `0000` baseline is deliberately **not** rewritten — a
fresh database CREATEs the table then drops it, converging with upgraded
databases without editing history, which is how every prior migration
here behaves.

Also removed: the drizzle model, the `centralTableNames` entry, and the
`replacesCentralSeed` special case in the SQLite migrator (a legacy
SQLite `globalConcurrency` table now has no destination and is simply
not migrated — correct, since its cap is deleted and its counters were
never written).

## Verification

`pnpm lint` clean · core `tsc` clean · `pnpm test:gate` green (414 + 10
+ 71) · `schema-applier` 75/75 · `sqlite-migrator` 43/43 · full core PG
suite **1044 passed / 3 failed** — the same 3 pre-existing
(`central-archive-secrets` log-prefix,
`workflow-settings-project-identity` legacy fallback ×2).

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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-29 10:15:42 -07:00
gsxdsm
a9d5b06013 FN-8562: add tags to chat conversations
Enable project-scoped reusable tags for Direct chat sessions.

- Add tag storage, migrations, and scoped assignment APIs.
- Add chat sidebar tag creation, assignment, and filtering controls.
- Document tag behavior and cover schema and chat interactions.
- Establish the session project/id candidate key before creating scoped tag foreign keys.

Files changed:
 .changeset/fn-8562-chat-conversation-tags.md       |   7 ++
 docs/dashboard-guide.md                            |   4 +
 docs/storage.md                                    |   2 +
 .../src/__tests__/postgres/schema-applier.test.ts  |   8 +-
 packages/core/src/async-chat-store.ts              | 117 ++++++++++++++++++++-
 packages/core/src/chat-store.ts                    |  32 ++++++
 packages/core/src/chat-types.ts                    |  14 +++
 packages/core/src/index.gate.ts                    |   3 +
 packages/core/src/index.ts                         |   3 +
 .../postgres/migrations/0036_chat_session_tags.sql |  64 +++++++++++
 packages/core/src/postgres/schema-applier.ts       |  16 ++-
 packages/core/src/postgres/schema/project.ts       |  34 ++++++
 packages/dashboard/app/api.ts                      |   1 +
 packages/dashboard/app/api/chat.ts                 |  18 ++++
 packages/dashboard/app/components/ChatView.css     |  17 +++
 packages/dashboard/app/components/ChatView.tsx     |  70 +++++++++++-
 .../__tests__/ChatView.core-interactions.test.tsx  |  27 +++++
 .../dashboard/app/hooks/__tests__/useChat.test.ts  |   1 +
 packages/dashboard/app/hooks/useChat.ts            |  52 ++++++++-
 .../dashboard/src/routes/register-chat-routes.ts   |  70 ++++++++++++
 20 files changed, 550 insertions(+), 10 deletions(-)

Fusion-Task-Id: FN-8562

Fusion-Task-Lineage: 4efe798c-0865-451a-adbd-6b85f9f8b149

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-24 18:09:32 -07:00
gsxdsm
dfb9ca6630 FN-8543: enforce bounded generated-fix remediation
Keep generated fix chains within their root retry budget and preserve intervention stops.

- Track retry counts and stop reasons on the canonical root feature.
- Persist project-isolated lineage stops across generated-fix removal and archive paths.
- Serialize stop recording with generated-fix admission and expose conflict-safe mission resume behavior.

Files changed:
 .changeset/fn-8543-bounded-fix-lineage.md          |   7 +
 docs/missions.md                                   |   6 +-
 .../__tests__/postgres/mission-store.pg.test.ts    |  72 +++++++
 packages/core/src/async-mission-store-queries.ts   |  91 ++++++++-
 packages/core/src/async-mission-store.ts           | 206 ++++++++++++++++++---
 packages/core/src/index.ts                         |   2 +-
 packages/core/src/mission-store.ts                 |  10 +
 packages/core/src/mission-types.ts                 |   7 +
 .../0035_fn_8543_mission_lineage_stop.sql          |  31 ++++
 packages/core/src/postgres/schema-applier.ts       |  18 +-
 packages/core/src/postgres/schema/project.ts       |  21 +++
 .../core/src/task-store/archive-lifecycle-2.ts     |  15 +-
 .../core/src/task-store/async-archive-lineage.ts   |  10 +-
 packages/dashboard/src/mission-routes.ts           |  14 +-
 packages/engine/src/mission-execution-loop.ts      |  30 ++-
 15 files changed, 495 insertions(+), 45 deletions(-)

Fusion-Task-Id: FN-8543

Fusion-Task-Lineage: 24c03d63-5914-4072-aa17-16862432fc78

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-23 16:12:44 -07:00
gsxdsm
e7c9b2ac80 FN-8542: separate milestone acceptance from feature validation
Keep feature validation scoped to linked feature assertions while evaluating milestone acceptance at rollup.

- Add assertion scope and origin provenance with database migration support
- Synchronize milestone acceptance prose to a canonical milestone assertion
- Prevent milestone assertions from affecting feature verdicts and document the completion contract
- Cover scoped validation and milestone rollup behavior with core and engine tests

Files changed:
 .changeset/fn-8542-feature-validation-scope.md     |   7 +
 docs/missions-completion-contract.md               |  25 +-
 docs/missions.md                                   |   6 +-
 .../mission-store.sync-loop-transition.test.ts     |  53 +++++
 packages/core/src/async-mission-store-queries.ts   |  17 +-
 packages/core/src/async-mission-store.ts           |  58 ++++-
 packages/core/src/mission-store.ts                 | 118 +++++++++-
 packages/core/src/mission-types.ts                 |  25 ++
 .../core/src/postgres/migrations/0000_initial.sql  |   2 +
 .../0034_milestone_assertion_provenance.sql        |  30 +++
 packages/core/src/postgres/schema-applier.ts       |  24 +-
 packages/core/src/postgres/schema/project.ts       |   1 +
 .../src/__tests__/mission-execution-loop.test.ts   | 161 ++++++++++++-
 packages/engine/src/mission-execution-loop.ts      | 262 ++++++++++++++++-----
 14 files changed, 700 insertions(+), 89 deletions(-)

Fusion-Task-Id: FN-8542

Fusion-Task-Lineage: cf112d31-376a-456e-be08-225eab5de393

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-23 14:39:44 -07:00
gsxdsm
2df0c7e90b fix(#2411): recover from a stale postmaster.pid instead of joining a dead port
After a hard host crash (SIGKILL, power loss), postmaster.pid survives with no
postmaster behind it. The optimistic join handed every subsequent boot a URL to
the dead port, so the dashboard could never start again without a manual pid
delete. Probe the recorded pid with signal 0: provably dead (ESRCH) rebuts the
live-lock presumption and the boot takes an owned start — PostgreSQL itself
re-validates and reclaims the stale lock file, so a recycled live pid keeps the
old join-then-fail behavior and a genuinely live postmaster still surfaces the
lock collision we already join on. EPERM counts as alive (fail-closed).

Verified end to end: real cluster started, postmaster SIGKILLed leaving the pid
file + interrupted WAL, fresh lifecycle detected the stale lock, ran an owned
start, and crash recovery preserved the marker row.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 10:00:09 -07:00
gsxdsm
dc132071d5 fix(#2411): let embedded PostgreSQL crash recovery finish instead of racing it
beta.4 follow-up from the issue thread: on an interrupted (not-cleanly-shut-down)
cluster, the elevated Windows launcher declared readiness on a bare TCP accept
while crash recovery still rejected every connection with 57P03, so
ensureDatabase failed and the start cleanup fast-shutdown the recovering
postmaster ~0.2s after launch; the retry then joined the instance it had just
told to stop, got ECONNREFUSED, and parked the dashboard in a dead shell. The
30s ".pgrunner sharing violation" stall was recovery's SyncDataDirectory fsync
walk hitting Fusion's own pgctl log inside the data dir.

- Move the pgctl runner dir to a sibling .pgrunner-<dataDirName> outside the
  data dir (and sweep the legacy in-dataDir .pgrunner), so recovery's fsync
  walk can never contend with the postmaster's inherited log handle.
- Ignore 57P03 recovery rejections in the elevated readiness fatal scan.
- Owned starts wait for the cluster to genuinely accept connections (retrying
  57P03/socket errors, bounded by the start timeout) before ensureDatabase —
  never stop a postmaster that is still in recovery.
- Join-path database verify retries the 57P03 recovery signal for up to 15s;
  socket errors keep the instant optimistic-join contract for stale pids.
- startup-factory's joined-instance-unreachable retry backs off across ~15s
  instead of a single 500ms attempt.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 09:13:21 -07:00
gsxdsm
e5d6be4123 Fix Windows embedded PostgreSQL 0xC0000142 crashes (issue #2411) (#2418)
## Summary

Two-part fix for #2411 — Windows embedded PostgreSQL backends dying with
exception `0xC0000142` and taking the whole dashboard down.

### 1. Crash hardening + recovery (FN-8522)
- Child-only native `PATH` hardening so forked backends can always
resolve their runtime DLLs.
- Non-blocking `.pgrunner` log monitoring (shared read), eliminating the
self-inflicted ~30s `sharing violation` retry window at boot.
- Detection of the ordered 0xC0000142 shutdown sequence with a single
automatic restart of owned clusters on their resolved port, plus
operator diagnostics.

### 2. Platform-aware `max_connections` default (follow-up from
[operator
report](https://github.com/Runfusion/Fusion/issues/2411#issuecomment-5054900702))
On Windows every PostgreSQL connection is a separate process; the
embedded cluster's unconfigured `max_connections=500` cap lets backend
spawn bursts exhaust the non-interactive desktop heap, which kills
forked backends with exactly `0xC0000142`. The reporter confirmed
stability after lowering the cap.

- `embeddedPostgresMaxConnections` is now schema-unset so the server can
distinguish "operator never set it" from an explicit choice
(`getSettings()` merges schema defaults, which previously pinned 500
unconditionally and made the runtime fallback dead code).
- New `resolveEmbeddedMaxConnections()` resolves the unset default
platform-aware: **150 on win32, 500 elsewhere**. Explicit settings are
honored on every platform, clamped to [32, 2000] as before.
- Settings UI renders the cap empty ("auto") with platform-aware help
copy across all six locales.
- Fixed a latent reset bug this exposed: global "Reset this menu" wrote
`undefined` for undefined-default keys, which JSON serialization drops —
the stored value silently survived reset. Now uses null-as-delete.

## Testing
- New unit tests for `resolveEmbeddedMaxConnections` (platform defaults,
clamping, non-integer handling).
- Updated settings-defaults, default-descriptions, and SettingsModal
tests; embedded lifecycle + recovery coverage from FN-8522.
- `@fusion/core` builds clean; changesets included for both parts.

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 23:41:48 -07:00
gsxdsm
4ef94e667d FN-8523: gate retained SQLite scans by completion marker
Keep completed SQLite migration sources inert across PostgreSQL startups.

- Gate core, central identity, and plugin reads on independent completion markers.
- Preserve PostgreSQL project identity before recording a legacy-central migration as complete.
- Cover completed backup and pending-core central-marker startup paths.

Files changed:
 .changeset/fn-8523-skip-completed-sqlite-rescan.md |   7 ++
 docs/storage.md                                    |   2 +
 .../src/__tests__/postgres/sqlite-migrator.test.ts |  15 +++
 .../postgres/startup-factory-integration.test.ts   | 111 ++++++++++++++++++++-
 packages/core/src/postgres/sqlite-migrator.ts      |  28 ++++--
 packages/core/src/postgres/startup-factory.ts      |  86 +++++++++++-----
 6 files changed, 212 insertions(+), 37 deletions(-)

Fusion-Task-Id: FN-8523

Fusion-Task-Lineage: 1a05b90d-23df-4423-8346-abd6ef35f4df

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-22 22:57:41 -07:00
gsxdsm
e16204deef FN-8522: fix Windows embedded PostgreSQL crash recovery
Harden Windows embedded PostgreSQL startup and recover once from owned-cluster DLL initialization crashes.

- Provide child-only native PATH hardening and non-blocking runner-log monitoring.
- Detect the ordered 0xC0000142 shutdown sequence and restart only owned clusters on their resolved port.
- Add lifecycle coverage and operator diagnostics for recovery behavior.

Files changed:
 .../fn-8522-windows-embedded-postgres-recovery.md  |   7 ++
 docs/diagnostics.md                                |  10 ++
 docs/storage.md                                    |   6 +
 .../__tests__/postgres/embedded-lifecycle.test.ts  |  87 ++++++++++++++
 .../postgres/embedded-windows-elevated.test.ts     |  49 ++++++++
 packages/core/src/postgres/embedded-lifecycle.ts   | 128 ++++++++++++++++++---
 .../core/src/postgres/embedded-windows-elevated.ts | 119 +++++++++++++++++--
 7 files changed, 382 insertions(+), 24 deletions(-)

Fusion-Task-Id: FN-8522

Fusion-Task-Lineage: f256e421-d82e-4afb-9f81-b5c18f1c7100

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-22 22:43:51 -07:00
Fusion
96a9da7979 FN-8505: notify operators of terminal task wedges
Deliver durable, actionable notifications when terminal task recovery wedges.

- Persist and deduplicate terminal wedge notification episodes across task updates and service restarts.
- Classify terminal failure and self-healing escalation states, then deliver actionable ntfy and mailbox alerts.
- Align PostgreSQL baseline and upgrade migration registration for the durable wedge field.

Files changed:
 .changeset/fn-8505-task-wedge-notifications.md     |   7 +
 docs/agents.md                                     |   4 +
 docs/architecture.md                               |   4 +
 .../core/src/postgres/migrations/0000_initial.sql  |   2 +
 .../migrations/0033_fn-8505_wedge_notification.sql |   5 +
 packages/core/src/postgres/schema-applier.ts       |  29 +++-
 packages/core/src/postgres/schema/project.ts       |   1 +
 packages/core/src/store.ts                         |  22 ++-
 packages/core/src/task-store/persistence.ts        |   2 +
 packages/core/src/task-store/serialization.ts      |   1 +
 packages/core/src/task-store/task-row-mappers.ts   |   2 +-
 packages/core/src/task-store/task-update.ts        |   5 +
 packages/core/src/types.ts                         |  14 ++
 packages/core/src/types/workflow-steps.ts          |   2 +
 .../src/__tests__/notification-service.test.ts     |  20 +++
 packages/engine/src/__tests__/notifier.test.ts     |  26 +++-
 packages/engine/src/__tests__/self-healing.test.ts |   9 +-
 .../__tests__/notification-service.test.ts         |  34 ++++-
 .../__tests__/task-wedge-notification.test.ts      | 134 +++++++++++++++++
 .../src/notification/notification-service.ts       | 108 +++++++++++++-
 packages/engine/src/notification/ntfy-provider.ts  |  11 ++
 .../src/notification/task-wedge-notification.ts    | 160 +++++++++++++++++++++
 packages/engine/src/notifier.ts                    |   3 +
 packages/engine/src/self-healing.ts                |  17 +++
 24 files changed, 610 insertions(+), 12 deletions(-)

Fusion-Task-Id: FN-8505
Fusion-Task-Lineage: eee85220-18ba-475d-9d01-dc96e2b923e6
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-22 20:07:48 -07:00
gsxdsm
d0d10aae6a FN-8499: fix macOS embedded PostgreSQL ICU loader links
Ensure embedded PostgreSQL repairs its macOS ICU ABI loader link before startup.

- Normalize the libicuuc.68 dylib compatibility symlink from packaged patch versions.
- Cover missing, dangling, and valid ICU compatibility links in lifecycle tests.
- Add a patch changeset for the macOS startup fix.

Files changed:
 .changeset/fn-8499-macos-postgres-libicu.md        |  7 +++++
 .../__tests__/postgres/embedded-lifecycle.test.ts  | 32 ++++++++++++++++++----
 packages/core/src/postgres/embedded-lifecycle.ts   | 17 +++++++++---
 3 files changed, 47 insertions(+), 9 deletions(-)

Fusion-Task-Id: FN-8499

Fusion-Task-Lineage: 1ca453f4-f619-452c-9112-f32ff8fb8128

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-22 14:56:51 -07:00
gsxdsm
1e05793876 fix(ci): green full-suite bookkeeping after origin/main cutover (#2392)
## Summary

Restores green merge-gate and package-default suites after repeated
`origin/main` merges brought workflow-graph ownership cutover drift into
CI.

- Align engine/dashboard/core tests with post-cutover contracts
(`moveTaskIf`/`deleteTaskIf`, graph handoff, worktree-pool reclaim via
`removeWorktree` + `RemovalReason`, multi-step RESUMING parse,
soft-pause merge requester, graph-terminal failure surfaces).
- Small product fixes needed for real regressions uncovered by the
suite: soft-delete refuse before graph routing, skip DUPLICATE
step-heading withhold when an explicit marker is present, PG schema
applier guards, and related bookkeeping (research promote tool inventory
/ migration seed, stop shell `psql` in PG admin DDL).
- Quarantine/ledger hygiene only where required by standing rules; no
timeout/worker appeasement.

## Verification

- `pnpm test:gate` ×2 green
- `@fusion/engine` full package suite green (~9083 tests)
- Targeted core/dashboard clusters green (schema applier, agent-runs UI,
settings descriptions, mobile close)

## Test plan

- [x] `pnpm test:gate` (twice)
- [x] `pnpm --filter @fusion/engine test`
- [ ] CI full suite / PR checks on this branch
- [ ] Confirm no unrelated product behavior changes beyond the listed
regression fixes

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

* **New Features**
* Added support for `roadmap-item` native structure kinds, including
native structure embeds and metadata validation.
  * Added Stable and Beta release channel options in General settings.
* Added per-action reporting target configuration with clearer “unset”
guidance.

* **Bug Fixes**
  * Improved heartbeat/prompt behavior when patrol is disabled.
  * Prevented deleted tasks from continuing through execution.
  * Made recovery for explicit duplicate redirects more permissive.
* Hardened database migration and test database cleanup to reduce flaky
failures.

* **Documentation**
* Updated settings text for release channels, reporting targets, and
inheritance/unset behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-21 23:09:30 -07:00
gsxdsm
190dc07521 FN-8462: fix legacy-adoption marker permissions
Prevent inaccessible legacy-adoption markers from triggering repeated CLI sweeps and warning spam.

- Grant fusion_runtime public schema access for the drained-marker read path
- Deduplicate permanent marker infrastructure diagnostics while preserving fail-open sweeps
- Cover runtime-role marker access and migration registration
- Add a patch changeset for the CLI fix

Files changed:
 .../fn-8462-legacy-adoption-drained-marker.md      |  7 ++
 .../core/src/__tests__/legacy-adoption.test.ts     | 37 ++++++++-
 .../legacy-adoption-runtime-marker.test.ts         | 90 ++++++++++++++++++++++
 .../src/__tests__/postgres/schema-applier.test.ts  | 16 ++++
 ...gacy_adoption_drained_marker_runtime_grants.sql |  8 ++
 packages/core/src/task-store/lifecycle-ops.ts      | 70 +++++++++++++----
 6 files changed, 210 insertions(+), 18 deletions(-)

Fusion-Task-Id: FN-8462

Fusion-Task-Lineage: cb93de43-32f3-4c13-9989-b3dd08d33af8

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-21 19:10:55 -07:00
gsxdsm
4d588ad091 fix(postgres): allow fusion_runtime to write legacy-adoption drained marker
Store-open adoption runs as fusion_runtime, which lacked grants on
public.fusion_schema_migrations, so the drained-marker write failed every
boot. Migration 0032 grants SELECT plus a SECURITY DEFINER helper limited
to the exact marker, and store-open calls that helper instead of raw INSERT.
2026-07-21 17:27:09 -07:00
gsxdsm
83209e64dc fix(workflows): align stages with board columns (#2378)
## Summary

The Coding (Ideas) workflow now behaves like the board it presents:
Ideas stays inert, Todo owns planning and plan review, In progress owns
implementation, and In review owns code review and merge. The restored
preset is intentionally limited to that five-stage path, while the
existing Coding workflow remains unchanged.

Workflow execution now suspends at Todo→In progress instead of running
the implementation node early. A durable, single-owner continuation
records the exact resume node and survives process restarts; the
scheduler remains the only component allowed to admit the task into WIP.
Disabled optional review groups traverse the same boundary without
invoking a reviewer, avoiding the prior stuck-task behavior.

Workflow validation also rejects capacity holds with no reachable WIP
destination, so deterministic lifecycle deadlocks fail at authoring time
rather than after a task is running.

Session-settled decisions carried from planning: columns are execution
invariants, scheduler-owned WIP admission is preserved, the existing
Coding (Ideas) preset is restored and simplified, and invalid release
topology is rejected (user-approved).

## Validation

- `pnpm lint`
- `pnpm verify:fast`
- `pnpm test:gate` (296 engine, 128 PostgreSQL core, and 63 CI-shape
tests)
- Focused workflow lifecycle tests (106 assertions)
- PostgreSQL regression coverage proves atomic continuation replacement
and database rejection of a second active owner


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

* **New Features**
* Added durable, resumable workflow execution across capacity boundaries
(including explicit suspend/resume at the correct node).
* Introduced Todo “plan review” workflow continuations and automated
planning/capacity draining.
* Restored Coding (Ideas) as a selectable built-in and updated its lane
placement; improved optional-step group enablement support.
* **Bug Fixes**
  * User moves back to Todo now cancels active workflow continuations.
* Rejected workflow boundary transitions now surface as errors (instead
of silently continuing).
* Workflows with undriveable capacity-hold configurations are now
rejected.
* **Tests / Data**
* Expanded coverage for workflow suspension, continuations, and
continuation replacement; updated database schema to persist
continuation metadata and enforce single active continuation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-21 12:17:47 -07:00
gsxdsm
76cecacddd FN-8451: prevent embedded Postgres double starts
Prevent TaskStore boot collisions when an existing PostgreSQL pid file cannot yet be parsed.

- Read live postmaster pid files asynchronously with bounded retries.
- Fail closed when a present pid file has no readable port.
- Cover join, unreadable pid, and fresh-start lifecycle paths.

Files changed:
 packages/core/src/__tests__/postgres/embedded-lifecycle.test.ts | 119 +++++++++++++++++++++
 packages/core/src/postgres/embedded-lifecycle.ts                |  49 ++++++---
 2 files changed, 155 insertions(+), 13 deletions(-)

Fusion-Task-Id: FN-8451

Fusion-Task-Lineage: 823a874d-97ef-4380-97ce-e41981f660ff

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-21 10:33:28 -07:00
Drew Donaldson
e74183359a fix(postgres): sanitize NUL bytes in chat/mailbox writes; retry embedded-PG join race (#2366)
## Summary

Chat messages, chat room messages, and agent/user mailbox sends could
crash mid-conversation when the persisted content or metadata contained
a raw U+0000 (NUL) byte — e.g. Windows CLI diagnostic/tool output piped
directly into a message body. PostgreSQL text/jsonb columns reject NUL
outright (`unsupported Unicode escape sequence` / `\u0000 cannot be
converted to text`), which surfaced as an uncaught `PostgresError` that
aborted the write and killed the conversation turn.

A NUL-byte sanitizer already existed for the one-time SQLite →
PostgreSQL first-boot migration (`sqlite-migrator.ts`'s
`stripNulChars`/`deepStripNulChars`), but it was never wired into the
**live** write paths — only into that one-shot migration.

## What changed

- Extracted `stripNulChars`/`deepStripNulChars` into a shared
`packages/core/src/postgres/nul-sanitize.ts` module
(`sqlite-migrator.ts` now imports from it instead of defining its own
copy).
- Wired sanitization into the three live write paths that persist
free-form content/metadata:
  - `async-chat-store.ts`: `addChatMessage`, `addChatRoomMessage`
  - `async-message-store.ts`: `sendMessage`
- Each of these functions now also **returns the sanitized value** —
previously they returned the original, unsanitized input object even
though the sanitized value is what was actually persisted to the
database, which was a latent inconsistency I found while adding test
coverage.

## Bonus fix: embedded-Postgres startup race

While rebuilding and testing this locally via `pnpm smoke:boot`, I hit a
separate, pre-existing, reproducible race: a process joining an existing
embedded-Postgres data dir (via `postmaster.pid`, per the existing
`FNXC:PostgresStartupRace 2026-07-15-20:45` comment in
`embedded-lifecycle.ts`) can race the true owner's TCP listener bind and
get `ECONNREFUSED` on its very first connection attempt.
`bootSchemaBackendOnce` turned this into a hard `startup-factory: failed
to initialize PostgreSQL schema backend` failure with no retry.

I verified this is **not** caused by my NUL-sanitize change — it
reproduces identically on unmodified `main` (confirmed via `git stash`).

Added `JoinedInstanceUnreachableError` and one retry (mirroring the
existing `NonUtf8EmbeddedClusterError` one-retry pattern already in the
same file) instead of failing the whole boot outright.

## Tests

- New unit tests for the shared sanitizer:
`packages/core/src/__tests__/nul-sanitize.test.ts` (10 tests, including
a regression test reproducing the exact production failure signature).
- New PostgreSQL integration test coverage in the existing `.pg.test.ts`
suites, reproducing the exact production failure payload for both
`addChatMessage` and `sendMessage` and asserting both the in-memory
return value and the re-read-from-database value are NUL-free.
- Verified end-to-end against a real, disposable PostgreSQL 16 instance
(outside the vitest harness, since this dev machine lacked a local
`psql`/`pg_dump` client at the time) using a standalone script that
calls the actual patched functions with the production crash payload —
all checks passed before and after the return-value fix was added.
- `pnpm --filter @fusion/core typecheck` clean.

## Changeset

Included (`patch`, category `fix`).


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

* **Bug Fixes**
* Prevented crashes and PostgreSQL insertion failures when chat or
mailbox content/JSON metadata contains raw NUL (`U+0000`) bytes.
* NUL characters are now stripped from message text and deeply from
nested metadata (including JSON object keys) before writes, and
sanitized values are reflected in returned messages.
* Improved embedded PostgreSQL startup reliability by retrying once on
transient joined-instance connection-refused failures.
* **Tests**
* Added unit and PostgreSQL regression coverage for NUL sanitization
across message/chat paths and for the embedded startup retry scenario.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-21 00:00:08 -07:00
gsxdsm
ba08d90574 fix(core): allow scoped migration health reads
Grant the restricted runtime role read-only access to its own SQLite cutover marker. Repair existing databases with migration 0030 and apply the same row-scoped policy when first-boot migration creates the ledger.
2026-07-20 16:10:46 -07:00
gsxdsm
1d4e8afa7b FN-8444: include planning time in task metrics
Track active planning time alongside execution time for costs, analytics, and task displays.

- Persist planning timing state across task lifecycle transitions and recovery
- Include planning activity in token cost, analytics, and dashboard timing displays
- Add PostgreSQL migration support using the configured migration directory

Files changed:
 .changeset/fn-8444-planning-time-cost.md           |  7 +++
 docs/dashboard-guide.md                            |  3 ++
 docs/task-management.md                            |  5 ++
 packages/core/src/index.ts                         |  1 +
 .../migrations/0029_planning_active_timing.sql     |  3 ++
 packages/core/src/postgres/schema-applier.ts       | 14 ++++-
 packages/core/src/postgres/schema/project.ts       |  2 +
 packages/core/src/productivity-analytics.ts        | 29 +++++-----
 packages/core/src/store.ts                         |  2 +-
 .../core/src/task-store/archive-lifecycle-2.ts     |  2 +
 packages/core/src/task-store/moves.ts              |  7 +++
 packages/core/src/task-store/persistence.ts        |  4 ++
 packages/core/src/task-store/remaining-ops-2.ts    |  2 +-
 packages/core/src/task-store/serialization.ts      |  7 +++
 packages/core/src/task-store/task-row-mappers.ts   |  2 +-
 packages/core/src/task-store/task-update.ts        | 10 ++++
 packages/core/src/task-timing.ts                   | 35 ++++++++++++
 packages/core/src/types.ts                         | 12 +++++
 packages/dashboard/app/components/TaskCard.tsx     | 13 ++---
 .../app/components/TaskTokenStatsPanel.tsx         |  6 ++-
 .../app/components/__tests__/TaskCard.test.tsx     | 17 ++++++
 .../app/utils/__tests__/taskTiming.test.ts         |  9 +++-
 packages/dashboard/app/utils/taskTiming.ts         | 14 +++++
 packages/dashboard/app/utils/taskTokenCost.ts      |  2 +
 .../dashboard/src/task-planner-chat-metrics.ts     | 14 ++++-
 packages/engine/src/__tests__/self-healing.test.ts | 61 +++++++++++++++++++++
 packages/engine/src/executor.ts                    | 50 +++++++++++++++++
 packages/engine/src/runtimes/in-process-runtime.ts |  3 ++
 packages/engine/src/self-healing.ts                | 62 ++++++++++++++++++++++
 packages/engine/src/triage.ts                      | 10 ++++
 packages/i18n/locales/en/app.json                  |  2 +-
 packages/i18n/locales/es/app.json                  |  2 +-
 packages/i18n/locales/fr/app.json                  |  2 +-
 packages/i18n/locales/ko/app.json                  |  2 +-
 packages/i18n/locales/zh-CN/app.json               |  2 +-
 packages/i18n/locales/zh-TW/app.json               |  2 +-
 36 files changed, 384 insertions(+), 36 deletions(-)

Fusion-Task-Id: FN-8444

Fusion-Task-Lineage: 0178e0a7-3018-4ef4-be9b-6de5f964fb58

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-20 13:40:50 -07:00
gsxdsm
4f0d89e106 FN-8419: safeguard project partition reconciliation
Safely reconcile fallback and registered project partitions during dashboard startup.

- Merge duplicate partition rows with fallback data taking precedence.
- Validate unique indexes and foreign-key dependencies before rekeying.
- Bind safely after failed promotion and stop non-retryable dashboard failures.
- Add PostgreSQL reconciliation and supervisor coverage.

Files changed:
 .changeset/fn-8419-rekey-partition-merge.md        |   7 +
 packages/cli/src/bin.ts                            |   5 +-
 .../commands/__tests__/dashboard-supervise.test.ts |  16 +-
 packages/cli/src/commands/dashboard.ts             |  41 ++-
 .../src/__tests__/postgres/schema-applier.test.ts  | 178 +++++++++++-
 packages/core/src/async-secrets-store.ts           |   9 +-
 packages/core/src/index.ts                         |   8 +-
 packages/core/src/postgres-errors.ts               |   9 +
 packages/core/src/postgres/index.ts                |   5 +
 packages/core/src/postgres/migration-stamping.ts   | 318 ++++++++++++++++-----
 packages/core/src/postgres/startup-factory.ts      |  49 +++-
 packages/core/src/process-supervisor.ts            |   3 +
 packages/core/src/task-store/async-persistence.ts  |   7 +-
 13 files changed, 546 insertions(+), 109 deletions(-)

Fusion-Task-Id: FN-8419

Fusion-Task-Lineage: bfc54e40-a31e-4b61-b6ae-01eb147efde1

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-20 01:54:42 -07:00
gsxdsm
3008eb2dd8 FN-8405: add durable task symbol declarations
Persist normalized task symbol declarations and resolve symbols solely from durable task data.

- Add declared-symbol parsing, normalization, and durable TaskStore resolution APIs.
- Persist declarations through PostgreSQL migration, task serialization, and archive/restore flows.
- Cover declaration precedence and schema upgrades with core tests.

Files changed:
 docs/architecture.md                               |   1 +
 docs/storage.md                                    |   1 +
 .../src/__tests__/postgres/schema-applier.test.ts  |  39 +++-
 .../src/__tests__/task-symbol-resolution.test.ts   | 222 +++++++++++++++++++++
 packages/core/src/index.ts                         |  10 +
 .../core/src/postgres/migrations/0000_initial.sql  |   1 +
 .../migrations/0028_task_declared_symbols.sql      |   1 +
 packages/core/src/postgres/schema-applier.ts       |  12 +-
 packages/core/src/postgres/schema/project.ts       |   1 +
 packages/core/src/store.ts                         |  22 +-
 .../core/src/task-store/archive-lifecycle-2.ts     |   2 +
 packages/core/src/task-store/persistence.ts        |   4 +-
 packages/core/src/task-store/remaining-ops-2.ts    |   2 +-
 packages/core/src/task-store/serialization.ts      |   2 +
 packages/core/src/task-store/task-creation.ts      |   5 +
 packages/core/src/task-store/task-row-mappers.ts   |   2 +-
 packages/core/src/task-store/task-update.ts        |   9 +
 packages/core/src/task-symbol-resolution.ts        |  65 ++++++
 packages/core/src/types.ts                         |   5 +
 19 files changed, 400 insertions(+), 6 deletions(-)

Fusion-Task-Id: FN-8405

Fusion-Task-Lineage: ca86dbe5-cd4c-4f58-b607-678d669875af

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-19 21:19:56 -07:00
gsxdsm
90b9feb7ae fix: prevent false PostgreSQL corruption alerts (#2352)
## Summary

PostgreSQL runtime roles without `CREATE` permission on `public` no
longer trigger schema writes during migration-marker health reads, so
`permission denied for schema public` is not mislabeled as database
corruption. Once connectivity and task-ID integrity pass, an unavailable
migration marker is treated as advisory instead of making the whole
database unhealthy. Dashboard and notification guidance now describes a
PostgreSQL health failure accurately and renders actionable log and
recovery links in every supported locale.

## Validation

- 54 targeted tests passed across core, dashboard, engine, and i18n.
- Typechecks passed for all four affected packages.
- Scoped ESLint, strict changeset validation, and diff checks passed.

---

[![Compound
Engineering](https://img.shields.io/badge/Built_with-Compound_Engineering-6366f1)](https://github.com/EveryInc/compound-engineering-plugin)


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

* **Bug Fixes**
* PostgreSQL health failures are now reported as degraded health checks
rather than database corruption.
* Migration-status lookup failures no longer incorrectly mark an
otherwise healthy database as unhealthy.
* Migration-state checks are now read-only and avoid creating or
modifying database structures.

* **UI & Localization**
* Updated database health banner messaging and recovery guidance across
supported languages.
* The banner now appears for broader PostgreSQL health failures and
links to storage documentation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-19 18:59:28 -07:00
gsxdsm
e4a032d9d9 FN-8399: expose incomplete migration status on dashboard
Expose durable SQLite-to-PostgreSQL migration state through dashboard health and banners.

- Read per-project running and failed migration markers from PostgreSQL
- Surface degraded migration state in health endpoints and dashboard banners
- Preserve migration context across CLI and runtime startup paths
- Document the recovery workflow and add a patch changeset

Files changed:
 .changeset/FN-8399-migration-status-dashboard.md   |  7 +++
 docs/storage.md                                    |  5 ++
 packages/cli/src/commands/daemon.ts                | 19 +++++++
 packages/cli/src/commands/desktop.ts               |  6 +++
 packages/cli/src/commands/serve.ts                 | 20 +++++++-
 packages/core/src/index.ts                         |  2 +
 packages/core/src/postgres/index.ts                |  2 +
 packages/core/src/postgres/sqlite-migrator.ts      | 43 ++++++++++++++++
 packages/dashboard/app/api/health.ts               |  7 ++-
 .../app/components/dashboard/DashboardBanners.tsx  | 18 ++++++-
 .../dashboard/__tests__/DashboardBanners.test.tsx  | 12 ++++-
 .../__tests__/dashboard-postgres-health.test.ts    | 45 +++++++++++++++++
 .../dashboard/src/dashboard-postgres-health.ts     | 58 ++++++++++++++++++++++
 packages/dashboard/src/server.ts                   | 27 ++++++++--
 packages/engine/src/project-engine-manager.ts      |  4 ++
 packages/engine/src/project-runtime.ts             |  9 +++-
 packages/engine/src/runtimes/in-process-runtime.ts |  1 +
 17 files changed, 275 insertions(+), 10 deletions(-)

Fusion-Task-Id: FN-8399

Fusion-Task-Lineage: e196d6c4-ea9a-48ba-bedc-9e6fa44c33d3

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-19 16:52:02 -07:00
gsxdsm
05a02e8061 refactor(cutover 1/3): core — IR-driven lifecycle foundation (#2341)
Part **1 of 3** of the IR-driven lifecycle cutover (split from #2335 to
fit review-tool file limits; plan:
docs/plans/2026-07-18-001-refactor-ir-driven-lifecycle-cutover-plan.md,
included here).

**Scope (48 files, packages/core + docs/plans):** shared transition
policy + validator (KTD-5), IR validation hardening incl. the benchmark
capability floor, CAS review leases (KTD-4), pooled WIP capacity budgets
(KTD-9), lifecycle-trait helpers, durable IR pin/drift detection
(KTD-3), review-level creation-time preset, legacy adoption module +
census + migration 0026 + stale-binary guard (KTD-8), core-side builtin
workflow fixes (single default-IR authority, no-merge complete-column
support).

Note: `workflow-cutover.ts` (interpreter parity scaffolding) stays alive
in this PR — its last consumer dies in part 2/3, which retires it.

**Merge order:** this PR → #TBD-2 (engine) → #2335 (dashboard/top).

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

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

* **New Features**
* Added workflow-trait-driven task lifecycle transitions, including WIP
capacity pooling and workflow-aware recovery (IR pinning + drift
detection).
* Added legacy adoption/backfill for pre-cutover task states, with
unmappable rows safely parked.
* Added create-time `reviewLevel` presets to automatically configure
enabled workflow steps.
* **Bug Fixes**
  * Fixed workflow moves when no workflow selection exists.
* Improved merge-blocker validation to be keyed to the workflow’s actual
review-lane identity, preventing invalid moves and misclassified
terminal states.
* **Tests**
* Added end-to-end and unit/integration coverage for workflow
validation, legacy adoption, migrations/schema guards, leases, review
presets, and transition rules.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 11:50:52 -07:00
Drew Donaldson
c0eafc2fce fix(postgres): widen overflow-prone token/usage counters to bigint (#2331)
SQLite INTEGER is effectively int64, but the PostgreSQL baseline mapped
unbounded token/usage counters on `project.tasks` and
`project.chat_token_usage` to `integer` (int4). Real data contains
values > 2,147,483,647, causing the SQLite-to-PostgreSQL migration to
fail with `value ... is out of range for type integer`.

Changes:
- Change baseline DDL to `bigint` for the affected columns.
- Update Drizzle schema to `bigint({ mode: "number" })` to preserve JS
`number` semantics.
- Add forward migration `0024_bigint_counters.sql` for existing
clusters.
- Bump `SCHEMA_BASELINE_VERSION` to `0024`.

Fixes the int4 overflow observed during migration of large token/usage
counters.

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

* **Bug Fixes**
* Expanded token-usage and activity/lease counters to 64-bit integers to
prevent overflow on large workloads.
* Improved distributed task ID state/reservations to be isolated per
project and to merge/update conflicting entries more reliably.
* **Chores**
* Added an idempotent PostgreSQL migration for bigint counter support
and advanced schema baseline tracking.
* Updated dashboard build support by adding `html2canvas` type
definitions and the production dependency.
* **Tests**
* Updated schema-applier migration checks to include the new
bigint-counters baseline identity.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: gsxdsm <gsxdsm@users.noreply.github.com>
2026-07-19 10:15:30 -07:00
gsxdsm
ecffdbb14b fix: isolate test-mode database access
Prevent automated tests from inheriting production PostgreSQL URLs and route global test-mode startups to a dedicated external or embedded test database.
2026-07-19 00:10:02 -07:00
gsxdsm
b61311baa8 FN-8305: add durable PostgreSQL symbol locks
Introduce durable project-scoped symbol locks backed by PostgreSQL.

- Add normalized lease-based lock acquisition, renewal, release, and reconciliation APIs with audit events.
- Add PostgreSQL schema migrations and self-healing reconciliation coverage.
- Document the lock model and test migration and lock behavior.

Files changed:
 AGENTS.md                                          |   1 +
 docs/architecture.md                               |   1 +
 docs/storage.md                                    |   7 +
 .../src/__tests__/postgres/schema-applier.test.ts  | 115 +++++++++-
 packages/core/src/__tests__/symbol-locks.test.ts   |  91 ++++++++
 packages/core/src/index.ts                         |  17 ++
 .../core/src/postgres/migrations/0000_initial.sql  |  25 +++
 .../src/postgres/migrations/0025_symbol_locks.sql  |  63 ++++++
 packages/core/src/postgres/schema-applier.ts       |  18 +-
 packages/core/src/postgres/schema/project.ts       |  29 +++
 packages/core/src/store.ts                         |  23 ++
 packages/core/src/symbol-lock-types.ts             |  60 +++++
 packages/core/src/task-store/symbol-locks.ts       | 244 +++++++++++++++++++++
 .../__tests__/symbol-lock-reconciliation.test.ts   |  19 ++
 packages/engine/src/self-healing.ts                |  35 +++
 15 files changed, 745 insertions(+), 3 deletions(-)

Fusion-Task-Id: FN-8305

Fusion-Task-Lineage: efd95c73-23e3-4359-8204-dfad374a39bc

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-18 19:31:30 -07:00
gsxdsm
38891bfd81 FN-8296: add chat-requested task verification
Enable chat agents to queue and monitor executor-owned verification runs.

- Persist task verification requests through a new PostgreSQL migration.
- Expose action-gated chat request and status tools with executor processing.
- Show verification status in task and Command Center views.
- Advance the schema baseline to migration 0024 and keep chat mocks complete.

Files changed:
 .changeset/fn-8296-feature.md                      |  7 ++
 docs/agent-tool-surface-full-loop.md               | 10 +--
 docs/dashboard-guide.md                            |  4 +
 packages/core/src/index.ts                         |  2 +
 .../core/src/postgres/migrations/0000_initial.sql  | 20 +++++
 .../migrations/0024_task_verification_request.sql  | 20 +++++
 packages/core/src/postgres/schema-applier.ts       | 13 ++-
 packages/core/src/postgres/schema/project.ts       | 25 ++++++
 packages/core/src/store.ts                         | 16 +++-
 packages/core/src/task-store/reads.ts              | 14 +++-
 packages/core/src/task-store/remaining-ops-6.ts    | 49 ++++++++++-
 packages/core/src/types.ts                         | 30 +++++++
 packages/dashboard/app/api/legacy.ts               |  1 +
 packages/dashboard/app/api/task-content.ts         | 10 +++
 .../dashboard/app/components/TaskDetailModal.tsx   | 17 +++-
 .../app/components/TaskVerificationStatus.css      | 94 ++++++++++++++++++++++
 .../app/components/TaskVerificationStatus.tsx      | 39 +++++++++
 .../__tests__/TaskVerificationStatus.test.tsx      | 28 +++++++
 .../components/command-center/CommandCenter.css    | 33 ++++++++
 .../components/command-center/CommandCenter.tsx    | 37 ++++++++-
 packages/dashboard/src/__tests__/chat.test.ts      |  1 +
 packages/dashboard/src/chat.ts                     | 55 +++++++++++++
 .../src/routes/register-command-center-routes.ts   | 20 +++++
 .../src/routes/register-task-workflow-routes.ts    | 17 ++++
 packages/engine/src/executor.ts                    | 51 +++++++++++-
 packages/engine/src/gating-classifications.ts      |  5 ++
 packages/engine/src/index.ts                       |  2 +-
 27 files changed, 605 insertions(+), 15 deletions(-)

Fusion-Task-Id: FN-8296

Fusion-Task-Lineage: f94647cf-c89f-4f0e-b25f-cbf5b56683bc

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-18 18:38:47 -07:00
gsxdsm
a3dda8eaff fix(core): prevent concurrent startup database failures (#2330)
## Summary

Concurrent PostgreSQL project initialization no longer causes transient
dashboard failures, including repeated `GET /api/remote/status` 500
responses. The failure was a database deadlock between project-row
identity promotion and schema/plugin DDL, which previously acquired
overlapping locks in inconsistent orders.

This establishes one advisory-lock order across SQLite cutover, project
identity promotion, and schema mutations. Focused regression coverage
proves schema DDL waits behind an active migration transaction and that
identity stamping acquires the migration lock before reading
project-owned tables.

## Validation

- 25 focused unit tests passed.
- 3 focused real-PostgreSQL regression tests passed.
- `@fusion/core` typecheck passed.
- Strict changeset validation passed.
- Fast workspace verification passed, including the CLI build and boot
health check.

---

[![Compound
Engineering](https://img.shields.io/badge/Built_with-Compound_Engineering-6366f1)](https://github.com/EveryInc/compound-engineering-plugin)


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

## Summary by CodeRabbit

* **Bug Fixes**
* Prevented transient dashboard failures caused by PostgreSQL startup
and migration deadlocks.
* Improved serialization when multiple projects initialize or update
database schemas concurrently.
* Ensured migration state updates and schema changes occur in a
consistent order.

* **Tests**
* Added coverage for migration lock ordering, concurrent schema
operations, and recovery after lock contention.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-18 17:12:27 -07:00
gsxdsm
c95e08ea21 FN-8297: add research finding promotion to mission features
Bridge completed research findings into durable mission roadmap features.

- Persist stable finding and citation provenance on mission features
- Add idempotent promotion APIs, dashboard controls, and agent tooling
- Document the promotion flow and cover finding identity and feature synchronization

Files changed:
 .changeset/fn-8297-research-mission-bridge.md      |  7 ++++
 docs/missions.md                                   |  4 +++
 docs/research.md                                   |  4 +++
 .../__tests__/research-finding-identity.test.ts    | 15 +++++++++
 packages/core/src/async-mission-store-queries.ts   | 26 +++++++++++++++
 packages/core/src/async-mission-store.ts           | 16 +++++++++
 packages/core/src/index.gate.ts                    |  3 ++
 packages/core/src/index.ts                         |  3 ++
 packages/core/src/mission-types.ts                 | 13 ++++++++
 .../core/src/postgres/migrations/0000_initial.sql  |  4 +++
 .../0023_research_feature_provenance.sql           |  8 +++++
 packages/core/src/postgres/schema-applier.ts       | 13 +++++++-
 packages/core/src/postgres/schema/project.ts       |  5 +++
 packages/core/src/research-feature-promotion.ts    | 38 ++++++++++++++++++++++
 packages/core/src/research-types.ts                | 21 ++++++++++++
 packages/core/src/types.ts                         |  1 +
 packages/dashboard/app/api/legacy.ts               | 21 ++++++++++++
 packages/dashboard/app/components/ResearchView.tsx | 19 ++++++-----
 packages/dashboard/app/hooks/useResearch.ts        |  3 ++
 packages/dashboard/src/chat.ts                     |  4 +--
 packages/dashboard/src/research-routes.ts          | 37 +++++++++++++++++----
 .../src/__tests__/agent-mission-tools.test.ts      | 14 +++++++-
 .../src/__tests__/mission-feature-sync.test.ts     | 20 ++++++++++++
 packages/engine/src/agent-tools.ts                 | 26 +++++++++++++++
 packages/engine/src/mission-feature-sync.ts        |  1 +
 25 files changed, 308 insertions(+), 18 deletions(-)

Fusion-Task-Id: FN-8297

Fusion-Task-Lineage: ffef4d26-1372-466a-8d3d-2b9b5cc9a53b

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-18 16:18:15 -07:00
gsxdsm
7b1a89d1bc fix(core): join running embedded Postgres correctly
Read the live port from PostgreSQL's actual postmaster.pid field so extension TaskStore boot reuses the existing server instead of wedging on a colliding start.
2026-07-18 14:21:41 -07:00
gsxdsm
d51ce46db5 FN-8295: add persisted ideation mission handoffs
Persist bounded ideation sessions through agent tools, the Command Center, and atomic Mission convergence.

- Store ideation sessions and divergent candidates in PostgreSQL with async APIs and migration support.
- Expose gated ideation tools, chat routes, and agent lifecycle integration.
- Add the Ideation panel, documentation, release metadata, and regression coverage.

Files changed:
 .changeset/fn-8295-ideation-diverge-converge.md    |   7 ++
 docs/ideation/persisted-diverge-converge.md        |  22 ++++
 docs/missions.md                                   |   4 +
 .../__tests__/postgres/ideation-store.pg.test.ts   |  57 +++++++++
 packages/core/src/async-ideation-store-queries.ts  | 117 +++++++++++++++++
 packages/core/src/async-ideation-store.ts          | 138 +++++++++++++++++++++
 packages/core/src/async-mission-store.ts           |  27 ++--
 packages/core/src/ideation-types.ts                |  69 +++++++++++
 packages/core/src/index.ts                         |   3 +
 .../core/src/postgres/migrations/0022_ideation.sql |  67 ++++++++++
 packages/core/src/postgres/schema-applier.ts       |  18 ++-
 packages/core/src/postgres/schema/project.ts       |  49 +++++++-
 packages/core/src/store.ts                         |   8 +-
 packages/core/src/task-store/remaining-ops-8.ts    |  14 +++
 .../components/command-center/CommandCenter.tsx    |   7 +-
 .../components/command-center/IdeationPanel.css    |  18 +++
 .../components/command-center/IdeationPanel.tsx    |  58 +++++++++
 .../__tests__/CommandCenter.test.tsx               |   6 +-
 .../dashboard/src/__tests__/chat-manager.test.ts   |   1 +
 packages/dashboard/src/__tests__/chat.test.ts      |   1 +
 .../__tests__/ideation-tool-route-parity.test.ts   |  29 +++++
 packages/dashboard/src/chat.ts                     |   4 +
 packages/dashboard/src/ideation-routes.ts          |  50 ++++++++
 .../src/routes/register-integrated-routers.ts      |   2 +
 .../src/__tests__/agent-ideation-tools.test.ts     |  40 ++++++
 .../src/__tests__/gating-classifications.test.ts   |  16 +++
 .../src/__tests__/permanent-agent-gating.test.ts   |   2 +
 packages/engine/src/agent-heartbeat.ts             |   4 +-
 packages/engine/src/agent-tools.ts                 |  67 ++++++++++
 packages/engine/src/executor.ts                    |   2 +
 packages/engine/src/gating-classifications.ts      |   8 ++
 packages/engine/src/index.ts                       |   1 +
 packages/engine/src/triage.ts                      |   2 +
 33 files changed, 897 insertions(+), 21 deletions(-)

Fusion-Task-Id: FN-8295

Fusion-Task-Lineage: 1b8b0752-22bd-4b2f-aebd-4305c63abcf9

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-18 13:18:08 -07:00
gsxdsm
bcb1256d6b FN-8282: add configuration revision history and rollback
Record configuration revisions so prior settings can be restored safely.

- Add revision storage interfaces, PostgreSQL schema, migration, and pruning.
- Capture changes to global settings, routines, automations, and async task settings.
- Expose revision listing and restore operations with coverage and storage documentation.

Files changed:
 .changeset/fn-8282-config-versioning.md            |   7 +
 docs/storage.md                                    |   6 +
 .../__tests__/configuration-revision-store.test.ts |  26 +++
 .../src/__tests__/postgres/schema-applier.test.ts  |  15 +-
 .../core/src/async-configuration-revision-store.ts | 192 +++++++++++++++++++++
 packages/core/src/automation-store.ts              |  88 +++++++++-
 packages/core/src/configuration-revision-store.ts  |  33 ++++
 packages/core/src/global-settings.ts               | 172 +++++++++++++++++-
 packages/core/src/index.gate.ts                    |   3 +
 packages/core/src/index.ts                         |   3 +
 .../migrations/0021_configuration_revisions.sql    |  40 +++++
 packages/core/src/postgres/schema-applier.ts       |  19 +-
 packages/core/src/postgres/schema/project.ts       |  27 +++
 packages/core/src/routine-store.ts                 | 103 ++++++++++-
 packages/core/src/store.ts                         |  21 ++-
 packages/core/src/task-store/async-settings.ts     |  14 +-
 packages/core/src/task-store/remaining-ops-2.ts    |  86 ++++++++-
 packages/core/src/task-store/settings-ops.ts       | 104 +++++++----
 packages/core/src/types.ts                         |  36 ++++
 packages/engine/src/agent-tools.ts                 |   7 +-
 20 files changed, 928 insertions(+), 74 deletions(-)

Fusion-Task-Id: FN-8282

Fusion-Task-Lineage: fd681798-10b0-47ce-b96b-6f33eecdf70a

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-18 11:34:42 -07:00
gsxdsm
2c17fa70ab feat(postgres): make embedded connection cap configurable 2026-07-18 10:00:49 -07:00