Commit Graph

119 Commits

Author SHA1 Message Date
gsxdsm
27cb2d2621 FN-8921: add deterministic knowledge graph tooling
Add a committable, provenance-tagged knowledge graph layer with CLI generation and query support.

- Extract TypeScript, Markdown, and FNXC knowledge into deterministic graph nodes and edges.
- Persist recoverable graph artifacts outside ignored Fusion state and expose build/query CLI commands.
- Document configuration and add core and CLI coverage for graph structure, serialization, and recovery.

Files changed:
 .changeset/fn-8921-knowledge-graph.md              |   7 +
 .gitattributes                                     |   3 +
 AGENTS.md                                          |   1 +
 docs/README.md                                     |   2 +
 docs/cli-reference.md                              |   4 +
 docs/knowledge-graph.md                            |  37 +++++
 docs/settings-reference.md                         |   4 +
 docs/storage.md                                    |   2 +
 packages/cli/package.json                          |   3 +-
 .../__tests__/knowledge-graph-bundle-shape.test.ts |   4 +
 .../src/__tests__/knowledge-graph-command.test.ts  | 115 ++++++++++++++
 packages/cli/src/bin.ts                            |  19 +++
 packages/cli/src/commands/knowledge-graph.ts       |  79 ++++++++++
 packages/cli/tsup.config.ts                        |   2 +
 packages/core/package.json                         |   4 +-
 packages/core/src/config/settings-schema.ts        |   2 +
 packages/core/src/index.ts                         |   1 +
 .../__tests__/derive-modules.test.ts               |  11 ++
 .../__tests__/extract-file-composition.test.ts     |  20 +++
 .../knowledge-graph/__tests__/extract-fnxc.test.ts |  33 ++++
 .../__tests__/extract-markdown.test.ts             |  21 +++
 .../__tests__/extract-typescript.test.ts           |  30 ++++
 .../__tests__/file-discovery.test.ts               |  26 ++++
 .../graph-artifact-not-gitignored.test.ts          |  15 ++
 .../__tests__/graph-builder-equivalence.test.ts    |  76 ++++++++++
 .../__tests__/graph-builder-incremental.test.ts    |  52 +++++++
 .../__tests__/graph-identity.test.ts               |  11 ++
 .../knowledge-graph/__tests__/graph-query.test.ts  |  13 ++
 .../__tests__/graph-serialization.test.ts          |  29 ++++
 .../__tests__/graph-store-recovery.test.ts         | 106 +++++++++++++
 .../__tests__/resolve-imports.test.ts              |  10 ++
 .../core/src/knowledge-graph/derive-modules.ts     |   4 +
 packages/core/src/knowledge-graph/extract-file.ts  |   6 +
 packages/core/src/knowledge-graph/extract-fnxc.ts  | 168 +++++++++++++++++++++
 .../core/src/knowledge-graph/extract-markdown.ts   |   9 ++
 .../core/src/knowledge-graph/extract-typescript.ts | 107 +++++++++++++
 .../core/src/knowledge-graph/file-discovery.ts     |  85 +++++++++++
 packages/core/src/knowledge-graph/graph-builder.ts | 141 +++++++++++++++++
 .../core/src/knowledge-graph/graph-manifest.ts     |   4 +
 packages/core/src/knowledge-graph/graph-query.ts   | 126 ++++++++++++++++
 .../src/knowledge-graph/graph-serialization.ts     | 134 ++++++++++++++++
 packages/core/src/knowledge-graph/graph-store.ts   |  97 ++++++++++++
 packages/core/src/knowledge-graph/graph-types.ts   |  54 +++++++
 packages/core/src/knowledge-graph/index.ts         |  14 ++
 .../core/src/knowledge-graph/resolve-imports.ts    |   4 +
 packages/core/src/types/settings/settings-scope.ts |   2 +
 pnpm-lock.yaml                                     |  12 +-
 47 files changed, 1700 insertions(+), 9 deletions(-)

Fusion-Task-Id: FN-8921

Fusion-Task-Lineage: 7014d0f1-fc47-454b-afe5-5f0d9b229f33

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-10 06:15:17 -07:00
gsxdsm
5573d042a9 FN-8922: add persistent memory recall store
Add PostgreSQL-backed recall records for durable project memory retrieval.

- add recall record types, storage, search, deduplication, and prompt instructions
- migrate project schemas and expose recall APIs from core memory modules
- document plugin and storage contracts, with unit and PostgreSQL coverage

Files changed:
 .changeset/fn-8922-memory-recall-store.md          |   7 +
 docs/memory-plugin-contract.md                     |  10 +
 docs/storage.md                                    |   4 +
 .../__tests__/memory-recall-dedup-search.test.ts   |  10 +
 .../__tests__/memory-recall-instructions.test.ts   |  62 +++++
 .../postgres/memory-recall-store.pg.test.ts        | 296 +++++++++++++++++++++
 .../src/__tests__/postgres/schema-applier.test.ts  |  15 +-
 packages/core/src/index.ts                         |   1 +
 packages/core/src/memory/index.ts                  |   1 +
 packages/core/src/memory/project-memory.ts         |  33 ++-
 packages/core/src/memory/recall/index.ts           |  10 +
 packages/core/src/memory/recall/recall-dedup.ts    |  35 +++
 .../core/src/memory/recall/recall-instructions.ts  |  59 ++++
 packages/core/src/memory/recall/recall-search.ts   |  20 ++
 packages/core/src/memory/recall/recall-store.ts    |  51 ++++
 packages/core/src/memory/recall/recall-types.ts    |  14 +
 .../0052_fn_8922_memory_recall_records.sql         |  17 ++
 packages/core/src/postgres/schema-applier.ts       |  13 +-
 packages/core/src/postgres/schema/project.ts       |  10 +-
 19 files changed, 648 insertions(+), 20 deletions(-)

Fusion-Task-Id: FN-8922

Fusion-Task-Lineage: bb98f048-6fcf-46d9-bd1f-09294c2dc005

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-10 04:46:10 -07:00
gsxdsm
6bd178bdcf FN-8864: add durable agent activity stream
Add a persisted, project-scoped agent activity feed with query and live delivery surfaces.

- Store sequenced, attributed activity events with privacy-safe metadata and retention.

- Emit activity across agents, workflow execution, reviews, approvals, merges, and recovery.

- Provide paginated API history and resilient SSE tailing with coverage and documentation.

- Renumber the activity migration to 0049 after reconciling main’s 0048 GitHub check-state migration.

Files changed:

 .changeset/fn-8864-agent-activity-events.md        |   7 +
 docs/architecture.md                               |   8 +
 docs/diagnostics.md                                |   4 +
 docs/storage.md                                    |   1 +
 .../__tests__/agent-activity-attribution.test.ts   |  21 +
 .../agent-activity-metadata-hygiene.test.ts        |  60 +++
 .../src/__tests__/agent-activity-writers.test.ts   |  94 +++++
 .../postgres/agent-activity-events.pg.test.ts      |  57 +++
 .../src/__tests__/postgres/schema-applier.test.ts  |  34 +-
 packages/core/src/agents/agent-store.ts            |  24 ++
 packages/core/src/agents/approval-request-store.ts |  15 +-
 packages/core/src/index.ts                         |   4 +
 .../0049_fn_8864_agent_activity_events.sql         |  24 ++
 packages/core/src/postgres/schema-applier.ts       |  15 +-
 packages/core/src/postgres/schema/project.ts       |  19 +-
 packages/core/src/store.ts                         |  17 +
 .../core/src/task-store/agent-activity-outbox.ts   |  75 ++++
 .../src/task-store/async/async-agent-activity.ts   |  71 ++++
 packages/core/src/types.ts                         |   2 +
 packages/core/src/types/agents/agents.ts           |  79 ++++
 packages/dashboard/app/api.ts                      |  54 +++
 .../src/__tests__/agent-activity-route.test.ts     |  68 ++++
 .../src/__tests__/sse-agent-activity.test.ts       | 315 +++++++++++++++
 packages/dashboard/src/routes/README.md            |   2 +-
 .../src/routes/register-setup-activity-routes.ts   |  19 +-
 packages/dashboard/src/sse.ts                      | 139 ++++++-
 .../src/__tests__/agent-activity-writers.test.ts   | 442 +++++++++++++++++++++
 packages/engine/src/executor.ts                    | 110 ++++-
 packages/engine/src/merger.ts                      |  15 +-
 packages/engine/src/self-healing.ts                |  35 +-
 30 files changed, 1809 insertions(+), 21 deletions(-)

Fusion-Task-Id: FN-8864
Fusion-Task-Lineage: 4938f35b-a0bc-4eb3-905c-178fed859cc6
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-09 14:39:17 -07:00
gsxdsm
fb125b6f5e FN-8852: exclude heartbeat writes from revision history
Prevent liveness bookkeeping from evicting real settings changes while making revision history pageable.

- Exclude engineLastActiveAt from project revision snapshots and preserve its live value during rollback.
- Add validated limit/offset paging with hasMore to configuration revision stores and the API.
- Cover heartbeat filtering, rollback compatibility, and paging contracts; document the behavior and add a patch changeset.

Files changed:
 .changeset/fn-8852-config-revision-heartbeat.md    |   7 +
 docs/settings-reference.md                         |   4 +
 docs/storage.md                                    |   6 +
 .../__tests__/configuration-revision-store.test.ts | 178 ++++++++++++++++++++-
 .../configuration-revision-heartbeat.pg.test.ts    | 118 ++++++++++++++
 .../async-configuration-revision-store.ts          |  46 ++++--
 .../src/config/configuration-revision-store.ts     |   9 +-
 packages/core/src/config/global-settings.ts        |   2 +-
 packages/core/src/config/settings-schema.ts        |  20 +++
 packages/core/src/index.gate.ts                    |   2 +-
 packages/core/src/index.ts                         |   2 +-
 packages/core/src/task-store/task-mutation-ops.ts  |  24 ++-
 packages/core/src/types.ts                         |   6 +
 packages/core/src/types/settings/settings-scope.ts |   3 +
 .../register-org-portability-routes.test.ts        |  19 ++-
 .../src/routes/register-org-portability-routes.ts  |  18 ++-
 16 files changed, 437 insertions(+), 27 deletions(-)

Fusion-Task-Id: FN-8852

Fusion-Task-Lineage: 46d5ac9d-d2c0-4294-a5f7-d228fcb341c9

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-08 23:16:01 -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
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
4009eb34cb FN-8683: remove unreachable SQLite task polling replica
Document PostgreSQL task-deletion observation and remove the obsolete SQLite polling path.

- Remove polling state, replica emissions, and activity-log suppression from TaskStore.
- Retain backend-aware cache warming while documenting the transactional-outbox follow-up.
- Add tombstone and soft-delete abort coverage across core and engine lanes.

Files changed:
 docs/architecture.md                               |   3 +-
 ...tgres-cross-process-task-deleted-observation.md | 128 ++++++++++++++++
 docs/storage.md                                    |   3 +-
 .../task-delete-nonblocking-cleanup.test.ts        |  54 +++++++
 .../task-deleted-polling-replica-tombstone.test.ts |  57 +++++++
 .../task-updated-lanes-emit-surfaces.test.ts       |  26 ----
 packages/core/src/store.ts                         |  13 +-
 packages/core/src/task-store/lifecycle-ops.ts      | 168 ++-------------------
 packages/core/src/task-store/task-artifacts-ops.ts |   4 -
 .../__tests__/executor-soft-delete-abort.test.ts   |  15 ++
 .../src/__tests__/triage-soft-delete-abort.test.ts |  14 ++
 11 files changed, 284 insertions(+), 201 deletions(-)

Fusion-Task-Id: FN-8683
Fusion-Task-Lineage: a052db0c-b6fc-4b05-b6b2-f8217b56ded0
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-01 03:24:36 -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
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
flexi767
f21d3ce132 feat(core): support additive archived task documents (#2375)
## Summary

Re-lands the completed Fusion board task FX-005 on current upstream
`main`, stacked on #2374 (FX-004).

- adds a narrowly authorized additive publication path for archived task
documents
- preserves archived task and mission state and keeps ordinary
replacement/deletion writes rejected
- exposes retained archived current/revision reads
- requires project-scoped revision/hash CAS for publication
- maps malformed, unauthorized, missing, inconsistent, and stale states
safely
- rebases preserved dashboard drafts explicitly after CAS conflicts

## Why

Operators need to append a correction or evidence revision to an
archived task without unarchiving it or weakening ordinary archived-task
immutability.

## Dependency

This branch contains #2374 plus the eight FX-005 commits because
cross-fork PRs cannot target a fork-only base branch. After #2374 lands,
this PR should be rebased or refreshed so its diff collapses to FX-005
only.

## Validation

- PostgreSQL task-store and archived-default suites: 33/33
- dashboard route and editor suites: 321/321
- agent document tools: 22/22
- core, dashboard, and engine typechecks pass

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

## Summary by CodeRabbit

* **New Features**
* Added optimistic concurrency controls for task document creation and
editing using revisions and content hashes.
* Added safe, authenticated append-only corrections for documents
retained on archived tasks.
* Archived documents and revision history remain available for direct
reading.
* Agent and dashboard tools now report conflicts clearly and support
explicit draft rebasing.
* **Bug Fixes**
  * Prevented stale updates from overwriting newer document content.
* Preserved archived-task immutability while allowing controlled
corrections.
* **Documentation**
* Updated CLI, dashboard, storage, task-management, and agent guidance
for these workflows.

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

---------

Co-authored-by: fusion-merge-train <merge-train@topkoli.local>
Co-authored-by: Fusion <noreply@runfusion.ai>
Co-authored-by: v <v@v.speedport.ip>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 08:30:12 -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
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
41f387b219 FN-8364: track task token usage from session deltas
Track only task-local deltas from cumulative session usage.

- Capture and reset baselines for reused, resumed, and heartbeat sessions
- Route executor prompt accounting through the shared per-session delta seam
- Cover token accounting behavior and document the analytics correction

Files changed:
 .changeset/fn-8364-session-token-deltas.md         |  7 +++
 docs/storage.md                                    |  2 +-
 .../src/__tests__/executor-token-usage.test.ts     | 48 +++++++++++++++++++-
 .../src/__tests__/heartbeat-executor.test.ts       | 42 +++++++++++++++++
 .../src/__tests__/session-token-usage.test.ts      | 53 +++++++++++++++++++++-
 packages/engine/src/agent-heartbeat.ts             | 10 +++-
 packages/engine/src/executor.ts                    | 44 +++++++++++-------
 packages/engine/src/session-token-usage.ts         | 20 ++++++++
 8 files changed, 205 insertions(+), 21 deletions(-)

Fusion-Task-Id: FN-8364

Fusion-Task-Lineage: 2b16a581-0d58-4c91-8903-6ce368b30a7c

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-19 15:38:31 -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
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
de1638e262 FN-8090: use mmap shared memory for embedded PostgreSQL
Enable constrained-host embedded PostgreSQL startup without SysV shared-memory exhaustion.

- Default embedded lifecycle flags to mmap-backed shared memory while preserving caller overrides
- Cover normal and elevated Windows launch paths with deterministic flag propagation tests
- Document the 64MB /dev/shm support floor and add a patch changeset

Files changed:
 .changeset/fn-8090-embedded-pg-shm.md              |  7 ++
 docs/postgres-migration-review-2026-07-14.md       |  4 +
 docs/storage.md                                    |  5 ++
 .../__tests__/postgres/embedded-lifecycle.test.ts  | 88 ++++++++++++++++++++++
 .../postgres/embedded-windows-admin.test.ts        | 17 +++++
 packages/core/src/postgres/embedded-lifecycle.ts   | 50 +++++++++++-
 .../core/src/postgres/embedded-windows-admin.ts    |  2 +-
 7 files changed, 168 insertions(+), 5 deletions(-)

Fusion-Task-Id: FN-8090

Fusion-Task-Lineage: ac175843-69ba-4c9c-9692-aff095fc351f

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-16 06:00:12 -07:00
gsxdsm
363916926d FN-7995: always persist tool_error detail for Activity feed diagnosis
Always persist bounded tool_error detail so the task Activity feed can surface underlying failure messages even when verbose tool-output persistence is off.

- Keep tool args and successful tool_result detail opt-in via persistAgentToolOutput
- Always include bounded tool_error detail in agent-log JSONL rows
- Document diagnostic retention in types, agent-logger, and storage docs
- Cover Activity reveal behavior and logger persistence with unit tests
- Add patch changeset for operator-facing Activity error detail fix

Files changed:
 .changeset/fn-7995-tool-error-detail.md            |  7 ++++
 docs/storage.md                                    |  1 +
 packages/core/src/agent-log-constants.ts           |  4 +++
 packages/core/src/types.ts                         | 10 ++++--
 .../app/components/__tests__/TaskChatTab.test.tsx  | 42 ++++++++++++++++++++++
 packages/engine/src/__tests__/agent-logger.test.ts | 41 ++++++++++++++++++---
 packages/engine/src/agent-logger.ts                |  9 ++---
 7 files changed, 104 insertions(+), 10 deletions(-)

Fusion-Task-Id: FN-7995

Fusion-Task-Lineage: 0fa063df-58b1-4991-a0d9-e8a77181d32a

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-15 16:17:37 -07:00
gsxdsm
a242f1b449 fix(FN-7952): migrate bundled plugins to PostgreSQL (#2111)
## Summary

Bundled plugins now persist shared runtime state in project-scoped
PostgreSQL tables instead of maintaining independent SQLite authority.
Reports, CLI Printing Press, Compound Engineering, Roadmap, Even
Realities, and WhatsApp all follow the same ownership and startup
contract as Fusion core.

## Design decisions

- Plugin schema hooks run through the host’s PostgreSQL owner and
enforce project isolation.
- The SDK exposes the host contract needed by bundled plugins without
importing engine internals.
- Legacy Roadmap ownership fixtures use the supported empty-owner
sentinel, preserving current composite primary/foreign keys while
exercising backfill behavior.
- The lockfile travels with the Even Realities PostgreSQL dependency so
packaged installs remain reproducible.

## Validation

- All six affected plugin builds pass.
- Affected plugin suites pass: 773 tests across Printing Press, Compound
Engineering, Even Realities, Reports, Roadmap, and WhatsApp.
- `pnpm test:gate` passes all 478 gate tests.
- This PR changes 40 files.

## Stack

- Depends on #2110 → #2109 → #2108.
- The documentation/release PR completes the stack.

Related: #2105


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

## Summary by CodeRabbit

* **Breaking Changes**
* PostgreSQL is now required for runtime storage; SQLite files are used
only as one-time migration inputs.
  * The legacy `FUSION_NO_EMBEDDED_PG` fallback has been removed.

* **New Features**
* Added project-isolated PostgreSQL storage for plugins, reports, tasks,
notifications, and other plugin data.
  * Added agent tools for reports and CLI service drafts.
  * Added PostgreSQL schema initialization support for plugin authors.

* **Bug Fixes**
  * Improved migration and recovery of legacy plugin state.
* Prevented cross-project data access and strengthened transactional
schema updates.

* **Documentation**
* Updated storage, migration, deployment, plugin authoring, CLI, and
dashboard guidance for PostgreSQL.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-15 00:27:59 -07:00
gsxdsm
6e0fde860c FN-7949: fix deleted planning-mode session resurrecting after in-flight generation completes
Adds a bounded-TTL delete tombstone to AiSessionStore so a straggling post-delete generation write can never resurrect a session the user explicitly deleted.

- AiSessionStore now records a 10-minute delete tombstone (id -> deletion timestamp) in delete(), deleteByIdAndType(), and bulk cleanup paths (cleanupOld/cleanupStaleSessions/emitDeletedSessions).
- upsert() checks the tombstone first and drops (no-ops) any write for a tombstoned id without touching SQLite or emitting ai_session:updated, fixing the root cause once in the shared store rather than per-producer (planning.ts, subtask-breakdown.ts, mission-interview.ts, milestone-slice-interview.ts).
- Tombstone entries are pruned lazily on check and piggyback on the existing cleanupStaleSessions() cadence so the in-memory map cannot grow unbounded.
- Adds a changeset (patch) documenting the user-facing fix.
- Updates docs/architecture.md and docs/storage.md with the new "AI session delete tombstones" behavior.
- Adds regression tests covering the tombstone guard in ai-session-store.test.ts and routes-planning.test.ts.

Files changed:
 .changeset/fn-7949-ai-session-delete-tombstone.md  |   7 +
 docs/architecture.md                               |   2 +-
 docs/storage.md                                    |  12 +-
 packages/dashboard/src/__tests__/ai-session-store.test.ts | 145 +++++++++++++++
 packages/dashboard/src/__tests__/routes-planning.test.ts  | 200 ++++++++++++++++++++-
 packages/dashboard/src/ai-session-store.ts         |  83 +++++++++
 6 files changed, 446 insertions(+), 3 deletions(-)

Fusion-Task-Id: FN-7949

Fusion-Task-Lineage: 8e509dae-0cc5-46cd-9c4b-9048cfda56d3

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-13 13:10:53 -07:00
gsxdsm
8fa2ad0ecd Address PR review feedback (#1996)
- contain fn_artifact_register path payloads: realpath-canonicalized
  containment before stat/read — relative paths require and must stay
  inside baseDir, absolute paths allowed only under baseDir or the OS
  temp dir (deliberate allowance for browser/screenshot tooling);
  the process.cwd() fallback is gone, symlink escapes rejected
- bind task-scoped heartbeat artifact registration to the acquired
  worktree (baseDir: sessionCwd rebind after acquisition); no-task
  heartbeat prompt now says to pass absolute temp-dir paths
- enforce exactly-one payload source (content/uri/dataBase64/path);
  content+uri combos are now rejected to match the documented contract
- add FNXC rationale comments at both visual-artifact instruction sites
  in the planning prompts (sync contract with the executor prompt)
- media route: statSync -> await stat from node:fs/promises
- range tests ride the in-memory MockSocket harness (TestResponse gains
  binary-safe bodyBuffer; real-TCP helper deleted) and assert the full
  206 Content-Range/Content-Length contract for every range form
- add PdfViewer coverage (iframe src/title) in DocumentsView tests

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 23:42:10 -07:00
gsxdsm
a8eafbbb14 feat: video, HTML mockup, and PDF artifact support end-to-end
Video was registrable but effectively unusable, and HTML/PDF deliverables
had no first-class path from agents to the gallery.

- media route now serves HTTP byte ranges (Accept-Ranges, 206 +
  Content-Range, 416 on unsatisfiable) so <video>/<audio> seeking works
  and Safari plays media at all
- video attachments (mp4/webm/mov, 100MB cap vs 5MB for other types)
  bridge into the artifact registry like images; multer transport ceiling
  raised to 100MB with per-type caps enforced in the store
- fn_artifact_register path payloads are signature-validated for video
  (ftyp box / EBML header) and PDF (%PDF- prefix), mirroring images
- HTML doc artifacts (mimeType text/html) render as live sandboxed
  iframe previews by default in the doc viewer, with a Preview/Source
  toggle and the same FileEditor edit mode
- executor/heartbeat/planning prompts and tool descriptions now cover
  the full type matrix: images, videos, audio, HTML mockups, PDFs, and
  markdown docs, each with the registration recipe

Verified live: range requests (200/206/416) via curl, an ffmpeg-generated
mp4 playing to completion in the gallery lightbox, and an interactive
HTML mockup rendering in the sandboxed preview.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 23:42:10 -07:00
gsxdsm
9024f3a639 feat: agent-created visual artifacts end-to-end + redesigned category gallery with doc editing
Agents could never get screenshots/wireframes/mocks into the Artifacts view:
fn_artifact_register was gated on assignedAgentId (never set in default
ephemeral mode), the only image payload source was inline base64, and no
prompt ever told agents to register visual deliverables.

- always expose fn_artifact_register to executor sessions ("executor" author
  fallback), resolve relative paths against the task worktree, and default
  taskId to the executing task (heartbeat task lane too)
- add a `path` payload source: file read with 50MB cap, extension MIME
  inference, PNG/JPEG/GIF/WebP signature + SVG sniff validation, persisted
  through managed artifact storage
- executor/heartbeat/planning prompts + engine-tools reference now instruct
  agents to register screenshots, wireframes, mockups, and recordings
- new ArtifactsGallery: Images/Docs/PDFs/Videos/Audio/Other category sections
  and filter chips, visual tile grid + lightbox, embedded PDF viewer, audio
  player rows, download rows; mobile-responsive down to the 768px breakpoint
- doc artifacts open a full viewer rendered as markdown by default with an
  in-place edit mode using the shared CodeMirror FileEditor; persisted via new
  GET/PATCH /api/artifacts/:id + TaskStore.updateArtifact and live-refreshed
  through the new artifact:updated SSE event

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 23:42:10 -07:00
gsxdsm
de67b57517 FN-7791: bridge image task attachments into the artifact registry
Image attachments added via TaskStore.addAttachment now surface as first-class image artifacts, reusing the existing artifact listing/SSE/media pipeline instead of duplicating bytes.

- addAttachment() registers a URI-only "image" artifact (metadata.source: "attachment") pointing at the already-written attachments/<file> path whenever an image mimeType is attached; registration is best-effort and swallows the archived/soft-deleted-task rejection so addAttachment keeps its always-succeeds contract for valid images.
- deleteAttachment() now removes any bridged artifact rows for a filename before deleting the attachment file, so /api/artifacts/:id/media can never point at a deleted attachment.
- register-task-workflow-routes.ts's resolveArtifactMediaPath now accepts task-scoped attachments/<file> URIs (in addition to artifacts/<file>) so the media route can stream bridged image-attachment artifacts; task-less artifacts remain restricted to .fusion/artifacts/.
- docs/storage.md documents the attachment→artifact bridge behavior and the media route's accepted URI prefixes.
- Added a changeset (@runfusion/fusion: minor) describing the user-facing Artifacts view change.
- Extended store-attachments and artifacts-route-integration tests to cover the new bridging and deletion behavior.

Files changed:
 .changeset/fn-7791-image-attachments-artifacts.md  |  7 +++
 docs/storage.md                                    |  3 +-
 packages/core/src/__tests__/store-attachments.test.ts   | 59 +++++++++++++++++++++-
 packages/core/src/store.ts                         | 58 ++++++++++++++++++++-
 packages/dashboard/src/routes/__tests__/artifacts-route-integration.test.ts  | 40 +++++++++++++++
 packages/dashboard/src/routes/register-task-workflow-routes.ts    |  9 +++-
 6 files changed, 172 insertions(+), 4 deletions(-)

Fusion-Task-Id: FN-7791

Fusion-Task-Lineage: 4df47880-6161-4a8b-933a-2f6fc2fed953

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-10 11:30:21 -07:00
gsxdsm
84fb5138fc FN-7793: add fallback-lane thinking-level settings foundation
Adds the schema/storage foundation for per-fallback-lane thinking-level settings, without any runtime or UI consumption yet.

- Add global `fallbackThinkingLevel` default settings key.
- Add workflow-declared `planningFallbackThinkingLevel` and `validatorFallbackThinkingLevel` companion settings (enum-validated against THINKING_LEVELS) alongside their existing fallback provider/model pairs.
- Add project-scoped `titleSummarizerFallbackThinkingLevel` default settings key.
- Extend `GlobalSettings`/`ProjectSettings` TypeScript interfaces with the new optional `ThinkingLevel` fields and FNXC documentation comments.
- Update settings-schema `MovedProjectSettingsKey` type to include the new workflow-moved thinking-level keys.
- Update `docs/settings-reference.md` and `docs/storage.md` to document the new keys and correct workflow-vs-project scope for the pre-existing planning/validator fallback provider/model keys.
- Extend `effective-settings-overlay` and `settings-parity` unit tests to cover the new keys' scope and inheritance behavior.
- Add changeset `.changeset/fallback-thinking-levels.md` (minor).

Files changed:
 .changeset/fallback-thinking-levels.md             |  7 +++++++
 docs/settings-reference.md                         |  4 ++++
 docs/storage.md                                    | 12 +++++++----
 .../__tests__/effective-settings-overlay.test.ts   |  6 ++++++
 .../core/src/__tests__/settings-parity.test.ts     | 10 ++++++++++
 packages/core/src/builtin-workflow-settings.ts     | 23 +++++++++++++++++++++-
 packages/core/src/settings-schema.ts               | 10 +++++++++-
 packages/core/src/types.ts                         | 12 +++++++++++
 8 files changed, 78 insertions(+), 6 deletions(-)

Fusion-Task-Id: FN-7793
Fusion-Task-Lineage: 0e4bac3e-01d2-4d17-9f0a-af87e8a66eee
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-10 11:26:16 -07:00
gsxdsm
5a9f354e9a FN-7730: fix linked-worktree project-root resolution so board writes don't silently land in the wrong .fusion.db
Board mutations (fn_task_update, CEO override, direct SQL) issued from a pi-extension tool session could silently write into a task's throwaway, never-synced worktree-local .fusion/fusion.db instead of the true project root when git CLI resolution failed (missing git binary, Docker "dubious ownership" refusal, or a non-default settings.worktreesDir). This fixes root-cause resolution and adds regression coverage plus a docs writeup.

- getProjectRootFromGitLinkedWorktree now resolves a linked worktree's project root from git's own on-disk .git/commondir metadata via pure filesystem reads before falling back to the git rev-parse CLI, so writes no longer fall through to a local hydrated copy on git-invocation failure.
- Added getMainRepoRootFromGitFile and resolveCommonGitDirFromWorktreeGitFile helpers with FNXC:Storage comments documenting the FN-7730 root cause and fix rationale.
- Added packages/core/src/__tests__/pi-extensions-write-path-durability.test.ts regression coverage for the write-path durability invariant.
- Extended packages/core/src/__tests__/pi-extensions.test.ts with additional resolution-path assertions.
- Documented the failure mode and fix in docs/storage.md ("Silent board-mutation write loss (FN-7730)").
- Added a patch changeset for @runfusion/fusion describing the user-facing fix.

Files changed:
 .changeset/fn-7730-worktree-project-root-resolution.md              |   7 ++
 docs/storage.md                                                     |  54 ++++++++++
 packages/core/src/__tests__/pi-extensions-write-path-durability.test.ts | 98 ++++++++++++++++++
 packages/core/src/__tests__/pi-extensions.test.ts                   |  87 +++++++++++++++-
 packages/core/src/pi-extensions.ts                                  | 114 +++++++++++++++++++++
 5 files changed, 359 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-7730
Fusion-Task-Lineage: 00753a2d-a934-42cf-8fde-0f9b8ad98142
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-09 19:58:05 -07:00
gsxdsm
03161adfb9 FN-7659: paginate and sort the Archived column newest-first
Adds server-side pagination for the Archived task column, sorted by most-recently-archived first, with a Show more control on the dashboard.

- Add ArchiveDatabase.listPage and TaskStore.listArchivedTasks for a bounded SQL LIMIT/OFFSET read ordered by archivedAt DESC
- Add GET /tasks/archived route for paged archive fetches, leaving the legacy merged listTasks({includeArchived}) path unchanged
- Wire useTasks.loadArchivedTasks to fetch page 1 on first Archived-column expand and loadMoreArchivedTasks for subsequent pages
- Add a "Show more" affordance in Column.tsx/Board.tsx/MainContent.tsx to trigger loading additional archived pages
- Extend taskSorting.ts to keep archived task ordering stable with the new paged data
- Add core and dashboard tests covering archive pagination and store/route behavior
- Add changeset for @runfusion/fusion (minor) and update docs/storage.md and docs/dashboard-guide.md

Files changed:
 .changeset/FN-7659-archived-pagination.md          |   7 +
 docs/dashboard-guide.md                            |   4 +-
 docs/storage.md                                    |   7 +
 packages/core/src/__tests__/archive-db-pagination.test.ts    |  94 ++++++++
 packages/core/src/__tests__/store-archive-search.test.ts     |  63 ++++++
 packages/core/src/archive-db.ts                    |  18 ++
 packages/core/src/store.ts                         |  32 +++
 packages/dashboard/app/App.tsx                     |   5 +-
 packages/dashboard/app/api/legacy.ts               |  19 ++
 packages/dashboard/app/components/Board.tsx        |  19 +-
 packages/dashboard/app/components/Column.tsx       |  48 ++++-
 packages/dashboard/app/components/__tests__/Column.test.tsx       |  41 ++++
 packages/dashboard/app/components/__tests__/taskSorting.test.ts   |  27 +++
 packages/dashboard/app/components/dashboard/MainContent.tsx       |   9 +
 packages/dashboard/app/components/dashboard/types.ts    |   6 +
 packages/dashboard/app/components/taskSorting.ts   |  16 ++
 packages/dashboard/app/hooks/__tests__/useTasks.test.ts | 236 ++++++++++++++++++++-
 packages/dashboard/app/hooks/useTasks.ts           | 173 ++++++++++++++-
 packages/dashboard/app/test/mockApi.ts             |   3 +
 packages/dashboard/src/routes/__tests__/tasks-archived-pagination.test.ts |  94 ++++++++
 packages/dashboard/src/routes/register-task-workflow-routes.ts  |  32 +++
 21 files changed, 930 insertions(+), 23 deletions(-)

Fusion-Task-Id: FN-7659

Fusion-Task-Lineage: 7a5a1f62-277c-4f29-883c-62e75b269bc5

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-08 01:29:56 -07:00
gsxdsm
dd9fa2d3cb FN-7661: expose removeLineageReferences on fn_task_archive/fn_task_delete
Fixes fn_task_archive and fn_task_delete rejecting tasks still referenced as a lineage parent, with no tool-exposed way to clear that reference.

- Add optional removeLineageReferences boolean param to fn_task_archive and fn_task_delete tool schemas, forwarded to store.archiveTask/store.deleteTask
- Update tool descriptions and prompt guidelines to advertise the recovery path (removeLineageReferences:true) when a lineage-parent block occurs
- Add task-lineage-unlink.test.ts covering the new parameter behavior
- Document the change in docs/storage.md
- Add changeset (@runfusion/fusion minor, category: fix)

Files changed:
 .changeset/fn-7661-lineage-unlink-tools.md         |   7 +
 docs/storage.md                                    |   1 +
 packages/cli/src/__tests__/task-lineage-unlink.test.ts | 199 +++++++++++++++++++++
 packages/cli/src/extension.ts                      |  28 ++-
 4 files changed, 232 insertions(+), 3 deletions(-)

Fusion-Task-Id: FN-7661

Fusion-Task-Lineage: 414c046c-43df-4995-85a5-ff00b345de50

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-08 00:33:02 -07:00
gsxdsm
883c73e2f1 FN-7544: emit artifact:registered for cross-instance artifact writes
Fix agent-created artifacts not showing live in the dashboard because a second TaskStore instance (e.g. engine writing while dashboard polls) never detected or re-emitted artifact:registered for rows it did not insert itself.

- Track a per-instance lastArtifactRowId cursor seeded from the max artifacts rowid at watch() startup
- In checkForChanges(), pick up artifact rows with rowid > cursor written by other instances and re-emit artifact:registered, advancing the cursor
- Advance the cursor on local inserts (insertArtifactRow) so this instance never double-emits its own writes
- Call db.bumpLastModified() in registerArtifact() so other instances' pollers actually look at the artifacts table
- Add regression tests covering cross-instance artifact registration in core store and dashboard artifacts route integration
- Add changeset and doc note for the cross-instance live-refresh fix

Files changed:
 .changeset/fn-7544-artifact-cross-instance-live-refresh.md         |   7 ++
 docs/storage.md                                                    |   1 +
 packages/core/src/__tests__/artifacts.test.ts                      |  85 +++++++++++++++
 packages/core/src/store.ts                                         |  63 ++++++++++-
 packages/dashboard/src/routes/__tests__/artifacts-route-integration.test.ts | 120 ++++++++++++++++++++-
 5 files changed, 274 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-7544

Fusion-Task-Lineage: 76570505-082e-4f9a-8b06-29591c06c435

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:19 -07:00
gsxdsm
2797803c0b FN-7503: add agent log timing metrics
Record and surface request first-token latency and tool processing duration in task logs.

- Add optional agent log timing fields and persist them in file-backed task logs.
- Track Time To First Token from the first visible model output per agent logger request.
- Track FIFO tool durations for tool result and error rows without storing sensitive payloads.
- Render TTFT and duration badges in task chat and agent log viewers with regression coverage.
- Document the new persisted timing fields and add a patch changeset for the CLI package.

Files changed:
 .changeset/fn-7503-agent-log-timing.md             |   7 ++
 docs/storage.md                                    |   1 +
 .../src/__tests__/agent-log-file-store.test.ts     |  35 ++++++
 .../src/__tests__/store-agent-log-file.test.ts     |  28 +++++
 packages/core/src/agent-log-file-store.ts          |  19 ++++
 packages/core/src/store.ts                         |  13 +++
 packages/core/src/types.ts                         |   4 +
 .../dashboard/app/components/AgentLogViewer.css    |  33 ++++++
 .../dashboard/app/components/AgentLogViewer.tsx    |  39 ++++++-
 packages/dashboard/app/components/TaskChatTab.css  |  23 +++-
 packages/dashboard/app/components/TaskChatTab.tsx  |  17 ++-
 .../__tests__/AgentLogViewer.rendering.test.tsx    |  24 +++++
 .../app/components/__tests__/TaskChatTab.test.tsx  |  18 ++++
 packages/engine/src/__tests__/agent-logger.test.ts | 120 ++++++++++++++++++---
 packages/engine/src/agent-logger.ts                |  97 ++++++++++++++---
 15 files changed, 446 insertions(+), 32 deletions(-)

Fusion-Task-Id: FN-7503

Fusion-Task-Lineage: 7e62034f-4c35-420d-a670-3f7f4a7948df

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:21 -07:00
gsxdsm
aa8f1f32ee FN-7438: recover stale branch-group references
Recover branch-group detail views after restarts and let operators clear stale per-task group context safely.

- Add Task Detail stale branch-group recovery UI that clears only the current task via the assign API.
- Verify durable branch groups and members survive TaskStore/API restarts, while stale references can be reset without losing unrelated metadata.
- Improve integration-branch fallback diagnostics for repositories that use non-origin remotes.
- Document the recovery path, durable branch-group storage expectations, and release the fix as a patch.

Files changed:
 .../fn-7438-branch-group-restart-recovery.md       |  7 ++
 docs/dashboard-guide.md                            |  5 +-
 docs/settings-reference.md                         |  2 +-
 docs/storage.md                                    |  2 +-
 .../core/src/__tests__/branch-group-store.test.ts  | 43 +++++++++++-
 .../dashboard/app/components/BranchGroupCard.css   |  9 +++
 .../dashboard/app/components/BranchGroupCard.tsx   | 49 +++++++++++++-
 .../dashboard/app/components/TaskDetailModal.tsx   | 14 +++-
 .../components/__tests__/BranchGroupCard.test.tsx  | 40 +++++++++++
 .../components/__tests__/TaskDetailModal.test.tsx  | 11 ++-
 .../src/__tests__/routes-branch-groups.test.ts     | 79 +++++++++++++++++++++-
 .../src/__tests__/integration-branch.test.ts       | 41 +++++++++++
 packages/engine/src/integration-branch.ts          | 54 ++++++++++++++-
 13 files changed, 343 insertions(+), 13 deletions(-)

Fusion-Task-Id: FN-7438
Fusion-Task-Lineage: 09ef3dc3-8319-49a7-9f4d-c95a3e069d39
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-02 13:07:16 -07:00
gsxdsm
28cdd1c215 FN-7099: add project plan approval mode
Add a project-wide plan approval mode that can override workflow approval gates.

- Add core plan approval resolution for workflow, auto-approve-all, and require-all modes.
- Apply the resolved approval mode in triage recovery and planning finalization.
- Expose the mode in settings UI with translations, docs, tests, and a changeset.

Files changed:
 .changeset/fn-7099-plan-approval-mode.md           |  7 +++
 docs/settings-reference.md                         |  3 +-
 docs/storage.md                                    |  5 +-
 packages/core/src/__tests__/plan-approval.test.ts  | 37 ++++++++++++++
 packages/core/src/index.ts                         |  2 +
 packages/core/src/plan-approval.ts                 | 21 ++++++++
 packages/core/src/settings-schema.ts               |  3 +-
 packages/core/src/types.ts                         |  5 ++
 .../dashboard/app/components/SettingsModal.tsx     |  1 +
 .../SettingsModal.scheduling-merge.test.tsx        | 17 +++++++
 .../__tests__/SettingsModal.test-harness.tsx       |  1 +
 .../components/settings/sections/MergeSection.tsx  | 19 +++++++
 .../MergeSection.legacy-automerge-cleanup.test.tsx | 23 ++++++++-
 packages/engine/src/__tests__/triage.test.ts       | 58 ++++++++++++++++++++++
 packages/engine/src/triage.ts                      | 10 +++-
 packages/i18n/locales/en/app.json                  |  5 ++
 packages/i18n/src/resources.d.ts                   |  5 ++
 17 files changed, 215 insertions(+), 7 deletions(-)

Fusion-Task-Id: FN-7099
Fusion-Task-Lineage: 8b276000-1df3-41e4-a94d-724aac559954
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-06-27 09:28:30 -07:00
gsxdsm
ee3a06ecfd FN-7095: add actionable backup failure details
Database Backup automation failures now expose the affected database, paths, and root cause.

- Add DB-qualified error formatting for project and central backup creation, verification, schedule validation, and command failures.
- Normalize routine and cron in-process backup failures so empty or opaque errors become actionable AutomationRunResult errors.
- Cover missing database files, backup directory failures, central copy failures, corrupt backup quarantine, and runner normalization with regression tests.
- Document backup failure detail behavior and add a patch changeset.

Files changed:
 .changeset/fn-7095-backup-detail.md                |   7 ++
 docs/storage.md                                    |   2 +
 packages/core/src/__tests__/backup.test.ts         | 114 ++++++++++++++++++++-
 packages/core/src/backup.ts                        | 112 +++++++++++++++-----
 packages/engine/src/__tests__/cron-runner.test.ts  |  35 +++++++
 .../engine/src/__tests__/routine-runner.test.ts    |  45 ++++++++-
 packages/engine/src/cron-runner.ts                 |  20 +++-
 packages/engine/src/routine-runner.ts              |  20 +++-
 8 files changed, 324 insertions(+), 31 deletions(-)

Fusion-Task-Id: FN-7095

Fusion-Task-Lineage: 368e3edf-20d3-4756-97be-75734dbff703

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-06-27 09:28:29 -07:00
gsxdsm
0440ae4bb9 FN-7074: make task ID reservation commits atomic
Task creation now commits or rolls back distributed task ID reservations with the task-row transaction.

- Add transaction-participating reservation commit and rollback helpers.
- Wire create, duplicate, and refinement task paths to commit reservations inside task insertion.
- Record rollback audit events and preserve burned reservation rows after failed creates.
- Cover atomicity, rollback, and allocator behavior with reservation-focused tests and docs.

Files changed:
 .changeset/fn-7074-reservation-atomicity.md        |   7 +
 AGENTS.md                                          |   1 +
 docs/architecture.md                               |   7 +-
 docs/storage.md                                    |   4 +-
 .../core/src/__tests__/distributed-task-id.test.ts |  25 ++-
 .../__tests__/store-reservation-atomicity.test.ts  | 224 +++++++++++++++++++++
 packages/core/src/distributed-task-id.ts           | 208 +++++++++++++------
 packages/core/src/store.ts                         |  93 +++++++--
 8 files changed, 479 insertions(+), 90 deletions(-)

Fusion-Task-Id: FN-7074

Fusion-Task-Lineage: 464a98cf-e903-4257-93ac-424c7129412b
2026-06-26 14:55:01 -07:00
gsxdsm
e59d3d60e7 FN-6820: document artifact registry workflows
Document the user-facing artifact registry workflow from agent tools through dashboard discovery and storage behavior.

- Describe agent artifact registration, listing, viewing, and mailbox notification semantics.
- Expand the Artifacts dashboard workflow with gallery counts, previews, task links, and loading/error/empty states.
- Clarify artifact registry storage, hydration scope, retention, and concept terminology.

Files changed:
 CONCEPTS.md             |  2 +-
 docs/agents.md          | 17 ++++++++++++++---
 docs/dashboard-guide.md | 16 ++++++++++++----
 docs/storage.md         | 15 +++++++++++----
 4 files changed, 38 insertions(+), 12 deletions(-)

Fusion-Task-Id: FN-6820

Fusion-Task-Lineage: 1d3be0f3-fb4a-4d7e-9470-2110435e83a4
2026-06-22 19:18:49 -07:00
gsxdsm
8dd9697468 FN-6714: backfill commit-association diff stats
Backfill historical commit-association diff stats so Command Center LOC can use real persisted git data.

- Add a core backfill API that inspects local git commits for associations with missing additions/deletions and supports dry-run reporting.
- Expose an authenticated Command Center productivity backfill endpoint and route it through the legacy API shim.
- Keep productivity LOC/hour sentinels safe for legacy payloads and document the backfill contract.
- Cover the backfill path, auth gate, productivity analytics, and route registration with tests.

Files changed:
 .changeset/fn-6714-command-center-loc-backfill.md  |   5 +
 docs/architecture.md                               |   4 +-
 docs/storage.md                                    |   4 +-
 ...mmit-association-diff-backfill.real-git.test.ts | 140 +++++++++++++++++++++
 packages/core/src/index.ts                         |   1 +
 packages/core/src/store.ts                         |  76 ++++++++++-
 packages/core/src/types.ts                         |   9 ++
 packages/dashboard/app/api/legacy.ts               |  16 +++
 .../command-center/areas/ProductivityArea.tsx      |   8 +-
 .../register-command-center-routes.auth.test.ts    |  48 ++++---
 .../register-command-center-routes.test.ts         |  49 +++++++-
 .../src/routes/register-command-center-routes.ts   |  20 +++
 12 files changed, 354 insertions(+), 26 deletions(-)

Fusion-Task-Id: FN-6714

Fusion-Task-Lineage: 657c7789-bbe4-4611-abca-127af05b0300
2026-06-22 03:42:24 -07:00
gsxdsm
fbce59b707 FN-6777: add artifact registry storage
Add a core artifact registry for storing metadata and task-scoped artifact payloads.\n\n- Add artifact types, schema, migrations, store APIs, and exports for registering/listing artifact metadata.\n- Persist binary artifact payloads under task or project artifact directories and hydrate artifacts during worktree acquisition.\n- Cover registry behavior, DB schema, and worktree hydration with tests and document storage semantics.\n\nFiles changed:\n .changeset/fn-6777-artifact-registry.md            |   5 +\n docs/storage.md                                    |   8 +\n packages/core/src/__tests__/artifacts.test.ts      | 257 +++++++++++++++++++++\n packages/core/src/__tests__/db.test.ts             |   5 +\n packages/core/src/db.ts                            |  59 ++++-\n packages/core/src/index.ts                         |   2 +-\n packages/core/src/store.ts                         | 220 +++++++++++++++++-\n packages/core/src/types.ts                         |  75 ++++++\n .../engine/src/__tests__/executor-test-helpers.ts  |   1 +\n .../engine/src/__tests__/executor-worktree.test.ts |   2 +\n .../__tests__/worktree-acquisition-backend.test.ts |   2 +-\n .../worktree-acquisition-secrets-env.test.ts       |   2 +-\n .../worktree-acquisition-worktrunk.test.ts         |   2 +-\n .../src/__tests__/worktree-acquisition.test.ts     |   2 +-\n .../src/__tests__/worktree-db-hydrate.test.ts      |  59 +++++\n packages/engine/src/worktree-acquisition.ts        |   2 +-\n packages/engine/src/worktree-db-hydrate.ts         |  42 +++-\n 17 files changed, 732 insertions(+), 13 deletions(-)

Fusion-Task-Id: FN-6777

Fusion-Task-Lineage: 42cdcdcf-6388-42fe-8de1-6857ef20839d
2026-06-21 09:00:40 -07:00
gsxdsm
c32c925321 FN-6783: recover orphaned task dirs into the task index
Reconcile on-disk task.json records that are missing from SQLite without resurrecting tombstoned IDs.

- Add TaskStore orphaned task directory scanning with metadata validation, FTS-safe insertion, cache updates, lifecycle events, and run-audit entries.
- Run the reconcile during store init and self-healing maintenance for tasks created after startup.
- Cover recovery, skip, and maintenance behavior with core and engine regression tests.
- Document task index reconciliation and add the published package changeset.

Files changed:
 .changeset/fn-6783-orphaned-task-dir-reconcile.md  |   5 +
 AGENTS.md                                          |   1 +
 docs/architecture.md                               |   2 +
 docs/storage.md                                    |   8 +
 .../store-orphaned-task-dir-reconcile.test.ts      | 179 +++++++++++++++++++++
 packages/core/src/store.ts                         | 170 ++++++++++++++++++-
 .../self-healing-orphaned-task-dirs.test.ts        |  40 +++++
 packages/engine/src/self-healing.ts                |  14 ++
 8 files changed, 412 insertions(+), 7 deletions(-)

Fusion-Task-Id: FN-6783
Fusion-Task-Lineage: 5c8d4690-5278-4c29-8f02-32d9f01d581d
2026-06-20 04:40:31 -07:00
gsxdsm
5117944371 FN-6720: add productivity task duration stats
Adds completed-task active-duration analytics to the Command Center Productivity surface.\n\n- Aggregate average, median, p90, total, and completed-task duration metrics from done tasks with recorded active time.\n- Render duration stat cards with unavailable dash sentinels and export matching CSV rows.\n- Cover analytics, dashboard, route, CSV, mobile/tablet layout, and documentation behavior.\n\nFiles changed:\n .changeset/soft-badgers-measure.md                 |   5 +\n docs/architecture.md                               |   4 +-\n docs/dashboard-guide.md                            |   2 +-\n docs/storage.md                                    |   2 +\n .../src/__tests__/productivity-analytics.test.ts   | 105 ++++++++++++++++++++-\n packages/core/src/productivity-analytics.ts        |  83 +++++++++++++++-\n .../__tests__/CommandCenter.mobile-scroll.test.tsx |  16 ++++\n .../__tests__/CommandCenter.tablet-layout.test.tsx |  19 ++++\n .../command-center/areas/ProductivityArea.tsx      |  65 ++++++++++++-\n .../command-center/areas/__tests__/areas.test.tsx  |  65 ++++++++++++-\n .../components/command-center/areas/areaShared.ts  |  12 +++\n .../src/__tests__/command-center-csv.test.ts       |   8 ++\n .../register-command-center-routes.test.ts         |  22 +++++\n packages/dashboard/src/command-center-csv.ts       |   5 +\n 14 files changed, 404 insertions(+), 9 deletions(-)

Fusion-Task-Id: FN-6720

Fusion-Task-Lineage: aa0980eb-d156-4dca-b6b8-1788570c166b
2026-06-19 17:25:35 -07:00
gsxdsm
711bf3e1b8 FN-6746: attribute token analytics per runtime model
Persist and expand per-model token usage so Command Center reports every model used by a task.

- Add a nullable per-model token usage column and task model bucket types.
- Merge session token deltas into provider/model buckets while retaining task-level totals.
- Expand model/provider analytics from per-model buckets with legacy fallbacks for older rows.
- Cover persistence, migration, aggregation, and session accumulation behavior with tests.
- Document the per-model storage contract alongside existing token analytics tables.

Files changed:
 docs/storage.md                                    |   2 +
 packages/core/src/__tests__/db-migrate.test.ts     |  62 ++++++++++
 .../core/src/__tests__/store-persistence.test.ts   |  49 ++++++++
 .../core/src/__tests__/token-analytics.test.ts     | 127 ++++++++++++++++++++-
 packages/core/src/db.ts                            |  13 ++-
 packages/core/src/index.ts                         |   2 +-
 packages/core/src/store.ts                         |   7 +-
 packages/core/src/token-analytics.ts               |  58 ++++++++--
 packages/core/src/types.ts                         |  32 ++++++
 .../src/__tests__/session-token-usage.test.ts      |  23 ++++
 packages/engine/src/executor.ts                    |  20 +++-
 packages/engine/src/session-token-usage.ts         |  50 +++++++-
 packages/engine/src/step-session-executor.ts       |   7 ++
 13 files changed, 429 insertions(+), 23 deletions(-)

Fusion-Task-Id: FN-6746

Fusion-Task-Lineage: 1b1a3b31-b669-4e89-ac38-a871f3349015
2026-06-19 16:47:34 -07:00
gsxdsm
59d3eee7f4 FN-6721: estimate productivity hours saved
Estimate human hours saved from productivity LOC analytics and expose it consistently.

- Add a shared human-lines-per-hour conversion and hoursSaved summary to productivity analytics.
- Show human hours saved in the Command Center productivity area with unavailable-state handling.
- Include hoursSaved in productivity CSV exports, docs, tests, and the release changeset.

Files changed:
 .changeset/fuzzy-productivity-hours.md             |  5 ++++
 docs/architecture.md                               |  4 +--
 docs/storage.md                                    |  4 +--
 .../src/__tests__/productivity-analytics.test.ts   | 29 ++++++++++++++++------
 packages/core/src/index.ts                         |  3 ++-
 packages/core/src/productivity-analytics.ts        | 28 +++++++++++++++++++--
 .../command-center/areas/ProductivityArea.tsx      | 24 ++++++++++++++++++
 .../command-center/areas/__tests__/areas.test.tsx  |  9 ++++++-
 .../src/__tests__/command-center-csv.test.ts       | 29 +++++++++++++++++++++-
 .../register-command-center-routes.test.ts         |  1 +
 packages/dashboard/src/command-center-csv.ts       |  1 +
 11 files changed, 120 insertions(+), 17 deletions(-)

Fusion-Task-Id: FN-6721

Fusion-Task-Lineage: 80114bfc-7d7f-4659-983a-9488660e5f0f
2026-06-19 16:47:34 -07:00
gsxdsm
47e7b4a150 FN-6704: capture merge LOC for productivity analytics
Capture merge-time diff stats so Command Center Productivity can report real Lines changed when available.

- Add nullable additions/deletions columns to task commit associations with migration and storage normalization.
- Persist git shortstat counts from merge association paths without blocking merges when stats are unavailable.
- Aggregate Productivity LOC from recorded commit stats while preserving the unavailable sentinel for historical unknowns.
- Cover migration, store upsert, analytics, and merger association stats behavior with tests and documentation.

Files changed:
 .changeset/fn-6704-command-center-loc.md           |  5 ++
 docs/architecture.md                               |  4 +-
 docs/storage.md                                    |  3 +
 packages/core/src/__tests__/db-migrate.test.ts     | 32 ++++----
 packages/core/src/__tests__/db.test.ts             | 90 ++++++++++++++++------
 .../src/__tests__/productivity-analytics.test.ts   | 47 +++++++++--
 packages/core/src/__tests__/store-upsert.test.ts   | 40 ++++++++++
 packages/core/src/db.ts                            | 14 +++-
 packages/core/src/productivity-analytics.ts        | 56 +++++++++-----
 packages/core/src/store.ts                         | 17 +++-
 packages/core/src/task-lineage.ts                  |  2 +
 packages/core/src/types.ts                         |  2 +
 .../merger-commit-association-stats.test.ts        | 90 ++++++++++++++++++++++
 packages/engine/src/merger-ai.ts                   |  2 +
 packages/engine/src/merger.ts                      | 17 +++-
 15 files changed, 349 insertions(+), 72 deletions(-)

Fusion-Task-Id: FN-6704

Fusion-Task-Lineage: f079fecb-eade-4318-bc55-23aa48097b4a
2026-06-19 06:51:57 -07:00
gsxdsm
20597901a0 FN-6675: add GitHub close-time backfill action
Add a Command Center operator path to backfill exact GitHub source-issue close times.

- Add a dashboard API client for the paginated GitHub source-issue closed-at backfill endpoint.
- Add a GitHub Command Center button, progress/error/result state, and styling for manual backfills.
- Cover backfill success, empty, error, and pagination behavior with area tests and document the operator flow.

Files changed:
 .../fn-6675-github-closed-at-backfill-dashboard.md |   5 +
 docs/dashboard-guide.md                            |   4 +-
 docs/storage.md                                    |   2 +-
 packages/dashboard/app/api/legacy.ts               |  25 ++++
 .../components/command-center/CommandCenter.css    |  39 ++++++
 .../components/command-center/areas/GithubArea.tsx | 117 ++++++++++++++++-
 .../command-center/areas/__tests__/areas.test.tsx  | 140 ++++++++++++++++++++-
 7 files changed, 326 insertions(+), 6 deletions(-)

Fusion-Task-Id: FN-6675

Fusion-Task-Lineage: 09e43b60-b9db-421f-a131-740a0d3164fe
2026-06-18 19:50:58 -07:00
gsxdsm
9b396b6378 FN-6674: backfill GitHub source issue close times
Add an opt-in sweep to populate historical GitHub source issue close timestamps from GitHub.

- Add a project-scoped backfill endpoint with offset/limit pagination for missing sourceIssueClosedAt values.
- Implement reconciler logic that fetches real closed_at values, skips open or already-filled tasks, and logs per-task failures.
- Cover the route and reconciler backfill behavior with tests, plus document the manual sweep and release note.

Files changed:
 .../fn-6674-source-issue-closed-at-backfill.md     |   5 +
 docs/dashboard-guide.md                            |   2 +-
 docs/storage.md                                    |   2 +-
 .../github-source-issue-reconciler.test.ts         | 105 ++++++++++++++++++++
 .../__tests__/register-git-github.backfill.test.ts | 110 +++++++++++++++++++++
 .../dashboard/src/github-tracking-reconciler.ts    |  71 +++++++++++++
 .../dashboard/src/routes/register-git-github.ts    |  31 ++++++
 7 files changed, 324 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-6674
Fusion-Task-Lineage: 5231b107-79f3-4326-9093-c70182bc0dc8
2026-06-18 19:12:58 -07:00
gsxdsm
94a081f4f3 FN-6666: store GitHub issue closure timestamps
Persist GitHub source issue closure timestamps so Fixed by Fusion analytics can use exact close dates.

- add nullable sourceIssueClosedAt storage, migration coverage, serialization, and task source issue typing
- persist observed or newly closed GitHub issue closed timestamps during source issue reconciliation
- update GitHub issue analytics to prefer sourceIssueClosedAt with updatedAt fallback and cover the behavior in tests
- document the stored timestamp and publish a patch changeset

Files changed:
 .changeset/fn-6666-source-issue-closed-at.md       |  5 ++
 docs/dashboard-guide.md                            |  2 +-
 docs/storage.md                                    |  2 +
 packages/core/src/__tests__/db-migrate.test.ts     | 94 +++++++++++++++++----
 packages/core/src/__tests__/db.test.ts             | 89 ++++++++++++++------
 .../src/__tests__/github-issue-analytics.test.ts   | 47 ++++++++++-
 packages/core/src/db-migrate.ts                    |  5 +-
 packages/core/src/db.ts                            | 12 ++-
 packages/core/src/github-issue-analytics.ts        | 28 +++----
 packages/core/src/store.ts                         |  7 +-
 packages/core/src/types.ts                         |  6 ++
 .../__tests__/github-tracking-reconciler.test.ts   | 80 +++++++++++++++++-
 packages/dashboard/src/__tests__/github.test.ts    | 95 +++++++++++++++++++++-
 .../dashboard/src/github-tracking-reconciler.ts    | 37 ++++++++-
 packages/dashboard/src/github.ts                   | 20 ++++-
 15 files changed, 457 insertions(+), 72 deletions(-)

Fusion-Task-Id: FN-6666

Fusion-Task-Lineage: 0fa8e824-14de-400e-b2a3-aa55d126e218
2026-06-18 18:48:05 -07:00
gsxdsm
317b08b227 FN-6669: price token costs from usage snapshots
Resolved-model task usage now contributes priced Command Center token costs without mutating model-resolution fields.

- Use token usage provider/model snapshots before legacy task model columns for cost attribution.
- Cover model, provider, node, agent, and time-series analytics with snapshot pricing tests.
- Document snapshot-first cost attribution and add a patch changeset for the published CLI package.

Files changed:
 .changeset/fn-6669-resolved-model-cost.md          |  5 ++
 docs/dashboard-guide.md                            |  2 +-
 docs/storage.md                                    |  2 +-
 .../core/src/__tests__/token-analytics.test.ts     | 82 ++++++++++++++++++++++
 packages/core/src/token-analytics.ts               |  9 ++-
 5 files changed, 97 insertions(+), 3 deletions(-)

Fusion-Task-Id: FN-6669

Fusion-Task-Lineage: 193a51f7-3328-44b2-b28b-25cd4f61d360
2026-06-18 17:14:19 -07:00
gsxdsm
ef544597da FN-6665: group token analytics by runtime model
Record runtime model snapshots so token analytics group usage by the model that actually generated it.

- Add token-usage provider/model snapshot columns, store mapping, and migration support.
- Preserve actually-used session model metadata during executor/session token accumulation without changing task model overrides.
- Prefer runtime model snapshots in token provider/model aggregation and cover the behavior with regression tests and docs.

Files changed:
 .changeset/fn-6665-tokens-by-model.md              |  5 ++
 docs/dashboard-guide.md                            |  2 +-
 docs/storage.md                                    |  2 +
 .../core/src/__tests__/store-token-usage.test.ts   |  4 ++
 .../core/src/__tests__/token-analytics.test.ts     | 54 ++++++++++++++++++++-
 packages/core/src/db.ts                            | 12 ++++-
 packages/core/src/store.ts                         | 10 +++-
 packages/core/src/token-analytics.ts               | 12 ++++-
 packages/core/src/types.ts                         | 10 ++++
 .../src/__tests__/session-token-usage.test.ts      | 55 ++++++++++++++++++++--
 packages/engine/src/executor.ts                    | 37 +++++++++++++--
 packages/engine/src/session-token-usage.ts         |  7 +++
 12 files changed, 194 insertions(+), 16 deletions(-)

Fusion-Task-Id: FN-6665

Fusion-Task-Lineage: e103de14-6298-4a9e-93af-4dd15798fde5
2026-06-18 16:58:11 -07:00
gsxdsm
4ffd0a2dde FN-6030: fix workflow terminal notifications
Ensure merged workflow tasks still emit the expected terminal notifications.

- emit task:merged when PR-driven workflow merges move tasks to done
- send merged notifications for merge-backed done transitions and suppress duplicates
- add regression coverage, a published changeset, and reconcile overlapping docs/test updates

Files changed:
 .../fn-6030-workflow-terminal-notifications.md     |   5 +
 docs/storage.md                                    |   8 +-
 .../core/src/__tests__/builtin-workflows.test.ts   |   1 -
 .../__tests__/store-pr-merged-transition.test.ts   |  14 ++-
 .../src/__tests__/workflow-ir-resolver.test.ts     |   1 -
 packages/core/src/store.ts                         |  14 ++-
 .../settings/sections/ProjectModelsSection.tsx     |   3 +-
 .../engine/src/__tests__/merger-post-merge.test.ts |   9 +-
 .../src/__tests__/notification-service.test.ts     | 129 ++++++++++++++++++++-
 .../__tests__/workflow-graph-task-runner.test.ts   |  57 +++++++++
 .../src/notification/notification-service.ts       |  36 ++++--
 11 files changed, 257 insertions(+), 20 deletions(-)

Fusion-Task-Id: FN-6030

Fusion-Task-Lineage: a991f765-0986-4541-ab38-ff476cf88d16
2026-06-08 13:54:17 -07:00