Commit Graph

10684 Commits

Author SHA1 Message Date
gsxdsm
d10ea9aef1 FN-7519: add planner-overseer intervention timeline model and UI
Introduces a persisted planner-overseer intervention timeline surfaced in the task-detail Planner Oversight cluster, recording stage, reason, action taken, outcome, attempt count/limit, and source links for each intervention.

- Add core `PlannerInterventionEntry` type plus `recordPlannerIntervention`/`getPlannerInterventionTimeline` helpers that persist entries via the run-audit store under the `overseer:intervention` mutation
- Add `PlannerInterventionTimeline` dashboard component rendering the timeline (stage/reason/action/outcome/attempts/links) with associated styles
- Wire the new API route/legacy handler and TaskDetailModal integration to expose and render the timeline
- Add unit tests for the core helpers and the new UI component
- Add changeset for the new minor feature and update architecture/dashboard-guide docs

Files changed:
$(cat /tmp/diffstat_7519.txt)

Fusion-Task-Id: FN-7519

Fusion-Task-Lineage: 3c4fcda3-9eb2-46d3-b142-b0c7d6334cd0

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:17 -07:00
gsxdsm
6c64f7feb2 Update readme and tests 2026-07-04 21:28:17 -07:00
gsxdsm
a7559b0721 Update readme and tests 2026-07-04 21:28:17 -07:00
gsxdsm
efd085cc77 Update readme and tests 2026-07-04 21:28:17 -07:00
gsxdsm
aae603b871 FN-7518: add configurable planner-overseer notification verbosity setting
Adds a workflow-native plannerOversightNotificationLevel enum setting so operators can control how noisy planner-overseer notifications are.

- Declare BUILTIN_OVERSIGHT_SETTINGS entry `plannerOversightNotificationLevel` (silent/errors/important/all, default important)
- Document the new setting alongside plannerOversightLevel in docs/settings-reference.md
- Add regression coverage in builtin-workflow-settings-triage.test.ts and workflow-settings-resolver.test.ts
- Add changeset (minor) describing the new operator-facing verbosity control

Files changed:
 .changeset/fn-7518-oversight-notification-verbosity.md            |  7 +++++
 docs/settings-reference.md                                       |  3 +-
 packages/core/src/__tests__/builtin-workflow-settings-triage.test.ts | 36 +++++++++++++++++++++-
 packages/core/src/__tests__/workflow-settings-resolver.test.ts    |  1 +
 packages/core/src/builtin-workflow-settings.ts                    | 17 ++++++++++
 5 files changed, 62 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-7518

Fusion-Task-Lineage: fe6e2bde-0e58-4f29-b5cc-efdf81efcfa5

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:16 -07:00
gsxdsm
6498d028f2 FN-7517: add task detail oversight quick-controls (level change, manual nudge, stop, explain-current-action)
Adds task detail modal controls that let an operator quickly change a task's
oversight level, nudge the planner with a manual instruction, stop oversight
entirely, and request an explanation of the overseer's current action,
backed by new dashboard API routes and engine/core plumbing.

- Add oversight quick-controls UI (level change, manual nudge, stop
  oversight, explain-current-action) to TaskDetailModal with supporting
  styles in TaskDetailModal.css and TaskCard.css
- Add dashboard legacy API + task-workflow routes to handle the new
  oversight actions (register-task-workflow-routes.ts, api/legacy.ts)
- Extend planner-overseer-state and planner-overseer-runtime-snapshot to
  track/report manual nudge and stop-oversight state
- Extend PlannerRecoveryController and project-engine to apply manual
  oversight actions (level change, nudge, stop, explain) end-to-end
- Add tests: TaskDetailModal.oversight-controls.test.tsx,
  tasks-overseer-controls.test.ts,
  planner-recovery-controller-manual-action.test.ts, plus updates to
  planner-overseer-runtime-snapshot.test.ts and test-helpers
- Update docs/dashboard-guide.md and docs/settings-reference.md

Files changed:
 docs/dashboard-guide.md                            |   2 +
 docs/settings-reference.md                         |   2 +-
 packages/core/src/planner-overseer-state.ts        |  18 +
 packages/dashboard/app/api/legacy.ts               |  33 ++
 packages/dashboard/app/components/TaskCard.css     |  13 +
 packages/dashboard/app/components/TaskDetailModal.css   | 122 +++++++
 packages/dashboard/app/components/TaskDetailModal.tsx   | 374 ++++++++++++++++++++-
 packages/dashboard/app/components/__tests__/TaskDetailModal.oversight-controls.test.tsx | 290 ++++++++++++++++
 packages/dashboard/app/components/__tests__/TaskDetailModal.test-helpers.ts      |  11 +
 packages/dashboard/src/routes/__tests__/tasks-overseer-controls.test.ts      | 191 +++++++++++
 packages/dashboard/src/routes/register-task-workflow-routes.ts    |  68 ++++
 packages/engine/src/__tests__/planner-overseer-runtime-snapshot.test.ts      |  24 +-
 packages/engine/src/__tests__/planner-recovery-controller-manual-action.test.ts |  84 +++++
 packages/engine/src/planner-overseer-runtime-snapshot.ts       |  11 +
 packages/engine/src/planner-recovery-controller.ts |  40 +++
 packages/engine/src/project-engine.ts              | 102 ++++++
 16 files changed, 1380 insertions(+), 5 deletions(-)

Fusion-Task-Id: FN-7517

Fusion-Task-Lineage: eded7ff5-d126-429d-acbb-9f4bfff5ae2a

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:16 -07:00
gsxdsm
ad744aa28a FN-7537: make manual backup automation runs match cron in-process behavior
Manual 'Run now' automation runs previously always shelled out via exec(), diverging from the scheduled cron path which runs backup commands in-process; this unifies both paths and adds live-run output coverage.

- Export formatInProcessBackupError, isInProcessBackupCommand, and isInProcessMemoryBackupCommand from @fusion/engine for reuse
- Have the dashboard's single-command/command-step manual run path (executeSingleCommand in routes.ts) intercept in-process backup/memory-backup commands via the scoped TaskStore, mirroring RoutineRunner.executeCommand/CronRunner
- Add regression coverage confirming onStep/onText live-run callbacks stream incremental output for the new interception branch
- Add changeset and doc note for the fix

Files changed:
 .changeset/fn-7537-backup-automation-manual-run.md |   7 +
 docs/dashboard-guide.md                            |   3 +
 .../src/__tests__/routes-automation.test.ts        | 171 +++++++++++++++++++++
 packages/dashboard/src/routes.ts                   |  73 ++++++++-
 .../engine/src/__tests__/routine-runner.test.ts    |  96 +++++++++++-
 packages/engine/src/cron-runner.ts                 |   7 +-
 packages/engine/src/index.ts                       |   2 +-
 7 files changed, 354 insertions(+), 5 deletions(-)

Fusion-Task-Id: FN-7537

Fusion-Task-Lineage: 47824270-c0d4-471b-a5c9-f5350176df29

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:16 -07:00
gsxdsm
ec9ac61c19 FN-7535: fix global GitLab settings not persisting on save
Fixes splitSettingsSave so the five global GitLab keys are diffed only against the scoped global initial values, not the project-merged effective values, so a real global edit is no longer dropped when it happens to match a project override.

- Add GLOBAL_GITLAB_SCOPED_ONLY_KEYS (gitlabEnabled, gitlabInstanceUrl, gitlabApiBaseUrl, gitlabAuthToken, gitlabAuthTokenType) that never fall back to merged initialValues when computing the save diff
- Update splitSettingsSave to treat these keys as scoped-global-only, treating a missing scoped-global initial as undefined rather than falling back to the merged value
- Add regression tests in settings-save-split.test.ts covering the scoped-vs-merged diff behavior
- Add regression tests in SettingsModal.general.test.tsx covering the save flow end-to-end
- Add changeset fn-7535-global-gitlab-setting-save.md (patch, fix)

Files changed:
 .changeset/fn-7535-global-gitlab-setting-save.md   |  7 +++
 .../app/__tests__/settings-save-split.test.ts      | 62 ++++++++++++++++++++++
 .../__tests__/SettingsModal.general.test.tsx       | 36 +++++++++++++
 .../app/components/settings/save-split.ts          | 26 ++++++++-
 4 files changed, 129 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-7535

Fusion-Task-Lineage: f9cd212e-a691-4cd9-8946-48c59537d583

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:16 -07:00
gsxdsm
8d36b99b22 FN-7536: fix Activity dropdown closing on mobile scroll/resize echoes
Route window resize/orientationchange/scroll through the same opening-viewport guard used by visualViewport so a same-gesture echo repositions the Activity menu instead of closing it, fixing the dropdown not showing on mobile.

- Add handleGuardedViewportChange shared by resize/orientationchange/visualViewport listeners so an opening-gesture echo only repositions the menu instead of closing it
- Add handleScrollChange to treat scrolls originating inside the .detail-tabs horizontal tab strip as benign (reposition-only), since window scroll listens with capture and would otherwise see nested scroller scrolls as a close signal
- Add regression tests covering mobile Activity dropdown open/scroll/resize behavior
- Add changeset for the fix
- Update dashboard guide docs

Files changed:
 .changeset/fn-7536-activity-dropdown-mobile.md     |   7 +
 docs/dashboard-guide.md                            |   1 +
 .../dashboard/app/components/TaskDetailModal.tsx   |  38 +++--
 .../TaskDetailModal.task-activity-chat.test.tsx    | 161 +++++++++++++++++++++
 4 files changed, 196 insertions(+), 11 deletions(-)

Fusion-Task-Id: FN-7536

Fusion-Task-Lineage: c8a3b11e-9bd2-4a61-b49e-038c93cfe4d2

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:16 -07:00
gsxdsm
df0be88482 FN-7534: fix branch-group completion for archived unlanded members
Branch-group completion no longer silently drops archived-but-unlanded members, which previously let genuinely-incomplete groups be flagged complete and promoted.

- listTasksByBranchGroup now scans with includeArchived:true so archived members stay counted in the group's total instead of dropping out silently
- ArchivedTaskEntry gains a persisted mergeDetails snapshot so an archived member that had already landed is still distinguished from one that never landed
- store.ts archival paths (task->archive projection) now carry mergeDetails through so isBranchGroupMemberLanded keeps working post-archival
- Added regression coverage in branch-group-store.test.ts and group-merge-coordinator.test.ts for archived-landed and archived-unlanded gating
- Added changeset documenting the fix as a patch-level bug fix

Files changed:
 .changeset/fn-7534-branch-group-archived-member.md              |   7 +
 docs/dashboard-guide.md                                         |   2 +
 packages/core/src/__tests__/branch-group-store.test.ts          |  77 +++++++++++
 packages/core/src/store.ts                                      |  30 ++++-
 packages/core/src/types.ts                                      |  11 ++
 packages/engine/src/__tests__/group-merge-coordinator.test.ts   | 148 ++++++++++++++++++++-
 6 files changed, 273 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-7534
Fusion-Task-Lineage: 510af857-ce08-49a0-a2a1-41b3ad473804
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:16 -07:00
gsxdsm
31822b0336 FN-7516: show effective oversight level and active overseer state on task cards
Adds two display-only badges to TaskCard so operators can see planner oversight configuration and live overseer activity at a glance.

- Resolve and display the workflow's effective `plannerOversightLevel` (observe/steer/autonomous) per task, with a module-level cache keyed by (projectId, workflowId) and in-flight de-duplication to avoid redundant `/api/workflows/:id/setting-values` fetches across cards sharing a workflow.
- Gate oversight badge rendering until the workflow-effective value resolves (or a per-task override is known) so the very first render never shows a guessed schema-default badge.
- Derive a card-local "active overseer state" indicator (Executor/Reviewer/Merger/Pull request/Workflow gate) that mirrors the engine's `resolveWatchedStage` precedence using only fields already present on the Task payload (column, paused, pausedReason, prInfo, reviewState, workflowTransitionNotification), since the real in-memory monitor state has no persisted/API surface today.
- Add corresponding CSS badge modifiers and update dashboard-guide.md documentation.
- Add TaskCard.oversight.test.tsx covering the new badges and update existing TaskCard tests/badge-wrap test for the new markup.

Files changed:
 docs/dashboard-guide.md                            |   4 +
 packages/dashboard/app/components/TaskCard.css     | 106 +++++-
 packages/dashboard/app/components/TaskCard.tsx     | 369 +++++++++++++++++++-
 .../__tests__/TaskCard.badge-wrap.test.tsx         |   1 +
 .../__tests__/TaskCard.oversight.test.tsx          | 383 +++++++++++++++++++++
 .../app/components/__tests__/TaskCard.test.tsx     |  32 +-
 6 files changed, 889 insertions(+), 6 deletions(-)

Fusion-Task-Id: FN-7516

Fusion-Task-Lineage: ce909409-862b-4697-a19e-d6735a3b572d

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:16 -07:00
gsxdsm
36bd74e337 FN-7532: stamp branch group merge attribution
Ensure shared branch group members record merge attribution so completion checklists reflect real landed state.

- Route AI merges through branch-group merge routing before selecting the integration target.
- Stamp mergeDetails merge target fields for both landed and no-op finalize paths.
- Record shared-group member landing state and best-effort managed PR checklist sync after AI merges.
- Cover dashboard, CLI lifecycle, and merger scenarios for accurate branch-group completion counts.

Files changed:
 .changeset/fn-7532-branch-group-completion.md      |  7 ++
 docs/dashboard-guide.md                            |  2 +
 .../src/commands/__tests__/task-lifecycle.test.ts  | 29 +++++++
 .../src/__tests__/routes-branch-groups.test.ts     | 45 +++++++++++
 packages/engine/src/__tests__/merger-ai.test.ts    | 68 +++++++++++++++-
 packages/engine/src/merger-ai.ts                   | 90 +++++++++++++++++++++-
 6 files changed, 235 insertions(+), 6 deletions(-)

Fusion-Task-Id: FN-7532

Fusion-Task-Lineage: cd65c18a-f1ad-4f8b-99b2-2e61e233f042

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:15 -07:00
gsxdsm
726cbf89cc FN-7531: expose planner overseer state to task cards
Expose transient planner overseer runtime snapshots to board task payloads and cards.

- Add core planner overseer state types and deterministic state derivation.
- Assemble read-only engine runtime snapshots from overseer observations and recovery registries.
- Enrich GET /api/tasks with best-effort planner overseer state and render non-idle TaskCard badges.
- Cover state derivation, API enrichment, runtime snapshot assembly, and card rendering with tests.

Files changed:
 .../fn-7531-planner-overseer-state-exposure.md     |   7 ++
 docs/architecture.md                               |  36 +++++++
 .../src/__tests__/planner-overseer-state.test.ts   |  85 +++++++++++++++
 packages/core/src/index.ts                         |   7 ++
 packages/core/src/planner-overseer-state.ts        |  78 ++++++++++++++
 packages/core/src/types.ts                         |  12 +++
 packages/dashboard/app/components/TaskCard.tsx     |  27 ++++-
 .../app/components/__tests__/TaskCard.test.tsx     |  29 ++++++
 .../__tests__/tasks-planner-overseer-state.test.ts | 114 +++++++++++++++++++++
 .../src/routes/register-task-workflow-routes.ts    |  23 ++++-
 .../planner-overseer-runtime-snapshot.test.ts      | 104 +++++++++++++++++++
 packages/engine/src/index.ts                       |   8 ++
 .../src/planner-overseer-runtime-snapshot.ts       |  67 ++++++++++++
 packages/engine/src/project-engine.ts              |  17 +++
 14 files changed, 612 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-7531

Fusion-Task-Lineage: b7659ed2-bf33-4312-a5ab-818ad37049b9

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:15 -07:00
gsxdsm
5ad8ec8cb6 FN-7528: capture post-task agent performance reflections
Capture deterministic post-task reflection metrics for completed agent tasks.

- Add non-LLM task performance capture with duration, touched files/packages, verification scope, and retry/rework metrics.
- Wire executor completion paths to fire best-effort reflection capture once per completed task when reflections are enabled.
- Extend reflection/run-audit types, docs, changeset, and regression coverage for capture behavior.

Files changed:
 .changeset/fn-7528-task-performance-capture.md     |   7 +
 AGENTS.md                                          |   1 +
 docs/diagnostics.md                                |  12 +-
 .../core/src/__tests__/reflection-store.test.ts    |  96 +++++++++
 packages/core/src/types.ts                         |  28 ++-
 .../engine/src/__tests__/agent-reflection.test.ts  | 202 +++++++++++++++++++
 .../executor-post-task-reflection-capture.test.ts  | 135 +++++++++++++
 packages/engine/src/agent-reflection.ts            | 215 ++++++++++++++++++++-
 packages/engine/src/executor.ts                    |  63 +++++-
 packages/engine/src/run-audit.ts                   |  29 +++
 10 files changed, 776 insertions(+), 12 deletions(-)

Fusion-Task-Id: FN-7528

Fusion-Task-Lineage: 153090e1-681b-4445-83e8-097bc70dcdb4

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 21:28:15 -07:00
gsxdsm
cbc66e1c3d fix(core): add task dimension to command-center token grouping (#1909)
## The bug

`GET /api/command-center/tokens` documents and accepts `groupBy=task`,
but the `task` dimension was never actually wired through the
aggregator. Four enumeration sites all stopped at `model | provider |
node | agent`:

- `TokenGroupBy` (core `token-analytics.ts`) did not include `"task"`.
- `groupKeyFor()` had no `case "task"`.
- `VALID_GROUP_BY` (dashboard route) rejected the value, so
`resolveGroupBy()` returned `undefined`.
- `groupAttributes()` (core `otel-metrics.ts`) emitted no attribute for
it.

Net effect: a caller asking for a per-task rollup silently fell back to
**ungrouped grand totals** — the per-task breakdown returned zero
groups, even though every task carries `tokenUsage*` and the data was
right there.

## The fix

Thread `"task"` through all four sites (5 functional lines + doc/test):

- Add `"task"` to the `TokenGroupBy` union — this makes the two `switch`
statements **compiler-exhaustive**, so `tsc` forces the two new cases
(no silent gaps).
- `groupKeyFor`: task rows group by their task id; chat rows have no
task and return `null`, mirroring the existing `node` case.
- `groupAttributes`: emit `task.id` for OTLP export, matching `node.id`
/ `agent.id`.
- `VALID_GROUP_BY`: accept `"task"`.

No schema or migration change — the task id is already on the row.

## Verification

- `pnpm --filter @fusion/core typecheck` and `@fusion/dashboard
typecheck` — clean.
- Extended the existing `groups by provider, node, agent` core test with
a `groupBy: "task"` assertion (two tasks → two groups keyed by task id,
100 / 200 tokens). Full suites green: **core 25/25**, **dashboard
325/325**.


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

## Summary by CodeRabbit

* **New Features**
* Added task-based token analytics grouping, alongside existing grouping
options.
* Analytics views and metrics now include task-level breakdowns when
available.

* **Bug Fixes**
* Improved grouping behavior so task totals are reported correctly in
analytics results.

* **Documentation**
* Updated supported analytics options to reflect task grouping in
endpoint and metric descriptions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-04 19:38:35 -07:00
gsxdsm
83e55a4fbe feat: add Coding (Ideas) workflow with manual Ideas intake (#1890)
## What

Adds a new built-in workflow **Coding (Ideas)** — a capture-first
variant of the default coding pipeline that puts a manual **Ideas (no
AI)** intake in front of a merged **Todo** (planner + capacity) column.

The board becomes five stages, each staffed by a distinct role:

```
Ideas (no AI)  →  Todo (planner)  →  In-progress (coder)  →  In-review (reviewer)  →  Done
```

## Why

The current board parks un-worked cards in a passive **Todo** column
where no agent is active. Operators asked for a way to (1) capture ideas
without the engine auto-planning them, and (2) collapse the triage/todo
split so every visible column has an agent working it — planning now
happens *in* Todo. A "Ready" badge distinguishes planned cards waiting
for a capacity slot from freshly promoted unplanned ones.

## How it works

1. **Create** a task against Coding (Ideas) → it lands in **Ideas**
(`autoTriage:false` intake). The triage service ignores it — no AI runs.
2. **Start** (button on the card, or drag) moves it to **Todo**. The
triage poll discovers the unplanned card (bootstrap-stub PROMPT.md) and
plans it in place.
3. While planning the card shows **Planning**; once the spec is written
it shows **Ready** and waits for an in-progress slot under the normal
capacity hold.
4. From Todo onward the graph is identical to the default Coding
workflow (stepwise execution → optional code review → merge).

## Engine changes

| Surface | Change |
|---|---|
| `createTask` (`store.ts`) | Lands cards in the workflow's intake
column (`resolvedEntryColumn`) instead of hardcoding `"triage"`. Default
workflow is byte-identical (intake resolves to `"triage"`).
Bootstrap-prompt check generalized to all pre-planning columns. |
| Triage poll (`triage.ts`) | Also discovers unplanned `todo` tasks
(bootstrap-stub prompt); `finalizeApprovedTask` skips the redundant
triage→todo move for in-place planning; planning-concurrency counter
covers both columns. |
| Scheduler (`scheduler.ts`) | Skips `todo` tasks with
`status:"planning"` or a bootstrap-stub prompt so unplanned cards are
never dispatched. |
| TaskCard (`TaskCard.tsx`) | **Start** button on ideas cards; **Ready**
badge on planned todo tasks. |
| Board (`board-workflows.ts`) | `ideas` column label. |

All engine changes are **gated** — they only affect workflows whose
intake is not `"triage"`, so the default Coding workflow and every
existing built-in are byte-identical in behavior.

## Tests

- `builtin-coding-ideas-workflow-ir.test.ts` *(new)* — column set,
intake trait (`autoTriage:false`), merged todo traits, node re-homing
(start→ideas, planning→todo), optional-group defaults, round-trip.
- `store-create-intake-column.test.ts` *(new)* — createTask lands in
`ideas` for explicit + default selection, `triage` for the default
workflow, writes a bootstrap prompt.
- Updated `builtin-workflows.test.ts` catalog-order assertion for the
new entry.

## Verification

- Typecheck: core ✓ engine ✓ dashboard ✓
- Lint ✓ · Changeset format ✓ (`minor`)
- Merge gate (`test:gate`): 321 engine-core + 63 CI-shape ✓
- Regression suites: triage (39), concurrency (165),
movement/migration/hooks (259), builtin workflows (65), store-create
(54) — all green
- `verify:fast`: workspace build + CLI build + boot smoke (`fn --help` +
real `/api/health`) ✓

## Changeset

`.changeset/fn-coding-ideas-workflow.md` — `@runfusion/fusion: minor`

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

* **New Features**
* Added a new “Coding (Ideas)” builtin workflow with an Ideas intake
stage and merged planning flow.
* Updated task cards to support a **Start** action and show a **Ready**
badge for qualifying planning-stage tasks.

* **Bug Fixes**
* Tasks created for the Ideas workflow now persist into the correct
entry column and get the right prompt bootstrapping.
* Scheduler and triage avoid promoting/releasing unplanned todo tasks
that still contain the bootstrap prompt stub, and stale planning is
cleaned up across the merged intake flow.

* **Tests**
* Added coverage for the new builtin workflow IR and create-task intake
wiring.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-04 19:37:28 -07:00
gsxdsm
75c47747b5 fix(core): preserve per-task tokenUsage across archival (#1908)
## The bug

Per-task token usage (and the cost figures derived from it) is
**silently dropped the moment a task is archived**. A task that burned
millions of tokens shows `0` — or nothing — everywhere once it leaves
the live board.

Root cause is a field whitelist plus a missing type field:

- `TaskStore.taskToArchiveEntry()` (`packages/core/src/store.ts`)
constructs the archived record from an **explicit property whitelist**.
It copies `modelId` / `modelProvider` / `planningModelId` / … but never
`task.tokenUsage`.
- `ArchivedTaskEntry` (`packages/core/src/types.ts`) has no `tokenUsage`
field, so even a stray copy would be dropped by the type.

At archival time the task is DB-hydrated and still carries `tokenUsage`,
and the live `tasks` row (with its `tokenUsage*` columns) is then
deleted — so the whitelist is the only place the data survives or dies.
Result: `archive.db` (`archived_tasks.taskJson`) never contains token
stats. Any tool that reports token/cost usage can only ever see the
small live working set, never the hundreds of finished tasks.

## The fix

Thread `tokenUsage` through the archive round-trip (5 lines, all
pass-through of the already-typed `TaskTokenUsage`):

- `ArchivedTaskEntry` gains an optional `tokenUsage?: TaskTokenUsage`
field.
- `taskToArchiveEntry()` copies `tokenUsage: task.tokenUsage` (write
path).
- `archiveEntryToTask()` and `unarchiveTask()` copy `tokenUsage:
entry.tokenUsage` (both restore paths), so restored tasks keep their
history too.

Because the archived entry is serialized into `taskJson`, no DB
migration/column is needed — the counts land in the existing JSON blob
and read back via `json_extract(taskJson, '$.tokenUsage.totalTokens')`
(and the `inputTokens` / `outputTokens` / `cachedTokens` /
`cacheWriteTokens` breakdown).

## Verification

Applied the equivalent change to the bundled `dist/bin.js` on a live
install and archived a 9.9M-token task into an isolated copy of the
store. The full breakdown survived into `archive.db`:

```
inputTokens=119  outputTokens=26100  cachedTokens=9637483  cacheWriteTokens=233674
totalTokens=9897376  modelId=claude-sonnet-4-6  (+ per-model split intact)
```

Without the change the same archival leaves `tokenUsage` absent from the
entry.


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

## Summary by CodeRabbit

* **Bug Fixes**
* Archived tasks now keep token usage details when saved and restored,
so task history remains accurate across archive flows.
* Restored archived tasks now display the same usage accounting they had
before being archived.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-04 19:37:06 -07:00
gsxdsm
2044d8892e Address PR review feedback round 2 (#1890)
- Derive the Start button target from the workflow's ordered move columns
  instead of hard-coding 'todo', so a manual-intake workflow whose first
  working stage has a different id transitions correctly. Falls back to
  'todo' when column metadata is unavailable.
2026-07-04 15:44:45 -07:00
gsxdsm
3ba7b08ccb Address PR review feedback (#1890)
- Gate bootstrap prompt to entry column/triage only, not every non-execution
  column, so direct createTask({column:'todo'}) keeps generateSpecifiedPrompt.
- Guard the workflow-column hold-release dispatch path (reserveSlot) against
  planning-status and bootstrap-stub todo tasks, matching the legacy filter.
- Extend clearStaleSpecifyingStatuses startup sweep to the todo column so a
  restarted in-place planning task does not hold a maxTriageConcurrent slot.
- Gate the Start button on the intake column flag instead of the literal
  'ideas' id, so any manual-intake workflow gets the affordance.
- Add regression test: direct todo create must not get a bootstrap stub.
2026-07-04 15:12:55 -07:00
gsxdsm
c16cc9e08a FN-7515: expose planner oversight configuration
Expose planner oversight as workflow-native configuration across task and workflow surfaces.

- Add a shared TaskForm selector for per-task planner oversight overrides with inherit semantics.
- Thread plannerOversightLevel through new task creation, task detail edits, and legacy dashboard API payloads.
- Add a Workflow Editor Values display group and documentation for configuring workflow defaults.
- Cover create, edit, form, and workflow settings behavior with dashboard tests.

Files changed:
 .changeset/fn-7515-planner-oversight-config-exposure.md   |  7 ++
 docs/dashboard-guide.md                                    |  1 +
 docs/settings-reference.md                                 |  2 +-
 packages/dashboard/app/api/legacy.ts                       |  3 +
 packages/dashboard/app/components/NewTaskModal.tsx         | 12 +++-
 packages/dashboard/app/components/TaskDetailModal.tsx      | 11 +++-
 packages/dashboard/app/components/TaskForm.tsx             | 34 ++++++++++
 packages/dashboard/app/components/__tests__/NewTaskModal.test.tsx | 31 +++++++++
 packages/dashboard/app/components/__tests__/TaskDetailModal.inline-editing-and-integrations.test.tsx | 76 ++++++++++++++++++++++
 packages/dashboard/app/components/__tests__/TaskForm.test.tsx | 28 ++++++++
 packages/dashboard/app/components/__tests__/WorkflowSettingsPanel.test.tsx | 34 ++++++++++
 packages/dashboard/app/components/workflow-setting-display.ts | 17 ++++-
 12 files changed, 251 insertions(+), 5 deletions(-)

Fusion-Task-Id: FN-7515

Fusion-Task-Lineage: aded67c0-835c-4046-b691-04dc2bb2d314

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 14:26:46 -07:00
gsxdsm
79ab367547 FN-7514: withhold overseer actions under human control
Add a human-control guard so planner overseer recovery stays inert for paused or human-review tasks.

- Add a pure overseer human-control policy that treats explicit user pauses and autoMerge:false / human-review tasks as full withhold states.
- Thread settings through planner recovery ticks, skip action classification and pending confirmations when withheld, and emit deduped no-action run-audit events.
- Wire ProjectEngine audit recording and document the new guard, run-audit event, exports, and release note.

Files changed:
 .changeset/fn-7514-overseer-human-control-guard.md |   7 +
 AGENTS.md                                          |   1 +
 docs/architecture.md                               |  39 +++++
 .../overseer-human-control-policy.test.ts          |  86 +++++++++++
 ...anner-recovery-controller-human-control.test.ts | 170 +++++++++++++++++++++
 packages/engine/src/index.ts                       |   7 +
 .../engine/src/overseer-human-control-policy.ts    |  88 +++++++++++
 packages/engine/src/planner-recovery-controller.ts | 107 ++++++++++++-
 packages/engine/src/project-engine.ts              |  44 +++++-
 packages/engine/src/run-audit.ts                   |  15 +-
 10 files changed, 558 insertions(+), 6 deletions(-)

Fusion-Task-Id: FN-7514

Fusion-Task-Lineage: d4d3bd04-3f8e-4a05-9636-f177e050390b

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 14:11:25 -07:00
gsxdsm
b545083249 FN-7530: isolate flaky dist-barrel extension test
Restore the stable extension suite by quarantining only the dist-barrel recompilation case.

- Move the built @fusion/core dist-barrel extension test into its own file.
- Re-admit extension.test.ts while keeping the isolated dist-barrel file quarantined.
- Update the quarantine ledger and velocity baseline to reflect the narrowed quarantine.

Files changed:
 docs/test-velocity-baseline.md                     |  10 +-
 .../src/__tests__/extension-dist-barrel.test.ts    | 230 +++++++++++++++++++++
 packages/cli/src/__tests__/extension.test.ts       | 103 +--------
 packages/cli/vitest.config.ts                      |   5 +-
 scripts/lib/test-quarantine.json                   |   4 +-
 5 files changed, 247 insertions(+), 105 deletions(-)

Fusion-Task-Id: FN-7530

Fusion-Task-Lineage: 7b07540f-689b-4133-b590-a39427095397

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 14:04:29 -07:00
gsxdsm
ed5417a341 FN-7529: fix desktop header search test
Update the App test to assert the open desktop search panel state after rerender.\n\n- Avoid re-clicking the desktop search toggle after the non-mobile panel stays open across rerender.\n- Assert the branch-filter selects directly while the search panel remains rendered.\n\nFiles changed:\n packages/dashboard/app/components/__tests__/App.test.tsx | 9 +++++++--\n 1 file changed, 7 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-7529

Fusion-Task-Lineage: 1495f872-d262-4ea4-83f2-5a53ecf7a202

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 13:57:20 -07:00
gsxdsm
2cc84b5177 FN-7513: require planner confirmation for risky side effects
Require explicit approval before planner recovery runs merge, PR, destructive, or external-service actions.

- Add pure planner side-effect classification and confirmation request modeling in core.
- Route merge/PR recovery decisions to await confirmation instead of autonomous dispatch.
- Persist pending confirmation requests and only execute approved controller actions.
- Cover confirmation gating with core and engine regression tests and document the policy.

Files changed:
 .changeset/fn-7513-planner-confirmation-gate.md    |   7 +
 docs/architecture.md                               |  85 ++++++++-
 docs/settings-reference.md                         |   2 +-
 .../src/__tests__/planner-confirmation.test.ts     | 125 +++++++++++++
 .../core/src/__tests__/planner-recovery.test.ts    |  14 +-
 packages/core/src/index.ts                         |   7 +
 packages/core/src/planner-confirmation.ts          | 141 ++++++++++++++
 packages/core/src/planner-recovery.ts              | 103 ++++++++---
 ...lanner-recovery-controller-confirmation.test.ts | 205 +++++++++++++++++++++
 packages/engine/src/index.ts                       |   5 +
 packages/engine/src/planner-recovery-controller.ts | 204 +++++++++++++++++++-
 packages/engine/src/project-engine.ts              |  44 +++++
 12 files changed, 913 insertions(+), 29 deletions(-)

Fusion-Task-Id: FN-7513

Fusion-Task-Lineage: 1e3c6640-8a4f-41f6-89dd-41eb9b675b2b

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 13:51:09 -07:00
gsxdsm
3b52a4d2d9 FN-7527: fix desktop server switching redirects
Route desktop shell server switches through the live runtime/profile state.

- Replace separate local/remote redirect effects with a shared resolver that uses localRuntime/baseUrl and active remote profiles.
- Remove the dead localServer shell state field and document the local/remote switch navigation behavior.
- Add regression coverage for desktop shell redirect targets and include a patch changeset.

Files changed:
 .changeset/fn-7527-desktop-switch-server-navigation.md    |   7 +
 docs/native-shell.md                               |   2 +-
 packages/dashboard/app/App.tsx                     |  44 ++---
 packages/dashboard/app/components/__tests__/App.test.tsx          |   1 -
 packages/dashboard/app/types/native-shell.d.ts     |  13 +-
 packages/dashboard/app/utils/__tests__/appLifecycle.test.ts       | 180 +++++++++++++++++++++
 packages/dashboard/app/utils/appLifecycle.ts       |  70 ++++++++
 7 files changed, 280 insertions(+), 37 deletions(-)

Fusion-Task-Id: FN-7527

Fusion-Task-Lineage: a0fe5cbc-120b-4a56-b791-48306223a636

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 13:43:59 -07:00
gsxdsm
87a700cd4d FN-7506: add scoped settings reset actions
Add a Settings footer reset flow for scoped menu and project-wide defaults.

- Add Reset Settings dialog actions for the active settings menu and all project settings.
- Track section-owned settings keys in a shared scope-aware registry and reuse it for save/reset validation.
- Cover modal/mobile reset behavior, registry invariants, docs, i18n strings, and a release changeset.

Files changed:
 .changeset/fn-7506-settings-reset.md               |   7 +
 docs/dashboard-guide.md                            |  12 +
 .../dashboard/app/components/SettingsModal.css     |  33 +++
 .../dashboard/app/components/SettingsModal.tsx     | 215 +++++++++++++++++-
 .../__tests__/SettingsModal.general.test.tsx       | 145 ++++++++++++
 .../components/__tests__/settings-mobile.test.tsx  |  37 +++-
 .../settings/__tests__/section-keys.test.ts        | 171 ++++++++++++++
 .../app/components/settings/save-split.ts          |   9 +-
 .../app/components/settings/section-keys.ts        | 246 +++++++++++++++++++++
 packages/i18n/locales/en/app.json                  |  11 +
 packages/i18n/locales/zh-CN/app.json               |  11 +
 11 files changed, 886 insertions(+), 11 deletions(-)

Fusion-Task-Id: FN-7506
Fusion-Task-Lineage: a627e820-fe3b-42c5-adf2-97469bbe7a3b
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 13:36:01 -07:00
gsxdsm
81f2053921 FN-7512: add bounded planner recovery
Adds bounded autonomous planner recovery decisions and dispatch so overseer observations can safely nudge stuck planning stages.

- Add pure core recovery policy with per-stage attempt limits and no-op fallbacks for disallowed or exhausted cases.
- Add engine controller wiring to inject guidance, retry steps, request targeted fixes, and emit recovery audit events.
- Register the planner recovery controller in project engine lifecycle and document the autonomous recovery behavior.
- Cover core decisions and controller dispatch with targeted tests, plus a patch changeset for the published CLI package.

Files changed:
 .changeset/fn-7512-planner-bounded-recovery.md     |   7 +
 docs/architecture.md                               |  62 ++++++
 .../core/src/__tests__/planner-recovery.test.ts    | 116 +++++++++++
 packages/core/src/index.ts                         |  12 ++
 packages/core/src/planner-recovery.ts              | 222 +++++++++++++++++++++
 .../__tests__/planner-recovery-controller.test.ts  | 163 +++++++++++++++
 packages/engine/src/index.ts                       |  20 ++
 packages/engine/src/planner-recovery-controller.ts | 195 ++++++++++++++++++
 packages/engine/src/project-engine.ts              |  66 ++++++
 9 files changed, 863 insertions(+)

Fusion-Task-Id: FN-7512

Fusion-Task-Lineage: aad3849d-090e-497d-ae5c-34ec7ca96c3d

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 13:19:02 -07:00
gsxdsm
4baa4c43c5 FN-7505: show defaults in settings descriptions
Expose settings defaults directly in dashboard help text so operators can see baseline values while editing settings.

- Add default-value wording across global and project settings descriptions and locale strings.
- Document the dashboard/default-reference alignment and add a changeset for the published CLI package.
- Add coverage that every visible settings field includes its default in helper text and update existing assertions.

Files changed:
 .changeset/fn-7505-settings-default-descriptions.md       |   7 +
 docs/dashboard-guide.md                                    |   3 +
 docs/settings-reference.md                                 |   3 +
 .../__tests__/SettingsModal.general.test.tsx               |   2 +-
 .../settings/sections/AgentPermissionsSection.tsx          |   4 +-
 .../settings/sections/AppearanceSection.tsx                |   4 +-
 .../settings/sections/BackupsSection.tsx                   |  13 +-
 .../settings/sections/CommandsSection.tsx                  |   4 +-
 .../settings/sections/ExperimentalSection.tsx              |   2 +-
 .../settings/sections/GeneralSection.tsx                   |  26 +-
 .../settings/sections/GlobalGeneralSection.tsx             |  25 +-
 .../settings/sections/GlobalModelsSection.tsx              |  24 +-
 .../settings/sections/McpServersCard.tsx                   |   1 +
 .../components/settings/sections/MemorySection.tsx         |  12 +-
 .../components/settings/sections/MergeSection.tsx          |  37 +-
 .../settings/sections/ModelPricingSection.tsx              |   2 +-
 .../settings/sections/NodeRoutingSection.tsx               |   3 +-
 .../settings/sections/NodeSyncSection.tsx                  |   6 +-
 .../settings/sections/NotificationsSection.tsx             |  14 +-
 .../settings/sections/ProjectModelsSection.tsx             |  11 +-
 .../settings/sections/PromptsSection.tsx                   |   2 +-
 .../components/settings/sections/RemoteSection.tsx         |   7 +-
 .../settings/sections/ResearchGlobalSection.tsx            |  15 +-
 .../settings/sections/ResearchProjectSection.tsx           |  16 +-
 .../settings/sections/ScheduledEvalsSection.tsx            |   7 +-
 .../settings/sections/SchedulingSection.tsx                |  20 +-
 .../settings/sections/WorktreesSection.tsx                 |  14 +-
 .../sections/__tests__/AppearanceSection.test.tsx          |   4 +-
 .../MergeSection.legacy-automerge-cleanup.test.tsx         |   2 +-
 .../settings-default-descriptions.test.tsx                 | 573 +++++++++++++++++++++
 packages/i18n/locales/en/app.json                          | 261 ++++++----
 31 files changed, 914 insertions(+), 210 deletions(-)

Fusion-Task-Id: FN-7505

Fusion-Task-Lineage: 7688caf2-2a95-4401-8b27-9da4b46ecfcd

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 13:09:29 -07:00
gsxdsm
12a6d1bc6a FN-7511: add planner overseer stage monitoring
Add records-only planner overseer monitoring across in-flight task lifecycle stages.

- Add a PlannerOverseerMonitor with normalized observations and deterministic watched-stage resolution.
- Wire ProjectEngine to poll in-progress and in-review tasks, gated by effective planner oversight level.
- Document the monitoring seam and add focused coverage plus a release changeset.

Files changed:
 .changeset/fn-7511-planner-overseer-monitoring.md  |   7 +
 docs/architecture.md                               |  26 ++
 docs/workflow-steps.md                             |   2 +
 .../engine/src/__tests__/planner-overseer.test.ts  | 294 ++++++++++++++++++
 packages/engine/src/index.ts                       |  12 +
 packages/engine/src/planner-overseer.ts            | 338 +++++++++++++++++++++
 packages/engine/src/project-engine.ts              |  93 +++++-
 7 files changed, 771 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-7511

Fusion-Task-Lineage: 81b616cf-47e9-4769-b02d-fc7ebd3fcb2f

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 12:55:25 -07:00
gsxdsm
0689250097 FN-7510: default planner oversight to autonomous
Enable full planner steering/control by default while preserving explicit workflow and task opt-outs.

- Document that planner oversight resolves as task override, workflow setting, then autonomous default.
- Add regression coverage for built-in workflow defaults, stored workflow overrides, and per-task overrides.
- Add a minor changeset for the published Fusion package.

Files changed:
 .changeset/fn-7510-oversight-default.md            |  7 ++
 docs/workflow-steps.md                             |  9 ++-
 .../plannerOversightLevel-default.test.ts          | 79 ++++++++++++++++++++++
 3 files changed, 93 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-7510

Fusion-Task-Lineage: 2dbf8273-4239-4754-9713-e089f75be930

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 12:38:14 -07:00
gsxdsm
aa757bc1a3 FN-7509: add per-task planner oversight overrides
Add core support for tasks to carry a planner oversight override that can supersede workflow settings.

- Add nullable plannerOversightLevel task storage, schema migration, store update/create/archive plumbing, and mesh replication support.
- Export planner oversight level types/defaults and an effective-level resolver with task-over-workflow precedence.
- Document override precedence and add regression coverage for migration, persistence, updates, and resolution.
- Add a minor changeset for the published Fusion package.

Files changed:
 .../fn-7509-per-task-planner-oversight-override.md |  7 ++
 docs/settings-reference.md                         |  2 +-
 packages/core/src/__tests__/db.test.ts             | 45 +++++++++++++
 packages/core/src/__tests__/store-update.test.ts   | 75 ++++++++++++++++++++++
 .../__tests__/workflow-settings-resolver.test.ts   | 28 ++++++++
 packages/core/src/db.ts                            | 17 ++++-
 packages/core/src/index.ts                         |  5 +-
 packages/core/src/mesh-task-replication.ts         |  2 +
 packages/core/src/store.ts                         | 15 ++++-
 packages/core/src/types.ts                         | 23 +++++++
 packages/core/src/workflow-settings-resolver.ts    | 28 ++++++++
 11 files changed, 240 insertions(+), 7 deletions(-)

Fusion-Task-Id: FN-7509

Fusion-Task-Lineage: 41695cc5-34d2-4079-9e34-a8fb40f961fb

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 12:32:09 -07:00
flexi767
b2cf2db106 fix(core): add task dimension to command-center token grouping
The command-center token endpoint accepts groupBy=task, but the
dimension was never wired through: TokenGroupBy did not include "task",
groupKeyFor had no task case, VALID_GROUP_BY rejected it, and
groupAttributes emitted no attribute. As a result groupBy=task silently
fell back to ungrouped totals — the per-task rollup returned zero groups
even though tasks.tokenUsage* is populated per task.

Thread "task" through all four enumeration sites (the union type makes
the two switches compiler-exhaustive). Task rows group by task id; chat
rows have no task and return null, mirroring the existing node case.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 19:29:47 +00:00
gsxdsm
4707eb5be0 FN-7526: guard plan auto-approval routing
Adds regression coverage ensuring project auto-approve-all sends eligible plans to todo without weakening independent gates.

- Cover Plan Review retry routing when workflow-stored requirePlanApproval is overridden by project auto-approve-all.
- Verify release authorization and Workflow Plan Review still block independently under auto-approve-all.
- Add refinement and self-healing routing coverage plus a patch changeset for the published CLI package.

Files changed:
 .changeset/fn-7526-plan-auto-approve.md            |   7 ++
 .../self-healing-starved-refinement.test.ts        |  61 +++++++++
 .../__tests__/triage-refinement-routing.test.ts    |  54 ++++++++
 packages/engine/src/__tests__/triage.test.ts       | 139 +++++++++++++++++++++
 packages/engine/src/triage.ts                      |   3 +
 5 files changed, 264 insertions(+)

Fusion-Task-Id: FN-7526

Fusion-Task-Lineage: 642d7856-d546-423b-bf10-68c28e205e21

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 12:25:18 -07:00
gsxdsm
9f24b507fc FN-7507: prioritize topmost dashboard shortcut dismissal
Refine dashboard keyboard shortcut behavior and coverage for configurable popup handling.

- Factor App Escape dismissal into a pure helper that closes one topmost surface at a time.
- Prioritize popped-out tasks ahead of Quick Chat, Terminal, and fixed dashboard modals.
- Add regression coverage for configurable shortcut bindings, editable focus guards, default-prevented events, and Escape ordering.
- Update dashboard shortcut documentation and release-note wording.

Files changed:
 .changeset/fn-7494-keyboard-shortcuts.md           |   4 +-
 docs/dashboard-guide.md                            |   2 +-
 packages/dashboard/app/App.tsx                     | 110 +++++++++-----
 .../app/__tests__/App.keyboard-shortcuts.test.tsx  | 158 +++++++++++++++++++++
 .../app/utils/__tests__/keyboardShortcuts.test.ts  |   1 +
 5 files changed, 236 insertions(+), 39 deletions(-)

Fusion-Task-Id: FN-7507

Fusion-Task-Lineage: 804986ef-ec6c-4404-a168-6d154f75b118

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 12:08:38 -07:00
flexi767
cdf83eda45 fix(core): preserve per-task tokenUsage across archival
taskToArchiveEntry() builds the archived record from an explicit field
whitelist that omits task.tokenUsage, and ArchivedTaskEntry has no
tokenUsage field — so a task's input/output/cache token (and derived cost)
accounting is silently dropped the moment it is swept out of the live
tasks table into archive.db. Every archived task loses its token stats.

Add tokenUsage to the ArchivedTaskEntry type and thread it through both the
archive write path (taskToArchiveEntry) and the two restore paths
(archiveEntryToTask, unarchiveTask) so the counts round-trip intact.
2026-07-04 20:56:50 +02:00
gsxdsm
2f23d2260d FN-7494: add configurable dashboard shortcuts
Add configurable dashboard keyboard shortcuts for opening Quick Chat and Terminal.

- Add global settings defaults, schemas, persistence, and Settings UI controls for dashboard shortcuts.
- Register safe document-level shortcut handling with editable-target guards and Escape popup dismissal.
- Normalize shortcut strings, detect disabled/conflicting bindings, and document operator behavior.
- Cover shortcut parsing, dashboard listener behavior, and settings persistence with tests.

Files changed:
 .changeset/fn-7494-keyboard-shortcuts.md           |   7 +
 docs/dashboard-guide.md                            |  14 ++
 .../core/src/__tests__/global-settings.test.ts     |  20 +++
 .../core/src/__tests__/settings-defaults.test.ts   |  10 ++
 .../core/src/__tests__/settings-parity.test.ts     |  10 ++
 packages/core/src/__tests__/store-settings.test.ts |  10 ++
 packages/core/src/settings-schema.ts               |   8 +
 packages/core/src/types.ts                         |  12 ++
 packages/dashboard/app/App.tsx                     |  52 ++++++
 .../dashboard/app/components/SettingsModal.css     |  21 +++
 .../dashboard/app/components/SettingsModal.tsx     |  11 ++
 .../__tests__/SettingsModal.general.test.tsx       |  63 ++++++++
 .../app/components/settings/save-split.ts          |   1 +
 .../settings/sections/GlobalGeneralSection.tsx     |  38 +++++
 .../useDashboardKeyboardShortcuts.test.tsx         | 101 ++++++++++++
 packages/dashboard/app/hooks/useAppSettings.ts     |   8 +-
 .../app/hooks/useDashboardKeyboardShortcuts.ts     |  66 ++++++++
 .../app/utils/__tests__/keyboardShortcuts.test.ts  |  76 +++++++++
 packages/dashboard/app/utils/keyboardShortcuts.ts  | 175 +++++++++++++++++++++
 19 files changed, 702 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-7494
Fusion-Task-Lineage: 30445f4d-c0c5-4657-bd79-fc2acaf3c37d
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 11:38:42 -07:00
gsxdsm
68f5153e17 FN-7508: add planner oversight workflow setting
Declare a workflow-native planner oversight level with release notes and docs.

- Add the plannerOversightLevel enum setting with Off, Observe, Steer, and Autonomous recovery values.
- Export the oversight settings catalog and include it in built-in workflow defaults.
- Cover consistency, resolver defaults, and catalog membership with core tests.
- Document the workflow setting and add the published package changeset.

Files changed:
 .../fn-7508-planner-oversight-level-setting.md     |  7 +++++
 docs/settings-reference.md                         |  8 ++++--
 docs/workflow-steps.md                             | 17 +++++++-----
 .../builtin-workflow-settings-triage.test.ts       | 32 ++++++++++++++++++++++
 .../src/__tests__/settings-consistency.test.ts     |  4 ++-
 .../__tests__/workflow-settings-resolver.test.ts   |  1 +
 packages/core/src/builtin-workflow-settings.ts     | 26 ++++++++++++++++++
 packages/core/src/index.ts                         |  1 +
 8 files changed, 86 insertions(+), 10 deletions(-)

Fusion-Task-Id: FN-7508

Fusion-Task-Lineage: 1adc7ce6-9e0e-475e-956a-ee36edae0cdc

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 11:26:31 -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
b0208c140a FN-7500: restore terminal clipboard shortcuts
Restore terminal copy and paste shortcut handling across integrated and embedded sessions.

- Handle Ctrl/Cmd+V by reading clipboard text and forwarding it once to the active PTY or attach channel.
- Preserve Ctrl/Cmd+C selection copy behavior while leaving no-selection interrupts available to the shell.
- Document the exact-once terminal paste behavior and add a patch changeset.
- Cover successful, missing, rejected, and empty clipboard paste paths in terminal tests.

Files changed:
 .changeset/fn-7500-terminal-shortcuts.md           |  7 +++
 docs/dashboard-guide.md                            |  4 +-
 .../dashboard/app/components/SessionTerminal.tsx   | 24 ++++++++++-
 .../dashboard/app/components/TerminalModal.tsx     | 23 ++++++++-
 .../components/__tests__/SessionTerminal.test.tsx  | 43 ++++++++++++++++-
 .../components/__tests__/TerminalModal.test.tsx    | 50 +++++++++++++++++++-
 6 files changed, 132 insertions(+), 19 deletions(-)

Fusion-Task-Id: FN-7500

Fusion-Task-Lineage: 8e87fa22-c0b7-402d-aeef-322cbd852529

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:21 -07:00
gsxdsm
a2d6349bb8 FN-7504: keep mobile chat composer above keyboard chrome
Keeps the mobile Chat composer visible when iOS keyboard accessory chrome is open.

- Add ChatView-local keyboard accessory clearance for iOS keyboard-active composer padding.
- Reset the clearance when keyboard tracking is suppressed or torn down, without adding persistent thread transforms.
- Cover empty, streaming, room, and Android mobile composer behavior with regression tests.
- Add a patch changeset for the published Fusion package.

Files changed:
 .../fn-7504-mobile-chat-composer-keyboard.md       |   7 +
 packages/dashboard/app/components/ChatView.css     |   4 +
 packages/dashboard/app/components/ChatView.tsx     |  10 ++
 .../components/__tests__/ChatView.mobile.test.tsx  | 191 +++++++++++++++++++++
 4 files changed, 212 insertions(+)

Fusion-Task-Id: FN-7504

Fusion-Task-Lineage: 4e7ed36e-e7d5-4cd1-934b-3b0f19ed6615

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:21 -07:00
gsxdsm
7d8a1b8831 FN-7502: add pinned terminal layout
Adds a persisted pinned terminal mode that places the terminal below the dashboard instead of overlaying it.

- Add a project-scoped below display mode with pin/unpin header controls and resize support.
- Render below-mode terminal in the dashboard flow while preserving overlay behavior for docked, floating, and mobile modes.
- Move terminal utility actions into the header so controls remain available across layouts.
- Document the new terminal pin control and add release-note coverage plus regression tests.

Files changed:
 .changeset/fn-7502-terminal-below-layout.md        |   7 +
 docs/dashboard-guide.md                            |  16 +-
 packages/dashboard/app/App.tsx                     |  22 +-
 packages/dashboard/app/components/AppModals.tsx    |  14 --
 .../dashboard/app/components/ProjectSelector.css   |  12 +
 .../dashboard/app/components/TerminalModal.css     | 108 ++++++---
 .../dashboard/app/components/TerminalModal.tsx     | 246 +++++++++++----------
 .../components/__tests__/TerminalModal.test.tsx    | 100 ++++++++-
 8 files changed, 351 insertions(+), 174 deletions(-)

Fusion-Task-Id: FN-7502

Fusion-Task-Lineage: bb1b5e22-d19f-4af1-aa34-4213bc712384

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:21 -07:00
gsxdsm
d2e3134746 FN-7499: require before-after task summaries
Require generated task specs to summarize the requested before-to-after transformation near the top.

- Add a Before → After Transformation section to standard and fast planning prompt templates.\n- Document the new task definition section and cover it with prompt regression tests.\n- Add a patch changeset for the published Fusion package.\n\nFiles changed:\n .changeset/fn-7499-before-after-transformation.md |  7 +++++++\n docs/task-management.md                           |  1 +\n packages/core/src/__tests__/agent-prompts.test.ts | 17 +++++++++++++++\n packages/core/src/agent-prompts.ts                | 25 +++++++++++++++++++----\n packages/engine/src/__tests__/triage.test.ts      | 20 ++++++++++++++++++\n 5 files changed, 66 insertions(+), 4 deletions(-)

Fusion-Task-Id: FN-7499

Fusion-Task-Lineage: d049b5d6-a4bc-40dd-831d-04a11f9dc2cf

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:20 -07:00
gsxdsm
e8dc2ae6d1 FN-7498: show original task prompts in Plan tab
Display the initial task prompt separately from the generated plan in task details.

- Add a read-only Original prompt section above generated PROMPT.md content in task detail Plan views.
- Preserve plain-text formatting and responsive wrapping for original prompts while leaving plan edit/revision controls scoped to generated prompts.
- Cover modal, embedded, empty-state, CSS, docs, and release-note behavior.

Files changed:
 .changeset/fn-7498-original-task-prompt.md         |   7 ++
 docs/dashboard-guide.md                            |   1 +
 .../dashboard/app/components/TaskDetailModal.css   |  30 +++++
 .../dashboard/app/components/TaskDetailModal.tsx   |  18 +++
 ...lModal.inline-editing-and-integrations.test.tsx | 127 ++++++++++++++++++++-
 5 files changed, 182 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-7498

Fusion-Task-Lineage: df83c73d-d731-4ba4-942b-bd93ec1b9712

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:20 -07:00
gsxdsm
61c8bdc117 FN-7497: keep accepted chat streams waiting
Keep accepted-but-silent chat streams waiting so late responses can reconcile without false timeout failures.

- Stop aborting accepted chat streams when the first SSE event timer fires without content.
- Cover desktop, mobile, planner chat, reattach, hook, and SSE parser paths for late accepted responses.
- Add a patch changeset for the chat first-event timeout fix.

Files changed:
 .changeset/fn-7497-chat-first-event-timeout.md     |  7 +++
 .../app/api/__tests__/legacy-chat-stream.test.ts   | 27 ++++++--
 packages/dashboard/app/api/legacy.ts               |  8 ++-
 .../__tests__/ChatView.core-interactions.test.tsx  | 41 +++++++++++++
 .../__tests__/TaskPlannerChatTab.test.tsx          | 71 ++++++++++++++++++++++
 .../dashboard/app/hooks/__tests__/useChat.test.ts  | 41 +++++++++++++
 6 files changed, 188 insertions(+), 7 deletions(-)

Fusion-Task-Id: FN-7497

Fusion-Task-Lineage: bb53793d-dc78-4a25-af22-ed1c62b73094

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:20 -07:00
gsxdsm
efa8105036 FN-7495: add settings search
Add a searchable Settings navigation that filters visible sections by setting names and keywords.

- Add a Settings search field with clear and empty-state affordances for desktop and mobile layouts.
- Filter only the already-visible Settings sections while preserving matching group headers and mobile section labels.
- Add searchable section metadata, localized labels, tests, docs, and a release changeset.

Files changed:
 .changeset/fn-7495-settings-search.md              |   7 +
 docs/dashboard-guide.md                            |   5 +
 .../dashboard/app/components/SettingsModal.css     |  97 +++++-
 .../dashboard/app/components/SettingsModal.tsx     | 346 ++++++++++++++++-----
 .../__tests__/SettingsModal.general.test.tsx       |  71 +++++
 .../components/__tests__/settings-mobile.test.tsx  |  25 ++
 .../settings/sections/McpServersCard.tsx           |   2 +-
 packages/i18n/locales/en/app.json                  |  11 +
 8 files changed, 475 insertions(+), 89 deletions(-)

Fusion-Task-Id: FN-7495
Fusion-Task-Lineage: 1d703059-6156-4d20-afbd-3cdb64e3e9f3
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:20 -07:00
gsxdsm
5689346afc FN-7490: fix post-merge push target resolution
Fix post-merge push settings so direct merges use the configured push target reliably.

- Resolve remote-only push targets from the merge integration branch, including detached-head merge worktrees.
- Clear hidden stale Push Remote values when Push to remote after merge is disabled while preserving persisted enabled values.
- Add dashboard, API, and merger regression coverage plus operator documentation and a patch changeset.

Files changed:
 .changeset/fn-7490-push-to-remote-setting.md       |   7 ++
 docs/settings-reference.md                         |   6 +-
 .../dashboard/app/components/SettingsModal.tsx     |   5 ++
 .../SettingsModal.scheduling-merge.test.tsx        |  59 +++++++++++-
 .../components/__tests__/settings-mobile.test.tsx  |  30 ++++++-
 .../src/__tests__/routes-settings.test.ts          |  28 ++++++
 .../src/__tests__/merger-prompt-and-utils.test.ts  | 100 ++++++++++++++++++++-
 packages/engine/src/merger.ts                      |  13 ++-
 8 files changed, 238 insertions(+), 10 deletions(-)

Fusion-Task-Id: FN-7490

Fusion-Task-Lineage: 774515bc-ea8b-427d-89ac-8d047f0273d4

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:20 -07:00
gsxdsm
8668a053dc FN-7491: add workflow toggle for proactive triage splitting
Add a workflow-scoped policy switch so operators can keep large triage tasks intact unless subtask splitting is explicitly requested.

- Define triageProactiveSubtaskSplittingEnabled with default-on workflow settings, display formatting, and prompt rendering.
- Preserve mandatory breakIntoSubtasks behavior while disabling automatic oversized-task decomposition when the setting is false.
- Cover the new policy in core, engine, and dashboard tests plus settings/workflow docs and a changeset.

Files changed:
 .changeset/FN-7491-triage-splitting-setting.md     |  7 +++
 docs/settings-reference.md                         |  6 +++
 docs/workflow-steps.md                             | 10 ++--
 packages/core/src/__tests__/agent-prompts.test.ts  | 17 ++++--
 .../builtin-workflow-settings-triage.test.ts       | 23 ++++++++
 packages/core/src/agent-prompts.ts                 | 27 ++--------
 packages/core/src/builtin-workflow-settings.ts     | 44 ++++++++++++++++
 .../__tests__/WorkflowSettingsPanel.test.tsx       | 53 +++++++++++++++++++
 .../app/components/workflow-setting-display.ts     | 10 ++++
 .../__tests__/triage-threshold-settings.test.ts    | 28 ++++++++++
 packages/engine/src/__tests__/triage.test.ts       | 61 +++++++++++++++++++---
 11 files changed, 250 insertions(+), 36 deletions(-)

Fusion-Task-Id: FN-7491

Fusion-Task-Lineage: c982455a-685c-4ce2-8e33-6d1a7bb9d154

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:20 -07:00
gsxdsm
b42be87ad1 FN-7493: keep task popups on board layer
Keep task-detail popups below global utility windows while preserving Activity menu visibility.

- Route ordinary task-detail FloatingWindow instances through a lower task-detail z-index band.
- Emit and consume popup geometry-change signals so root-portaled Activity menus stay attached during drag and resize.
- Extend dashboard tests and docs for popup layering and Activity dropdown behavior.

Files changed:
 .changeset/fn-7493-task-popup-layer.md             |  7 +++
 docs/dashboard-guide.md                            |  8 ++-
 docs/settings-reference.md                         |  2 +-
 packages/dashboard/app/App.tsx                     |  4 ++
 .../App.taskDetailFloatingGeometry.test.tsx        | 45 +++++++++++++-
 .../dashboard/app/components/FloatingWindow.tsx    | 31 ++++++++--
 .../dashboard/app/components/TaskDetailModal.css   |  3 +
 .../dashboard/app/components/TaskDetailModal.tsx   | 27 ++++++++-
 .../components/__tests__/FloatingWindow.test.tsx   | 32 +++++++++-
 .../FloatingWindowStack.cross-type.test.tsx        | 48 ++++++++++++---
 .../TaskDetailModal.task-activity-chat.test.tsx    | 68 ++++++++++++++++++++++
 .../app/components/floatingWindowStack.ts          | 22 +++++--
 12 files changed, 272 insertions(+), 25 deletions(-)

Fusion-Task-Id: FN-7493

Fusion-Task-Lineage: 5f1ec72c-f8dc-44ee-b303-319e0faac0f9

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:19 -07:00
gsxdsm
978cdda77c FN-7492: show active triage plan review progress
Show triage task cards when Plan Review is actively running.

- Render the existing progress affordance for triage cards only when unified progress has an active item.
- Keep enabled-but-idle workflow steps hidden to avoid false active indicators and empty progress shells.
- Cover running, idle, and empty triage progress states in TaskCard tests.
- Add a patch changeset for the published Fusion package.

Files changed:
 .../FN-7492-task-card-plan-review-progress.md      |  7 +++
 packages/dashboard/app/components/TaskCard.tsx     |  7 ++-
 .../app/components/__tests__/TaskCard.test.tsx     | 73 ++++++++++++++++++++++
 3 files changed, 86 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-7492

Fusion-Task-Lineage: 582aea40-8a14-4571-9a7c-e770bc2ab1fb

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:19 -07:00
gsxdsm
82493e0f62 FN-7488: allow source-free task artifacts to complete
Teach fn_task_done to honor explicit source-free task-artifact contracts without weakening ordinary commit requirements.

- Detect PROMPT-declared gitignored .fusion/tasks-only delivery contracts after completed steps.
- Keep zero-commit refusals for mixed tracked source, docs, config, test, or changeset scope.
- Document the completion contract in executor guidance and architecture notes.
- Add regression coverage for allowed source-free artifacts and refused mixed-scope deliveries.
- Add a patch changeset for the published CLI package.

Files changed:
 .changeset/fn-7488-source-free-completion.md       |   7 ++
 docs/architecture.md                               |   2 +-
 packages/core/src/agent-prompts.ts                 |   6 ++
 .../__tests__/executor-task-done-invariant.test.ts | 120 +++++++++++++++++++++
 packages/engine/src/executor.ts                    |  61 ++++++++---
 5 files changed, 183 insertions(+), 13 deletions(-)

Fusion-Task-Id: FN-7488
Fusion-Task-Lineage: adbf1146-4513-4531-bdd8-ccecbeb42a63
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-04 10:42:19 -07:00