CLI prompt nodes now accept a raw cliCommand (any command + args), not just
named scripts. A raw command must be explicitly approved by the user before it
runs: an unapproved command pauses the task (status awaiting-cli-approval) with
the command shown; the user approves via POST /tasks/:id/workflow/approve-cli,
which records the exact command string in settings.approvedWorkflowCliCommands
and resumes. Named scripts (settings.scripts) still never require approval.
Adds POST /tasks/:id/workflow/input to answer await-input nodes (records a
steering comment + resumes).
Two compounding bugs made the memory-pressure vitest auto-kill a
30-second SIGKILL sweep of anything mentioning vitest:
1. False pressure: getAvailableMemory probed os.availableMemory, which
does not exist, and silently fell back to os.freemem() — on macOS
that reads ~99% used on an idle 256GB machine, permanently above the
90% threshold. Now reads process.availableMemory() (Node 22+) and
refuses to auto-kill when only the unreliable freemem fallback is
available.
2. Overbroad targeting: pgrep -f vitest matches full command lines, so
the sweep also killed wrapper shells (zsh -c '... npx vitest run'),
monitor loops, and anything else whose argv mentions vitest —
stranding exit handlers and taking out unrelated process trees.
New shared findVitestProcessIds (@fusion/core) filters matches to
actual node executables.
Surface enumeration (all vitest-process kill/count surfaces):
- TUI memory-pressure auto-kill (controller.killVitestProcesses)
- TUI manual kill-vitest command (same method)
- dashboard POST /api/kill-vitest
- dashboard GET /api/system-stats vitestProcessCount (display)
All four now route through findVitestProcessIds.
- liveness: graph-routed tasks count as executing in getExecutingTaskIds/
isTaskActive and are skipped by recoverCompletedTask + the completed-task
resume fast-path — recovery can no longer drive a parallel lifecycle (P0)
- handleGraphFailure: sets status 'failed' (self-healing revival exemption,
prevents FN-5704-style re-run loop) and leaves paused tasks untouched
- execute seam distinguishes pause/abort from implementation failure
- merge seam: 30-minute timeout so a wedged queue cannot strand the run
- awaitAbortInFlightTaskWork: defensive interceptor/routing cleanup
- deleteWorkflowDefinition: cascades to selections, materialized steps,
affected tasks' enabledWorkflowSteps, and the project default
Expose operational log retention as a project setting in the dashboard.
- add an Operational log retention selector to the Project General settings section with supported retention options
- validate operationalLogRetentionDays in the settings API and cover accepted and rejected values in tests
- document the constrained retention values and assert project-scope/default parity for the setting
Files changed:
docs/settings-reference.md | 2 +-
packages/core/src/__tests__/settings-parity.test.ts | 7 ++++
packages/dashboard/app/components/SettingsModal.tsx | 47 ++++++++++------------
packages/dashboard/app/components/__tests__/SettingsModal.test.tsx | 8 ++++
packages/dashboard/src/__tests__/routes-settings.test.ts | 21 ++++++++++
packages/dashboard/src/routes/register-settings-memory-routes.ts | 10 +++++
6 files changed, 69 insertions(+), 26 deletions(-)
Fusion-Task-Id: FN-5939
Fusion-Task-Lineage: 2148dd88-1cef-4c6d-9696-31148fce97d3
Resolves the remaining review threads:
- Reset to auto-detect across all three layers (Greptile): store passes
language:null through as null-as-delete; dashboard gains an Auto option
(clearLanguage + hasExplicitChoice in useLanguage, re-detects from
navigator, syncs cross-tab); CLI accepts 'fn settings set language auto'.
Catalog keys added for all five locales; tests at every layer.
- CLI i18n test singleton: afterEach locale restore so zh-CN/fr switches
can't leak across cases (CodeRabbit nitpick)
- useLocaleFormat memoized per locale for stable formatter identities
(CodeRabbit nitpick)
- settings-reference.md documents the auto reset path
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Review residuals #5/#7/#8/#11/#12 + #3 wiring: forward the configured GitHub
token to the abandon route's client; guard abandon against finalized/merged
groups; reconcile an open group PR's state from GitHub on single-group reads
(merged out-of-band now flips prState); add fn branch-group abandon for
agent-native parity; block branchName shell injection (execFile argv push +
core-side branch-name validation at group creation); and collapse the
branch-groups list N+1 to a single task fetch via a shared
filterTasksByBranchGroup helper.
Engine half: real-git E2E covering planning- and mission-sourced groups —
members land on the group branch (never main/sibling), completion-gated single
PR via injected callback, re-promote idempotency, sync on later landing,
abandon→closed, and a self-healing finalize mid-flow staying group-anchored.
Core half: real triageFeature stamps the BG- id, member enumeration, and the
canonical completion gate flipping on landing.
Tasks with autoMerge explicitly enabled never auto-merged when the
project-level setting was disabled: the merge enqueue gate
(allowInReviewMergeProcessing) and all 19 in-review self-healing sweeps
checked only settings.autoMerge, and the board stall-signal hydration
passed the raw global into the diagnostic gates.
Introduce allowsAutoMergeProcessing(task, settings) in core — additive
relative to the global setting so configs with global auto-merge ON are
unchanged (explicit autoMerge:false tasks still flow to the merger's
manual-required parking) — and use it at the enqueue gate, every
self-healing sweep, and the store's stall/stalled signal contexts.
- selectTaskWorkflow: compile once, materialize the new steps and repoint the
task before deleting prior rows, so a mid-flight failure never leaves the
task referencing deleted step ids
- createTaskWithReservedId: inherit the project default workflow like
createTask (imports/reserved-id creations were skipping it)
- setDefaultWorkflowId: use null (updateSettings' delete sentinel) to clear
- parseWorkflowLayout: reject JSON arrays
- editor inspector: gate-mode default display now matches the compiler
(script/gate block by default, prompt is advisory)
Consolidate the duplicated step-materialization loop; validate by compiling
before any mutation so a non-linear graph still aborts with nothing written.
Add WorkflowSelector: a per-task picker in the task detail workflow tab that
applies a workflow (selection returns the resulting enabledWorkflowSteps so the
controlled steps list refreshes in place), and a ProjectDefaultWorkflowField in
Project General settings for the default new tasks inherit.
Selecting a workflow compiles it, materializes WorkflowStep rows (tagged and
hidden from the step manager), and writes their ids into the task's existing
enabledWorkflowSteps — the executor's read path is untouched. Re-selection
replaces prior steps with no orphans; non-linear graphs abort before any write.
New tasks inherit a project default workflow (settings.defaultWorkflowId) ahead
of legacy default-on steps. Adds task_workflow_selection table (migration 104).
No scheduler/executor/merger changes.
Add compileWorkflowToSteps + validateLinearity: walk the linear main path of a
WorkflowIr, emit prompt/script/gate user nodes as ordered WorkflowStep inputs,
skip the execute/review seams, and use the merge seam as the pre-/post-merge
boundary. Non-linear graphs (branching beyond canonical seam success/failure)
throw WorkflowCompileError so they route to the deferred interpreter instead of
mis-executing.
Route and coordinator disagreed on landed/complete: the route required
mergeConfirmed + matching mergeTargetBranch, the coordinator accepted bare
column===done/in-review and never checked the branch. Extract canonical
isBranchGroupMemberLanded/isBranchGroupComplete in @fusion/core (stricter
route semantics win — load-bearing for merge-target safety) and consume from
both sides. Tightens promotion gating to fire only when all members are
merge-confirmed onto the group branch.
Add a workflows table (migration 103) storing WorkflowIr graphs plus editor
layout, with CRUD on TaskStore (create/list/get/update/delete) that validates
the IR via parseWorkflowIr on write. IDs (WF-001…) use a monotonic __meta
counter that never reuses across deletes.
Planning and mission entry points discarded the BranchGroup returned by
ensureBranchGroupForSource and stamped a synthetic planning:/mission: string
that never resolved against getBranchGroup, breaking member enumeration.
Capture and stamp the real BG- id; stop setTaskBranchGroup hardcoding
assignmentMode; add a removable legacy read-side shim. Export TaskBranchContext.
- Validate GlobalSettings.language at the write boundary (store.ts) via
validateLocale, so invalid locales are dropped not persisted (api-contract P1).
- Fix detectEnvLocale: Traditional-script env tags (zh_Hant/zh_Hant_TW/zh_HK/
zh_MO) now resolve to zh-TW instead of Simplified; use replaceAll for
multi-underscore POSIX tags (adversarial P2). Add coverage.
- Agent-native parity: add 'language' to the CLI settings allowlist
(VALID_SETTINGS + GLOBAL_ONLY + enum) so 'fn settings set language' works
like the dashboard switcher.
- Document --lang in the bin.ts help table (api-contract P3).
- Derive the expected locale-chunk count from the locales dir instead of a
hardcoded 5 (maintainability), and add prebuild:client so a raw vite build
on a fresh clone still syncs catalogs (adversarial P2).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
branch_groups.branchName is globally UNIQUE, but ensureBranchGroupForSource
only looked up an existing group by (sourceType, sourceId). When a second
mission's shared-branch triage resolved to a base branch (e.g. "main") that
another mission already owned a group for, createBranchGroup threw
"UNIQUE constraint failed: branch_groups.branchName". That error escaped
triageFeature and was swallowed by both callers (validation-failure
auto-triage and the reconcile sweep), leaving the mission's "defined"
features — including generated fix features — permanently un-triaged.
ensureBranchGroupForSource now reuses an existing open group for the same
branch name before attempting to create one, matching the established
getBranchGroupByBranchName(...) ?? ensureBranchGroupForSource(...) idiom.
Confirmed by reproducing against a snapshot of the affected mission DB:
triageFeature threw the UNIQUE error before, succeeds after.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add SUPPORTED_LOCALES (en, zh-CN, zh-TW, fr, es), Locale, DEFAULT_LOCALE,
isLocale, and validateLocale to @fusion/core, plus an optional
GlobalSettings.language field registered in the schema defaults and keys.
Locale primitives live in types.ts so the dashboard's @fusion/core->types.ts
Vite alias can reach them. language defaults to undefined (resolve-at-runtime).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replaces polling-only with a true server-push seam (any plugin benefits):
- core: createRouteContext accepts an emitEvent override (default still logs)
- dashboard: emitPluginCustomSseEvent forwards a plugin's ctx.emitEvent calls to
connected /api/events clients as a project-scoped 'plugin:custom' event; the
plugin route context's emitEvent is wired to it
- dashboard: PluginDashboardViewContext gains subscribePluginEvents so views
consume push via a host capability (no raw EventSource, no deep app import)
- CE view subscribes its session to push and refetches on each event; polling
stays as the fallback when push isn't wired or an event is missed
Also: skill-reachability test installs into a temp dir (no repo-dir writes).
Tests: dashboard sse +2 (plugin:custom relay + project scoping), plugin 99.
Closes the U2/U5 skill-discovery carry-forward so the plugin's interactive ce-*
sessions actually load the stage's bundled skill in a live agent (not just in
scripted-fake tests).
Root cause: createFnAgent built its DefaultResourceLoader without forwarding any
skill-discovery path, and the interactive seam options couldn't carry one. The
loader's skillsOverride only *filters* skills already discovered from cwd's
standard roots, so the plugin-local .fusion-ce-skills/<id>/SKILL.md was never
discoverable.
Fix (end-to-end):
- AgentOptions.additionalSkillPaths forwarded into DefaultResourceLoader
- CreateInteractiveAiSessionOptions gains requestedSkillNames + additionalSkillPaths
- the interactive engine adapter forwards them to createFnAgent (skills +
additionalSkillPaths)
- the orchestrator runs the session with cwd on the real project root and hands
it [stage.skillId] + the install root
Proven: a real DefaultResourceLoader with additionalSkillPaths discovers ce-plan
and filters out ce-work; the orchestrator passes the right id/path/cwd. Plugin 96,
engine 136, core 99 tests green.
Expose createInteractiveAiSession on route/loader PluginContext alongside the
one-shot createAiSession. The prompt->parse->retry->pause->resume loop is
reimplemented in an engine seam modeled on planning.ts (no engine await-input
primitive exists). Reuses PlanningQuestion/PlanningResponse; stays generic with
no plugin-specific concepts. Injected on route contexts only; tool/runtime
contexts omit it (parity with createAiSession).
Resolve goal tool lookups to the canonical project store from Fusion worktree directories.
- recognize both legacy .worktrees and .fusion/worktrees paths when resolving the project root for pi extensions
- add CLI coverage proving fn_goal_list and fn_goal_show return dashboard-created goals from a Fusion worktree cwd
- extend core worktree-resolution tests and keep the branch conflict recovery test worktree path isolated in tmpdir
- add a patch changeset for the published CLI fix
Files changed:
.changeset/fn-5851-goal-store-resolution.md | 5 +
packages/cli/src/__tests__/goal-store-resolution.test.ts | 104 +++++++++++++++++++++
packages/core/src/__tests__/pi-extensions.test.ts | 14 ++-
packages/core/src/pi-extensions.ts | 12 ++-
packages/engine/src/__tests__/branch-conflicts-recovery.test.ts | 2 +-
5 files changed, 130 insertions(+), 7 deletions(-)
Fusion-Task-Id: FN-5851
Fusion-Task-Lineage: ec4c8239-b953-4df7-9f72-02e17e4b0851
Whether `sqlite3 .recover` can rebuild a given byte-level corruption is
build-dependent — CI's sqlite3 returned "failed" (the safe outcome: leave
the corrupt original untouched rather than swap in an unverified rebuild)
where the local build returned "recovered". Assert the contract for whichever
branch is taken instead of hard-requiring "recovered".
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Root cause: node:sqlite SIGSEGVs inside pager_write leave the B-tree
malformed in a way that still opens but fails integrity checks; large
operational-log tables widen the write window where the crash strikes.
- backup: verify every copy with PRAGMA quick_check, quarantine corrupt
copies as *.corrupt, and never rotate out the last verified-good backup
- db: add Database.recoverIfCorrupt() startup guard (wired into
TaskStore.init, disk-backed only, opt out via FUSION_DISABLE_DB_AUTORECOVER)
that rebuilds a malformed db via sqlite3 .recover, preserving the corrupt
original; also fixes the latent `.recover main` invalid-option bug that made
recoverDatabase() always fail
- db: drop lost_and_found* scratch tables on init; add pruneOperationalLogs()
- settings: add operationalLogRetentionDays (default 30, 0 = off) and prune
activityLog/agentLogEntries/runAuditEvents/agentHeartbeats during maintenance
- dashboard: expose retention in Settings -> Backups -> Database Maintenance
Tests: backup 59/59, db 135/135 (incl. real corrupt->recover->reopen),
self-healing cleanup/corruption 10/10, settings 77/77, SettingsModal 460/460.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tighten test fixture cleanup so temporary test directories are reliably removed.
- track created test project directories and install process exit/beforeExit backstop cleanup hooks
- make destroyTestProject resilient with async rm plus rmSync fallback and tracked-dir removal
- add regression tests for sqlite wal/shm sibling cleanup and tracked-directory drain behavior
- make db lock-child teardown remove children from tracking during iteration
Files changed:
packages/core/src/__tests__/db.test.ts | 10 +++--
packages/core/src/__tests__/test-project.test.ts | 34 ++++++++++++++-
packages/core/src/__tests__/test-project.ts | 54 +++++++++++++++++++++++-
3 files changed, 92 insertions(+), 6 deletions(-)
Fusion-Task-Id: FN-5840
Fusion-Task-Lineage: 0977be1d-8334-413d-a652-318584d7058b
Add a new interactive onboarding CLI flow that guides first-time setup end to end.
- add new `fn onboard` command wiring in CLI entrypoint and usage help
- implement `runOnboard()` with sequential prompts for central DB, provider auth, init, test mode, and project maxConcurrent
- persist `cliOnboardingCompletedAt` marker in global settings with `--force` rerun support
- add onboarding command tests and global settings regression coverage
- document `fn onboard` usage and options in CLI reference
- add a minor changeset for published `@runfusion/fusion`
Files changed:
.changeset/fn-5805-onboard-command.md | 5 +
docs/cli-reference.md | 20 ++
packages/cli/src/bin.ts | 10 +
packages/cli/src/commands/__tests__/onboard.test.ts| 193 ++++++++++++++++
packages/cli/src/commands/onboard.ts | 249 +++++++++++++++++++++
packages/core/src/__tests__/global-settings.test.ts| 11 +
packages/core/src/index.ts | 2 +-
packages/core/src/settings-schema.ts | 1 +
packages/core/src/types.ts | 4 +
9 files changed, 494 insertions(+), 1 deletion(-)
Fusion-Task-Id: FN-5805
Fusion-Task-Lineage: b1bcaf27-9bd7-4569-b685-225a97fa1200