Commit Graph

1095 Commits

Author SHA1 Message Date
gsxdsm
3ee47dec86 merge: integrate origin/main into feature/workflow-steps (FN-7039)
Resolve conflicts from 56 upstream commits:
- db.ts: renumber my migrations around main's new migration 130 (columnDwellMs) —
  enable-id normalization 130→131, drop-table 131→132, SCHEMA_VERSION→132.
- index.ts / routes.ts: take main's new MCP exports/imports; keep WORKFLOW_STEP_TEMPLATES
  array removed (kept the WorkflowStepTemplate type).
- merger.ts: keep the legacy post-merge execution path removed (U7c) over main's version.
- ci-workflow.test.ts (from main): add port-4040/process-supervisor allowlist markers to
  the gate-script assertions that reference the checker filenames (pre-existing self-match).

Gate green (engine-core 299, ci-shape 62); boot smoke PASS; migration tests + typecheck clean.
2026-06-26 08:50:22 -07:00
gsxdsm
7d13f880ba FN-7059: pin merge gate composition
Add CI-shape coverage that guards the trusted merge gate composition.\n\n- Load root and engine package scripts plus the engine vitest config in the CI workflow test.\n- Assert test:gate includes the audited guard scripts, engine core suite, and CLI CI-shape suite.\n- Assert engine test:core continues targeting the engine-core vitest project.\n\nFiles changed:\n packages/cli/src/__tests__/ci-workflow.test.ts | 26 ++++++++++++++++++++++++++\n 1 file changed, 26 insertions(+)

Fusion-Task-Id: FN-7059

Fusion-Task-Lineage: 47af7fdd-a812-4d03-960a-a6300d86b59e
2026-06-26 06:47:27 -07:00
gsxdsm
429143ecf0 FN-7024: add MCP server management CLI
Add CLI support for managing MCP server configuration without exposing secret values.

- Add fn mcp list/add/edit/remove/enable/disable/import/export/validate subcommands.
- Store MCP env and header values as Fusion secret references, including Claude Desktop import conversion.
- Document MCP CLI usage and add command coverage for scoped configuration, import, export, and validation.
- Add a minor changeset for the published CLI feature.

Files changed:
 .changeset/fn-7024-mcp-cli.md                   |   7 +
 docs/cli-reference.md                           |  49 +++
 packages/cli/src/bin.ts                         | 124 +++++++
 packages/cli/src/commands/__tests__/mcp.test.ts | 182 ++++++++++
 packages/cli/src/commands/mcp.ts                | 455 ++++++++++++++++++++++++
 5 files changed, 817 insertions(+)

Fusion-Task-Id: FN-7024

Fusion-Task-Lineage: e3d98bfa-b883-4b9e-86d5-f0416808d6f2
2026-06-25 23:34:07 -07:00
gsxdsm
4a4e389254 FN-7032: add signed Android release artifacts
Add secret-gated signed Android release packaging while preserving the unsigned fallback.

- Build signed Android release APK and AAB artifacts when keystore secrets are configured.
- Verify signed APKs, generate checksums for APK/AAB outputs, and include AABs in release aggregation.
- Document Android signing secrets, sideload verification, fallback artifacts, and Play upload scope.
- Cover the release and rehearsal workflow wiring with CLI and desktop workflow tests.

Files changed:
 .github/workflows/release.yml                      | 94 ++++++++++++++++++----
 .github/workflows/test-release.yml                 | 94 ++++++++++++++++++----
 MOBILE.md                                          | 18 ++++-
 RELEASING.md                                       | 34 ++++++--
 packages/cli/src/__tests__/ci-workflow.test.ts     | 24 ++++++
 packages/desktop/README.md                         |  2 +-
 .../desktop/src/__tests__/release-workflow.test.ts | 24 +++++-
 7 files changed, 251 insertions(+), 39 deletions(-)

Fusion-Task-Id: FN-7032
Fusion-Task-Lineage: 0334c026-384e-4531-a2b2-f8a0b5bb7ff0
2026-06-25 20:20:33 -07:00
gsxdsm
dba65933e5 FN-7014: publish Android APK release artifacts
Adds Android APK generation to binary release and rehearsal workflows so GitHub releases ship mobile assets.

- Add Android build jobs that sync Capacitor, assemble the debug APK, and upload APK/checksum artifacts.
- Include Android artifacts in release and test-release collection dependencies and file matching.
- Document Android release outputs and extend workflow shape tests for the new asset path.

Files changed:
 .github/workflows/release.yml                      | 86 +++++++++++++++++++++-
 .github/workflows/test-release.yml                 | 85 ++++++++++++++++++++-
 MOBILE.md                                          |  2 +-
 RELEASING.md                                       | 10 ++-
 packages/cli/src/__tests__/ci-workflow.test.ts     |  6 +-
 packages/desktop/README.md                         |  1 +
 .../desktop/src/__tests__/release-workflow.test.ts | 24 +++++-
 7 files changed, 201 insertions(+), 13 deletions(-)

Fusion-Task-Id: FN-7014
Fusion-Task-Lineage: 8ed94f64-399b-433f-add4-0294fc5722d1
2026-06-25 19:35:05 -07:00
gsxdsm
7b46d78c73 fix: align tests with recent source changes on main (#1754)
## Summary

Fixes 6 failing tests on `origin/main` caused by recent feature commits
that landed without updating dependent test assertions. No production
behavior is changed — every fix aligns a test (or build output) with an
intentional source change.

## Changes

| # | Test | Root Cause | Fix |
|---|------|-----------|-----|
| 1 | `packages/core` `test-project.test.ts` | Commit `800f845e1`
changed `DEFAULT_PROJECT_SETTINGS.taskPrefix` from `"FN"` to `undefined`
(prefix now derived from project name at runtime) | Updated assertion to
expect `undefined` |
| 2 | `packages/dashboard` `text-token-canonicalization.test.ts` |
`ScriptsModal.css` used banned `--text-primary` token | Replaced with
canonical `--text` token |
| 3 | `packages/cli` `package-config.test.ts` | Pi runtime deps bumped
from `^0.79.1` to `^0.79.9` | Updated expected version |
| 4 | `packages/cli` `skill-sync.test.ts` | 4 engine tools added but not
documented | Added to `engine-tools.md` |
| 5 | `packages/cli` `version.test.ts` | `release:version` script gained
`run-ci-distill.mjs` | Updated expected script |
| 6 | `packages/cli` `bundled-plugin-freshness.test.ts` | 3 plugins had
stale dist | Rebuilt via `pnpm build` |

## Verification

- `pnpm test:gate` passes (313 core + 58 ci-shape tests)
- `pnpm lint` clean
- All 6 previously-failing tests now pass individually
- Runtime invariant preserved: tasks in fresh projects still get
`FN-NNN` IDs (covered by existing test at `test-project.test.ts:89`)


<!-- stage-review-badge-begin -->

---

<a href="https://stagereview.app/Runfusion/Fusion/pull/1754">
  <picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://stagereview.app/assets/gh-open-in-stage-dark.svg">
<img src="https://stagereview.app/assets/gh-open-in-stage-light.svg"
alt="Open in Stage">
  </picture>
</a>

<!-- stage-review-badge-end -->
2026-06-25 08:27:41 -07:00
gsxdsm
bc56ab287e fix: align tests with recent source changes on main
Fix 6 failing tests caused by intentional source changes that landed
without updating dependent test assertions:

- Core test-project: taskPrefix default changed from "FN" to undefined
  (commit 800f845e1, derived from project name at runtime)
- Dashboard ScriptsModal.css: replace banned --text-primary with --text
- CLI package-config: update expected pi dep version ^0.79.1 -> ^0.79.9
- CLI skill-sync: document 4 new engine tools in engine-tools.md
- CLI version: update expected release:version script to include
  run-ci-distill.mjs
- CLI bundled-plugin-freshness: rebuild stale dist directories
2026-06-25 00:13:29 -07:00
gsxdsm
079c428af9 chore(release): v0.48.0
Version bump via changesets.
2026-06-24 23:56:23 -07:00
gsxdsm
f9816799a0 FN-7000: test unified CLI merge entrypoints
Strengthen CLI merge tests around the unified runAiMerge path.\n\n- Mock runAiMerge separately from deprecated aiMergeTask in CLI task and dashboard tests.\n- Assert task merge uses runAiMerge without falling back to workspace landing or aiMergeTask.\n- Verify dashboard manual merge logging streams through runAiMerge and restores spies safely.\n\nFiles changed:\n .../cli/src/commands/__tests__/dashboard.test.ts   | 51 +++++++++++++---------\n packages/cli/src/commands/__tests__/task.test.ts   | 30 +++++++++----\n 2 files changed, 52 insertions(+), 29 deletions(-)

Fusion-Task-Id: FN-7000

Fusion-Task-Lineage: 96080841-c813-4a9e-97bd-a41aba60089f
2026-06-24 23:32:52 -07:00
gsxdsm
3ae053e744 FN-6976: keep planning JSON failures retryable
Persist malformed Planning Mode AI responses as retryable errors while improving JSON response selection.

- Preserve failed initial-turn planning sessions with actionable retry errors instead of deleting them.
- Prefer valid planning-shaped JSON candidates over unrelated embedded JSON blobs.
- Cover streaming, non-streaming, retry recovery, and AI merge test mock compatibility.
- Add a patch changeset for the published CLI package.

Files changed:
 .changeset/fn-6976-planning-json-recovery.md       |   7 +
 .../cli/src/commands/__tests__/dashboard.test.ts   |   1 +
 packages/cli/src/commands/__tests__/task.test.ts   |   9 +-
 .../src/__tests__/session-error-recovery.test.ts   | 144 +++++++++++++++++++++
 packages/dashboard/src/planning.ts                 | 123 ++++++++++--------
 5 files changed, 229 insertions(+), 55 deletions(-)

Fusion-Task-Id: FN-6976

Fusion-Task-Lineage: e1cb59cb-1d7d-4aff-b17f-9633568f823f
2026-06-24 23:32:52 -07:00
gsxdsm
2ba81c25b4 chore(release): v0.47.0
Version bump via changesets.
2026-06-24 19:32:59 -07:00
gsxdsm
b680948d8c Address PR review feedback (#1746)
- Fix race condition: add request ID guard for stale workspace detection responses
- Guard workspaceMode:true: only persist when repos.length > 0
- Add server-side taskPrefix validation (/^[A-Z]{1,5}$/)
- Move store.init() inside try/finally in both CLI TaskStore lifecycles
- Accept 1-character prefixes in CLI prompt (was requiring >= 2)
- Fix workspaceMode passing: forward false explicitly (was coerced to undefined)
- Fix 3rd KB→FN fallback in distributed-task-id.ts catch block
- Add try/finally to dashboard TaskStore in register-project-routes
- Gate workspace detection on existing-directory mode only (skip clone mode)
2026-06-24 14:24:07 -07:00
gsxdsm
46d0c4a1f6 Address PR review feedback round 3 (#1741)
- Align dashboard prefix validation to 1-5 chars (was 1-10) matching CLI cap
- Fix distributed-task-id.ts fallback from KB to FN (3 occurrences)
- Move taskPrefix/defaultWorkflowId persistence outside interactive-only block
  so non-interactive CLI registration also gets defaults
- Wrap both TaskStore lifecycles in try/finally to guarantee close() on error
2026-06-24 14:08:32 -07:00
gsxdsm
b317a39d80 Cap interactive prefix input to 5 chars (#1741) 2026-06-24 11:39:40 -07:00
gsxdsm
06adc190ce Add max-length cap (10) to interactive prefix input (#1741)
CodeRabbit: suggestTaskPrefix caps at 4 chars, but user input was uncapped.
Align with the dashboard validation regex (1-10 uppercase letters).
2026-06-24 11:34:38 -07:00
gsxdsm
aae76cecc3 Address PR review feedback (#1741)
- Close first TaskStore before creating second in interactive registration (P1)
- Revert defaultWorkflowId default to undefined; set explicitly in onboarding only (P1)
- Add alpha-only filter + 2-char min to interactive prefix input (P2)
- Move suggestTaskPrefix to @fusion/core, share between CLI and dashboard (P2)
- Fix suggestTaskPrefix JSDoc to match implementation (P2)
2026-06-24 10:45:21 -07:00
gsxdsm
800f845e15 feat(workspace): fix auto-detection, derive prefix from name, default coding workflow
- Fix workspace detection: change workspaceMode default from false to
  undefined so isWorkspaceModeExplicitlyDisabled no longer blocks
  auto-detection on fresh projects (config.json was being written with
  workspaceMode:false during store.init(), causing the guard to skip
  detection before it ever ran)
- Derive task prefix from project name (first 2-4 chars) instead of
  hardcoded 'FN' as the suggested default
- Default workflow is now builtin:coding instead of undefined
- CLI registerProjectInteractive: onboarding prompt for task prefix
  confirmation after project name
- Dashboard POST /api/projects: auto-derive prefix and set default
  workflow for new registrations
2026-06-24 10:31:06 -07:00
gsxdsm
9aaf911735 feat(workspace): add per-project workspaceMode setting with interactive confirmation
Add workspaceMode as a first-class ProjectSettings boolean that controls
whether the project root is treated as a workspace parent (multi-repo)
or a single git repo.

- ProjectSettings type + DEFAULT_PROJECT_SETTINGS: workspaceMode?: boolean
- CLI registerProjectInteractive: when sub-repos are detected, ask the
  user to confirm workspace mode instead of auto-applying
- TaskStore.updateSettings: when workspaceMode is toggled on, detect
  sub-repos and persist workspace.json; when toggled off, remove it
- Dashboard SettingsModal GeneralSection: workspace mode toggle checkbox

This lets users change workspace mode per-project at any time via the
dashboard Settings or PUT /settings API.
2026-06-24 00:45:24 -07:00
gsxdsm
0dea25061d Merge remote-tracking branch 'origin/main' into conflict-resolution-1717
# Conflicts:
#	packages/engine/src/__tests__/executor-recovery.test.ts
#	packages/engine/src/agent-tools.ts
#	packages/engine/src/executor.ts
#	packages/engine/src/merger-ai.ts
#	packages/engine/src/project-engine.ts
#	packages/engine/src/worktree-acquisition.ts
2026-06-23 16:12:10 -07:00
gsxdsm
905a877954 Merge pull request #1710 from MichaelHoughtonDeBox/feat/workspace-multi-repo
Workspace mode: open a folder of git repos as one project (foundation + design Q)
2026-06-23 15:08:15 -07:00
gsxdsm
bac7049822 chore(release): v0.46.0
Version bump via changesets.
2026-06-23 12:27:50 -07:00
gsxdsm
4704e58ed8 fix(cli): drain TUI performance entries 2026-06-23 12:10:40 -07:00
gsxdsm
b599b6ab41 chore(release): v0.45.0
Version bump via changesets.
2026-06-23 01:07:59 -07:00
gsxdsm
3a71237624 fix(review): address PR #1717 Phase C merge-loop review feedback
- merger-ai: resolve+persist concrete landedSha when a sub-repo is recognized
  already-landed via the Fusion-Task-Id trailer fallback, so finalize no longer
  drops it and mis-finalizes a fully-landed workspace task as a no-op
- project-engine: manual-merge land-lease busy errors reject the resolver without
  burning mergeRetries; clear stale busy-reenqueue counter on real partial land;
  persist retry count before arming the backoff timer (fail closed on write error)
- cli/dashboard + task: use shared isWorkspaceTask predicate instead of inlining
- base-commit-capture: POSIX single-quote shell escaping for integration ref
- git-repository: validate workspace.json repos elements are strings
- merger-ai: drop dead store param from landOneRepo
- tests: assert the 60s backoff cap across cycles; exercise the real runAiMerge
  merge door; fix non-git-root assertion; re-export real workspace error classes
  in the merger-ai mock (fixes 24 pre-existing instanceof-undefined failures);
  remove generic fake-timer smoke test now covered by the live engine assertion

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 03:04:21 -07:00
gsxdsm
627bdcfb0a fix(review): Phase C merge-loop hardening — double-land, lease clobber, retry storm
5-persona review of the Phase-C per-repo merge loop. No P0; the no-push invariant
and retry/park accounting verified clean. Fixed:

Land mechanics (merger-ai.ts / active-session-registry.ts):
- persistRepoLandedSha no longer swallows the DB write: a failed landedSha write
  after the ref advanced now escalates to WorkspacePartialLandError so the engine
  parks/retries instead of silently re-landing (duplicate squash). isRepoLanded
  gains a landedSha-independent fallback — it scans the integration ref for this
  task's Fusion-Task-Id trailer (a squash commit is NOT a branch descendant, so a
  branch-ancestor check is provably wrong), so an actually-landed repo is skipped
  on retry.
- The land lease is now taskId-aware across kinds: any foreign-task holder on a
  sub-repo path is contention (a merging task can't run over an executing task's
  acquire lease), and registerPath throws ActiveSessionPathHeldByForeignTaskError
  instead of silently clobbering a different task's entry.
- The per-repo loop is wrapped in try/finally(setStatus(null)) so the busy/partial
  throws can't leave the task stuck 'merging'. WorkspacePartialLandError is a real
  exported class (not a .name-mutated Error). finalizeWorkspaceTask re-reads fresh
  and no longer swallows the mergeDetails write (TOCTOU). isRepoLanded exported for
  Phase D.

Dispatch + doors (project-engine.ts / dashboard.ts / task.ts / @fusion/core):
- getTask-null in the partial-land catch fails closed (park) instead of defaulting
  retries to 0 and scheduling an indefinite retry storm.
- The merge-confirmed reachability fast-path skips workspace tasks (its
  representative commitSha is a sub-repo squash sha, unreachable in the root cwd —
  it was demoting fully-merged tasks); they're verified by per-repo landedSha.
- The CLI/dashboard merge doors now return merged:true on full land (were hardcoded
  merged:false). WorkspaceRepoLandBusyError re-enqueues with backoff WITHOUT burning
  the mergeRetries quota (bounded busy counter) so contention can't park a healthy
  task. Backoff capped at 60s. shouldRetryWorkspacePartialLand folded into
  shouldRetryAutoMergeConflict. Catch switched to instanceof. New canonical
  isWorkspaceTask predicate in @fusion/core.

Gate green: build, typecheck, lint, test:gate (649+58); workspace-merger + oracle
+ project-engine 174.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 01:11:52 -07:00
gsxdsm
429258354d fix(workspace): address CodeRabbit review findings on the foundation
Resolves the actionable CodeRabbit threads on the workspace-mode foundation:

- project-resolver: defer saveWorkspaceConfig until after the user confirms init
  and store.init() succeeds (no partial .fusion/ on a declined/non-interactive run).
- git-repository: validate each candidate with a real `git rev-parse` work-tree
  probe before counting it (no false-positive repos from stray .git markers);
  loadWorkspaceConfig now rejects absolute paths, `..` escapes, and non-string
  entries so a corrupt/malicious config can't resolve outside the workspace root.
- executor: gate workspace mode on repos.length > 0 at all three sites so an
  empty { repos: [] } can't bypass the git-repo guard or enable an empty workspace.
- worktree-acquisition: thread the configured-command runner through the workspace
  acquire path (sub-repos run their init setup); validate repoRelPath as an in-root
  relative path before joining; liveness-check a remembered worktree before
  reporting it ready (pruned paths fall through to re-acquire); clear the singular
  task.worktree/branch after persisting per-repo state (per-repo state lives only
  in workspaceWorktrees).
- agent-tools: forward runContext into acquireWorkspaceRepoWorktree for log attribution.

The executor-workspace test's mock-the-subject pattern is left for the
session-scoping follow-up that rewrites it with a real two-repo fixture (FN-5048).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 00:09:59 -07:00
gsxdsm
5191e1f22d FN-6911: defer Droid CLI startup probes
Defer Droid CLI validation and discovery so startup no longer spawns or hangs on droid.

- Register the Droid provider without boot-time validation or model discovery side effects.
- Trigger CLI validation only when a Droid stream starts and expose explicit model discovery.
- Add regression coverage for non-interactive droid process spawning and startup probe behavior.
- Add a patch changeset for the published Fusion CLI package.

Files changed:
 .changeset/fn-6911-droid-cli-no-boot-spawn.md      |  5 ++
 .../commands/__tests__/droid-cli-extension.test.ts | 15 +++-
 packages/droid-cli/index.ts                        | 33 ++++----
 packages/droid-cli/src/__tests__/index.test.ts     | 90 +++++++++-------------
 .../src/__tests__/discover-models.test.ts          |  7 +-
 .../src/__tests__/probe.test.ts                    |  8 ++
 .../src/__tests__/process-manager.test.ts          | 74 ++++++++++++++++++
 .../src/__tests__/startup-probes.test.ts           |  5 +-
 8 files changed, 160 insertions(+), 77 deletions(-)

Fusion-Task-Id: FN-6911

Fusion-Task-Lineage: ef4bc3df-bfe8-416a-b701-64f752faea30
2026-06-21 23:44:26 -07:00
gsxdsm
744ed098a5 feat(workspace): Phase C U1 — per-repo merge loop (landOneRepo + landWorkspaceTask)
Extracts the per-repo land mechanics out of runAiMerge's inline clean-room
closure into an exported landOneRepo(store, repoRootDir, branch, integrationBranch,
ctx): pre-merge prune (rooted at the sub-repo), the clean-room temp worktree,
mergeAndReview, landSquash, and the CAS concurrent-advance retry that advances ONE
local integration ref — no remote push. runAiMerge is rewired as the single-repo
caller (its task-global finalization unchanged); the merger-ai suite (56 tests)
stays green as the byte-for-byte oracle.

landWorkspaceTask loops a workspace task's acquired sub-repos (sorted keys),
re-resolving each repo's integration branch with the shared override stripped
({...settings, integrationBranch: undefined, baseBranch: undefined}) so each
sub-repo lands on its own origin/HEAD, calls landOneRepo per repo, and aggregates
repo-tagged results — land-as-you-go on each repo's LOCAL ref (D2/D5). It does NOT
finalize/move the task (finalize-once + landed-tracking + idempotent retry are U2).

Door routing (KTD2): the engine dispatch and the user-facing CLI `fn task merge`
+ dashboard merge doors route workspace tasks to landWorkspaceTask so manual merge
works; store.mergeTask, aiMergeTask, and the runAiMerge chokepoint guard keep
throwing WorkspaceTaskMergeError as defense-in-depth.

New two-repo fixture tests: both repos land + no-push assertion, per-repo
override-stripped resolution onto distinct branches, repo-B conflict partial land
(task not moved), defense-in-depth throws. Gate green: typecheck, lint, build,
test:gate (649+58).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 23:31:43 -07:00
gsxdsm
7240b77c67 fix(review): harden R7 workspace merge guard + deprecation warning (U0)
Applies ce-code-review (autofix) feedback — 5 reviewers, P1s corroborated.

F1 [P1, ×4 reviewers] Guard the merge chokepoint, not just the 4 doors. The
per-caller `getTask().catch(()=>null); if(t) assert` pattern failed open on a
transient read, and runAiMerge re-read the task unguarded — so a workspace
task could reach git work against the non-git root. Added a named
WorkspaceTaskMergeError and call assertNotWorkspaceTaskMerge inside runAiMerge
(the sole merge path) and the deprecated aiMergeTask body; door guards remain
as fast-fail defense-in-depth.

F2 [P1] The dispatch catch treated the guard throw as a merge failure and set
mergeRetries=MAX, permanently blocking manual retry. It now recognizes
WorkspaceTaskMergeError and parks without burning retries.

F3 [P2] Deprecation-warning test asserted toBeLessThanOrEqual(1) — vacuously
true on zero emissions. Now resets the per-project flag and asserts the
warning fires exactly once and not again on a second deterministic merge.

F6 [P2] The once-per-process warning flag suppressed the notice for all other
projects in a multi-project host; now keyed per project (Set by cwd).

F5/F7/F8 [P3] @deprecated propagated to the aiMergeTask barrel re-export; CLI
runTaskMerge guard moved inside the formatted try/catch; FNXC placeholder
timestamps corrected; test .at(-1) -> length index.

Documented as residual (deferred to master-plan U8, not bugs in U0's window):
self-healing auto-finalize + store.mergeTask are additional merge-completing
paths not hardened here — workspace tasks are not end-to-end runnable until
master-plan Phase A, and U8 makes self-healing workspace-aware.

Gate green: typecheck (29 projects), lint, build, test:gate (649+58),
affected tests (206+4).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 19:19:55 -07:00
gsxdsm
a6252e518d refactor(merger): unify on runAiMerge as the sole merge path (U0)
Make runAiMerge (the FN-5633 clean-room AI merge path, already the default)
the sole merge path; soft-deprecate the legacy aiMergeTask pipeline. Phase 0
of the workspace-mode master plan — a standalone merge-consolidation refactor
that lands first so downstream workspace work targets one merge function.

U1 — collapse the dispatch: project-engine.ts now calls runAiMerge
unconditionally; the two direct callers that bypassed the dispatch
(dashboard.ts onMergeImpl in --no-engine mode, task.ts runTaskMerge /
`fn task merge`) now route to runAiMerge too. Export runAiMerge from
@fusion/engine.

U2 — soft-deprecate: aiMergeTask is @deprecated (body retained for a later
deletion pass; shared helpers runAiMerge imports, e.g.
captureSingleCommitLandedMetadata, left intact). merger.mode "deterministic"
is annotated deprecated and made inert (type + field kept — published
@runfusion/fusion surface); the dispatch logs a one-time deprecation warning
and routes to runAiMerge. Changeset added (minor).

U3 — R7 workspace merge-boundary guard: shared @fusion/core predicate
assertNotWorkspaceTaskMerge(task) rejects tasks with populated
workspaceWorktrees at all four merge entry points (dispatch, store.mergeTask,
onMergeImpl, runTaskMerge) with an error naming master-plan U6. Covers the
window until per-repo merge support lands; U6 removes it.

U4 — deterministic-mode blast-radius audit: no production project, CI config,
or seeded setting pins merger.mode "deterministic"; only four engine tests
used it to drive the dispatch to aiMergeTask as a mockable seam — migrated to
mock runAiMerge instead. Other module-level aiMergeTask mocks were dead under
the default "ai" mode or test aiMergeTask directly (body retained), so they
are unaffected.

Also removes an unused acquireWorkspaceRepoWorktree import inherited from the
foundation branch (executor.ts) that was failing lint; master-plan U1 re-adds
it with its per-repo usage.

Merge gate green: lint, typecheck (29 projects), build, test:gate
(649 + 58), plus the migrated (114) and new predicate (4) tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 18:58:06 -07:00
MichaelHoughtonDeBox
8f4098e5b1 feat: add workspace mode foundation (multi-repo projects)
Allow registering a non-git parent directory that contains multiple git
repositories as a single Fusion project. The agent acquires per-repo
worktrees on demand via a new `fn_acquire_repo_worktree` tool as it
discovers it needs to work in each sub-repo.

This commit lays the foundation:
- detectWorkspaceRepos / loadWorkspaceConfig / saveWorkspaceConfig in
  @fusion/core (config persisted to .fusion/workspace.json)
- Task.workspaceWorktrees data model + store plumbing (per-repo
  worktree/branch map, distinct from the singular task.worktree)
- acquireWorkspaceRepoWorktree wraps acquireTaskWorktree per sub-repo,
  clearing the singular worktree/branch fields so each sub-repo gets a
  fresh worktree instead of resuming a sibling repo's worktree
- fn_acquire_repo_worktree agent tool + workspace prompt injection
- executor git-repository validation bypassed when a workspace config
  is present
- CLI `fn init` detects a non-git dir containing sub-repos and writes a
  workspace config

Known gap (intentionally left for design discussion, see PR): the
executor's main worktree-acquisition path still assumes a single git
root and is not yet workspace-aware. End-to-end execution (skipping the
root acquisition, per-repo merge, per-repo session scoping) is a
follow-on once the execution model is agreed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 22:04:37 +01:00
gsxdsm
d99246cb74 FN-6834: use OS-available memory for system metrics
Use shared OS-available memory readings so macOS cache/inactive pages are not counted as used.

- Add a core available-memory helper that prefers `process.availableMemory()` and flags `freemem` fallback reliability.
- Route core metrics, dashboard system stats, and the dashboard TUI through the shared helper.
- Move and expand memory tests across core, dashboard routes, and verification coverage while documenting the telemetry behavior.
- Add a patch changeset for the published CLI package.

Files changed:
 .changeset/fix-macos-memory-used.md                |  5 ++
 docs/architecture.md                               |  2 +-
 docs/dashboard-guide.md                            |  2 +-
 .../__tests__/available-memory.test.ts             | 54 --------------
 .../cli/src/commands/dashboard-tui/controller.ts   | 37 +---------
 .../core/src/__tests__/available-memory.test.ts    | 83 ++++++++++++++++++++++
 packages/core/src/__tests__/system-metrics.test.ts | 36 +++++++++-
 packages/core/src/available-memory.ts              | 32 +++++++++
 packages/core/src/index.ts                         |  1 +
 packages/core/src/system-metrics.ts                |  9 ++-
 .../dashboard/src/__tests__/routes-system.test.ts  | 27 +++++++
 packages/dashboard/src/routes.ts                   |  7 +-
 .../src/__tests__/run-verification-command.test.ts | 18 +++++
 13 files changed, 218 insertions(+), 95 deletions(-)

Fusion-Task-Id: FN-6834

Fusion-Task-Lineage: 2e651551-6c35-46d1-b517-535758c7ace2
2026-06-21 13:32:19 -07:00
gsxdsm
47ba99a25e FN-6853: bump pi SDK packages
Update the pi SDK dependency family across Fusion packages and record a patch changeset.

- Bump @earendil-works/pi-ai and @earendil-works/pi-coding-agent to ^0.79.9 where used by CLI, dashboard, and engine packages.
- Refresh pnpm-lock.yaml to resolve the updated pi SDK dependency graph.
- Add a patch changeset for the published @runfusion/fusion package.

Files changed:
 .changeset/fn-6853-pi-sdk-bump.md |   5 +
 packages/cli/package.json         |   4 +-
 packages/dashboard/package.json   |   2 +-
 packages/engine/package.json      |   4 +-
 pnpm-lock.yaml                    | 285 +++++++++++++++++++++++++++-----------
 5 files changed, 214 insertions(+), 86 deletions(-)

Fusion-Task-Id: FN-6853
Fusion-Task-Lineage: bc2dba95-b8c2-48d1-855d-847e6eec9606
2026-06-21 13:25:41 -07:00
gsxdsm
c18e827b90 FN-6839: await CLI cached store shutdown
Rescue the retained CLI quarantine by making TaskStore shutdown deterministic before fixture cleanup.

- Await cached extension TaskStore closes and clear the cache before asynchronous shutdown drains.
- Update CLI fixtures to await direct and cached store closure, with a regression proving cached close is awaited.
- Remove rescued CLI quarantine entries/excludes and document the loaded-suite rescue with a patch changeset.

Files changed:
 .changeset/fn-6839-close-cached-stores.md          |  5 ++
 CLAUDE.md                                          |  1 +
 docs/testing.md                                    |  4 ++
 .../extension-agent-set-instructions.test.ts       |  2 +-
 .../__tests__/extension-goal-tools-audit.test.ts   |  2 +-
 .../cli/src/__tests__/extension-goal-tools.test.ts |  2 +-
 .../cli/src/__tests__/extension-insights.test.ts   |  6 +--
 .../__tests__/extension-mission-goal-tools.test.ts |  2 +-
 .../cli/src/__tests__/extension-task-tools.test.ts | 16 ++++---
 packages/cli/src/__tests__/extension.test.ts       | 56 +++++++++++-----------
 .../src/__tests__/research-extension-tools.test.ts |  4 +-
 packages/cli/src/extension.ts                      | 16 +++----
 packages/cli/vitest.config.ts                      |  6 +--
 scripts/lib/test-quarantine.json                   | 15 ------
 14 files changed, 68 insertions(+), 69 deletions(-)

Fusion-Task-Id: FN-6839

Fusion-Task-Lineage: ea0c7c77-bb59-4db4-931d-5e052a1043e5
2026-06-21 09:00:40 -07:00
gsxdsm
4f9c4cf10d Merge pull request #1701 from Runfusion/gsxdsm/compound-improve
fix: show plugin-contributed skills in the workflow editor
2026-06-21 02:36:43 -07:00
gsxdsm
42a1346d6c fix: address engine startup review feedback 2026-06-21 02:15:24 -07:00
gsxdsm
91017050d4 fix: show plugin-contributed skills in the workflow editor
The dashboard's discovered-skills catalog was built only from the
disk-scanning package manager, so plugin-contributed skills (e.g.
compound-engineering ce-*) — which the engine materializes for executor
sessions separately — never appeared in the editor. Built-in workflow
nodes that reference them (builtin:compound-engineering) showed
"— select skill —" / unresolved.

- skills-adapter: merge plugin skill contributions into the discovered
  list (deduped by bare name) via an optional getPluginSkills thunk;
  add shared bareSkillName normalizer.
- wire getPluginSkills into all three server entry points: serve,
  daemon, and dashboard (the UI-serving command — verified via live
  end-to-end that omitting it left the editor catalog empty).
- node-summary + WorkflowNodeEditor: resolve namespaced skillNames
  (compound-engineering:ce-work) against the catalog's two-segment
  names (ce-work/SKILL.md) so nodes display and select the right skill.

Verified: dashboard + CLI typecheck, 136 dashboard tests, and a live
dashboard E2E (discovered skills 0→11; Plan node resolves to "ce-plan"
in both the canvas label and the inspector dropdown).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 00:05:03 -07:00
gsxdsm
7ef381762a feat: start engines by default 2026-06-20 23:57:37 -07:00
gsxdsm
c0d78f19c5 FN-6795: update quarantine ledger after rescue triage
Refresh the test quarantine records after loaded-lane rescue verification.

- document the FN-6795 CLI and core quarantine triage outcomes
- rescue passing core and CLI test files by removing their ledger/config excludes
- retain CLI package-lane-only timeout quarantines and add the newly observed bin test flake

Files changed:
 docs/testing.md                  |  4 ++++
 packages/cli/vitest.config.ts    | 10 +++++++---
 packages/core/vitest.config.ts   |  4 +++-
 scripts/lib/test-quarantine.json | 25 +++++--------------------
 4 files changed, 19 insertions(+), 24 deletions(-)

Fusion-Task-Id: FN-6795
Fusion-Task-Lineage: b4460fc7-848f-4d54-89b4-cfd4d4533d57
2026-06-20 10:28:25 -07:00
gsxdsm
259cdfb531 FN-6734: stabilize CLI extension test cleanup
Stabilize the CLI extension regression lane by closing cached stores before temp fixture removal.

- Close extension store caches and manually created TaskStore/AgentStore handles before deleting per-test fixture roots.
- Add a regression guard for the cached TaskStore close-before-remove invariant.
- Reduce oversized task-list truncation fixtures while preserving bounded-output assertions.
- Document the CLI affected-lane rescue pattern for store leaks, fixture sizing, and runtime-dist mocking order.

Files changed:
 docs/testing.md                                    |   4 +
 .../extension-agent-set-instructions.test.ts       |   3 +-
 .../__tests__/extension-goal-tools-audit.test.ts   |   3 +-
 .../cli/src/__tests__/extension-goal-tools.test.ts |   3 +-
 .../cli/src/__tests__/extension-insights.test.ts   |   3 +-
 .../__tests__/extension-mission-goal-tools.test.ts |   3 +-
 packages/cli/src/__tests__/extension.test.ts       | 221 +++++++++++++--------
 .../src/__tests__/research-extension-tools.test.ts |  40 +++-
 8 files changed, 186 insertions(+), 94 deletions(-)

Fusion-Task-Id: FN-6734

Fusion-Task-Lineage: efe91c0f-f84c-471c-8067-65a244b2aec7
2026-06-19 16:47:33 -07:00
gsxdsm
87f18f87ed FN-6705: add plugin activation analytics
Record plugin activation events and expose them to Command Center analytics.

- Add plugin activation persistence, aggregation helpers, and exports.
- Record load/reload activation events through the plugin loader and store APIs.
- Surface plugin activation counts in the Command Center Ecosystem area and API route.
- Cover migrations, aggregation behavior, plugin loader recording, route auth, UI rendering, and quarantined flaky suites.

Files changed:
 .changeset/fn-6705-plugin-activation-analytics.md  |   5 +
 docs/architecture.md                               |   2 +-
 docs/dashboard-guide.md                            |   2 +-
 packages/cli/vitest.config.ts                      |   8 +
 packages/core/src/__tests__/db-migrate.test.ts     |  34 ++---
 packages/core/src/__tests__/db.test.ts             |  59 ++++----
 packages/core/src/__tests__/goals-schema.test.ts   |   6 +-
 packages/core/src/__tests__/insight-store.test.ts  |  12 +-
 .../src/__tests__/merge-request-record.test.ts     |   3 +-
 packages/core/src/__tests__/mission-store.test.ts  |   6 +-
 .../__tests__/plugin-activation-analytics.test.ts  |  67 ++++++++
 packages/core/src/__tests__/plugin-loader.test.ts  | 168 ++++++++++++++++++++-
 packages/core/src/__tests__/run-audit.test.ts      |   6 +-
 .../core/src/__tests__/store-merge-queue.test.ts   |   3 +-
 .../src/__tests__/store-plugin-activations.test.ts |  52 +++++++
 packages/core/src/__tests__/task-documents.test.ts |   3 +-
 packages/core/src/db.ts                            |  35 ++++-
 packages/core/src/index.ts                         |   8 +
 packages/core/src/plugin-activation-analytics.ts   | 104 +++++++++++++
 packages/core/src/plugin-loader.ts                 |  27 ++++
 packages/core/src/store.ts                         |  24 ++-
 packages/core/src/types.ts                         |  22 +++
 packages/core/vitest.config.ts                     |  12 ++
 .../command-center/areas/EcosystemArea.tsx         |  40 +++--
 .../command-center/areas/__tests__/areas.test.tsx  |  52 ++++++-
 .../register-command-center-routes.auth.test.ts    |   1 +
 .../register-command-center-routes.test.ts         |  29 ++++
 .../src/routes/register-command-center-routes.ts   |  20 +++
 .../src/store/__tests__/roadmap-store.test.ts      |   9 +-
 scripts/boot-smoke.mjs                             |  24 ++-
 scripts/lib/test-quarantine.json                   |  55 +++++++
 31 files changed, 799 insertions(+), 99 deletions(-)

Fusion-Task-Id: FN-6705
Fusion-Task-Lineage: 12ed6227-f935-4038-bbe9-a605a054850e
2026-06-19 16:47:33 -07:00
gsxdsm
70cce18c31 FN-6712: add managed agent instructions tool
Add a scoped extension tool for managers to update report instructions through AgentStore.

- Register fn_agent_set_instructions with validation, hierarchy authorization, and config-revision persistence.
- Cover direct, indirect, privileged, denied, missing-target, and field-clearing behaviors with CLI extension tests.
- Document the new agent-management tool in agent docs, Fusion skill references, and a published package changeset.

Files changed:
 .changeset/fn-6712-agent-set-instructions-tool.md  |   5 +
 docs/agents.md                                     |  12 ++
 packages/cli/skill/fusion/SKILL.md                 |   2 +-
 .../cli/skill/fusion/references/extension-tools.md |  10 +
 .../skill/fusion/references/fusion-capabilities.md |   1 +
 .../extension-agent-set-instructions.test.ts       | 235 +++++++++++++++++++++
 packages/cli/src/extension.ts                      |  94 +++++++++
 7 files changed, 358 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-6712
Fusion-Task-Lineage: 1fac1ff0-283d-4911-8fbf-f15c5de6b902
2026-06-19 07:41:44 -07:00
gsxdsm
4373946a07 chore(release): v0.44.0
Version bump via changesets.
2026-06-19 07:34:26 -07:00
gsxdsm
538bf42e32 fix(dev): rebuild core+engine+dashboard on dev/local startup + stale-dist check
pnpm dev/local dashboard prebuild now rebuilds @fusion/core and @fusion/engine alongside the dashboard UI (was client-only), and startup warns loudly when built dist/ is older than src/. Prevents the FN-6638 class where landed engine fixes silently never run because the process loads stale dist.
2026-06-18 13:41:37 -07:00
gsxdsm
0ed46d9007 FN-6640: expose planning task document tools
Expose planning-lane task document tools with chat-style explicit task targeting.

- Add task document read/write tools to both planning agent creation paths.
- Cover non-streaming and streaming planning tool assembly plus explicit task_id document behavior.
- Update agent docs and generated skill tool references for chat/planning parity.
- Add a patch changeset for the published CLI package.

Files changed:
 .changeset/fn-6640-planning-document-tools.md      |   5 +
 docs/agents.md                                     |   2 +-
 .../cli/skill/fusion/references/engine-tools.md    |   4 +-
 .../planning-document-tools-exposure.test.ts       | 139 +++++++++++++++++++++
 packages/dashboard/src/planning.ts                 |   7 ++
 5 files changed, 154 insertions(+), 3 deletions(-)

Fusion-Task-Id: FN-6640

Fusion-Task-Lineage: 6a9225cf-fbe7-4a87-8927-e01355a38e92
2026-06-18 07:23:02 -07:00
gsxdsm
b1a2aeebf2 FN-6635: expose task document tools to chat agents
Expose task document read/write tools to dashboard chat agents with explicit task targeting.

- Add chat-specific fn_task_document_write/read factories that require task_id and reuse task document read behavior.
- Wire dashboard chat custom tools to include task document tools when a scoped task store is available.
- Cover chat document tool exposure and explicit-task document operations with engine and dashboard tests.
- Document chat availability and add a published package changeset.

Files changed:
 .changeset/fn-6635-chat-task-documents.md          |   5 +
 docs/agents.md                                     |   1 +
 .../cli/skill/fusion/references/engine-tools.md    |   4 +-
 .../dashboard/src/__tests__/chat-manager.test.ts   |  78 +++++++++++
 packages/dashboard/src/chat.ts                     |  15 ++-
 .../src/__tests__/agent-document-tools.test.ts     | 108 +++++++++++++++
 packages/engine/src/agent-tools.ts                 | 145 ++++++++++++++++-----
 packages/engine/src/index.ts                       |   3 +
 8 files changed, 318 insertions(+), 41 deletions(-)

Fusion-Task-Id: FN-6635

Fusion-Task-Lineage: 25e701d4-7670-470b-9dea-df49884f7b21
2026-06-18 07:06:00 -07:00
gsxdsm
673a8a64c3 FN-6630: return text for empty task-list columns
Ensure filtered fn_task_list calls always return host-safe text for empty target columns.

- Add explicit empty-state copy for column filters with no matching tasks.
- Keep formatter fallback output non-empty before returning tool content.
- Cover empty active-column filters and existing small listings in CLI extension tests.
- Add a patch changeset for the published CLI package.

Files changed:
 .changeset/fn-6630-task-list-empty-column.md |  5 ++++
 packages/cli/src/__tests__/extension.test.ts | 36 +++++++++++++++++++++++++++-
 packages/cli/src/extension.ts                | 15 ++++++++++--
 3 files changed, 53 insertions(+), 3 deletions(-)

Fusion-Task-Id: FN-6630

Fusion-Task-Lineage: e371bf11-5841-47d0-ac72-4cdf2f1716ba
2026-06-18 04:53:50 -07:00
gsxdsm
4929198b5a FN-6629: Lower task-list text budget
Keep fn_task_list responses below host text imageification thresholds.\n\n- Lower the shared task-list text clamp to a 3,000 character host-safe budget.\n- Reuse the shared budget in CLI, dashboard, and engine fallback formatters.\n- Cover realistic column-filtered fn_task_list outputs and fallback budget behavior with regression tests.\n- Add a patch changeset for the published Fusion package.\n\nFiles changed:\n .changeset/fn-6629-task-list-budget.md             |  5 ++\n packages/cli/src/__tests__/extension.test.ts       | 88 ++++++++++++++++++++++\n packages/cli/src/extension.ts                      |  7 +-\n .../core/src/__tests__/task-list-format.test.ts    | 25 ++++++\n packages/core/src/task-list-format.ts              |  5 +-\n .../src/__tests__/planning-board-tools.test.ts     |  4 +-\n packages/dashboard/src/planning-board-tools.ts     |  8 +-\n packages/engine/src/__tests__/triage.test.ts       |  4 +-\n packages/engine/src/triage.ts                      |  7 +-\n 9 files changed, 144 insertions(+), 9 deletions(-)

Fusion-Task-Id: FN-6629

Fusion-Task-Lineage: 6ec7cd33-d4e5-4c12-8512-c3823a9dfb3e
2026-06-18 03:24:57 -07:00
gsxdsm
4dd533753e FN-6626: close cached CLI extension task stores
Close cached TaskStore handles so CLI extension task-tool tests shut down cleanly.\n\n- Add deterministic cached-store shutdown for the CLI extension and invoke it from extension teardown.\n- Expose the shutdown helper for tests and call it after canonical-project-root task-tool cases.\n- Add a patch changeset for the published @runfusion/fusion package.\n\nFiles changed:\n .changeset/fn-6626-close-cached-stores.md             |  5 +++++\n .../cli/src/__tests__/extension-task-tools.test.ts    |  8 ++++++++\n packages/cli/src/extension.ts                         | 19 ++++++++++++++++++-\n 3 files changed, 31 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-6626

Fusion-Task-Lineage: 65791502-8992-4037-8ca0-fe21c8283506
2026-06-18 02:39:10 -07:00
gsxdsm
d3ea8dff33 FN-6627: guard dist-barrel tests on complete core dist
Align dist-barrel regression guards so partial @fusion/core dist artifacts skip instead of failing mismatched dependency checks.

- Add a shared @fusion/test-utils predicate for complete built core dist barrels.
- Use the predicate in CLI and core dist-barrel regression tests before importing runtime dist modules.
- Cover absent and partial dist directories with focused predicate tests.

Files changed:
 packages/cli/src/__tests__/extension.test.ts       |  9 +++--
 .../src/__test-utils__/__tests__/core-dist.test.ts | 46 ++++++++++++++++++++++
 packages/core/src/__test-utils__/workspace.ts      | 11 ++++++
 .../core/src/__tests__/task-list-format.test.ts    | 17 ++++----
 4 files changed, 72 insertions(+), 11 deletions(-)

Fusion-Task-Id: FN-6627

Fusion-Task-Lineage: a05ad009-229d-44c2-a49d-2d9b3f3d6094
2026-06-18 01:45:18 -07:00