Commit Graph

883 Commits

Author SHA1 Message Date
Fusion
a8bfb32c70 feat(FN-3590): prioritize workspace source entry for bundled plugins and ad
This merge introduces eval score categorization with a new `eval-scoring.ts` module (FN-3601, FN-3390), hardened bundled plugin entry resolution to prioritize workspace source over installed copies (FN-3590), and documented reply-link threading behavior in the mailbox (FN-3598). It also adds mobile

Fusion-Task-Id: FN-3590
2026-05-06 11:47:41 -07:00
Fusion
4556df5954 feat(FN-3593): add test isolation CI enforcement, fix stuck-requeue race, a
This merge lands five FN-3593 commits establishing a test isolation contract with a new `scripts/check-test-isolation.mjs` guard that scans for accidental `beforeEach`/`afterEach`/`beforeAll`/`afterAll` in setup helpers, plus per-package `setup-test-isolation.ts` bootstraps that canonicalize the pat

Fusion-Task-Id: FN-3593
2026-05-06 09:43:51 -07:00
gsxdsm
22250ebd19 fix(dashboard): respond to manual heartbeat run as soon as run record exists
POST /api/agents/:id/runs previously awaited resolvedMonitor.executeHeartbeat
end-to-end before sending the response. For real provider runs that take
tens of seconds to minutes, Safari (and intermediate proxies) drop the
client socket and the dashboard surfaces "Failed to start heartbeat run:
load failed" — the run is actually in flight, but the toast suggests it
failed to start.

The route now kicks off executeHeartbeat in the background, polls briefly
for the active-run record (created synchronously inside executeHeartbeat
→ startRun), and returns 201 with that record. Synchronous failures of
executeHeartbeat are still surfaced to the client; background failures
are logged via runtimeLogger.child("heartbeat"). The 409 active-run
conflict contract is preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 08:31:39 -07:00
gsxdsm
1100b39cff fix(engine): prevent worktree collisions on manual task moves
Two related bugs let two in-progress tasks share a single
.worktrees/<name> directory:

1. The dashboard POST /tasks/:id/move route promoted tasks to
   in-progress without allocating a fresh worktree path, so a queued
   task carrying a stale worktree field from a prior preserveResumeState
   requeue could land in-progress on a directory already held by another
   active task.

2. moveTask({preserveResumeState:true}) kept the worktree pointer on
   requeue. When the on-disk checkout was later removed or reassigned,
   the next dispatch collided with a worktree the scheduler had handed
   to another task.

moveTask now releases the worktree pointer on every reopen-to-todo hop
(branch is kept so committed progress survives via git worktree add
<path> <branch>). A new preserveWorktree option opts internal bounces
out of the release. moveTask also accepts an allocateWorktree callback
that runs under a new cross-task allocation lock in TaskStore, so two
concurrent moves cannot pick the same name from a stale snapshot. Both
the manual-move route and the scheduler dispatch path flow through the
allocator and share the lock.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 07:23:38 -07:00
Fusion
8f812e2f89 feat(FN-3565): add plugin management CLI, loader, runner, and dashboard rou
This merge adds a complete plugin management system to Fusion: a new `fn plugin` CLI command for installing/removing plugins, a plugin loader in core, a plugin runner in engine, and dashboard routes for plugin management UI, along with a plugin management guide in docs. It also documents task evalua

Fusion-Task-Id: FN-3565
2026-05-06 04:32:29 -07:00
Fusion
f499f10818 feat(FN-3564): isolate plugin loader test state to prevent cross-test conta
Refactored plugin-loader tests and implementation to isolate plugin test contamination, improving test independence in `@fusion/core`.

Fusion-Task-Id: FN-3564
2026-05-06 02:14:05 -07:00
gsxdsm
24017b8353 fix(dashboard): drop residual terminated-state refs lost in merger autostash
Recovers cleanups from stash@{2}/stash@{3} (FN-3530 merger autostashes)
that the merger never restored: 4 dead `[data-state="terminated"]`
selectors in AgentListModal.css, 3 CSS-class assertions in
agent-css-classes.test.ts targeting classes the runtime no longer emits,
and a `state: "terminated"` fixture in routes-agents.test.ts now flipped
to `paused` so the "invalid state transitions" test exercises a real
rejection (paused→paused is not in AGENT_VALID_TRANSITIONS).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
gsxdsm
7f441ea2d3 Merge pull request #49 from timothyjlaurent/fix/mission-interview-default-model
fix(dashboard): resolve default model from settings for mission interview
2026-05-06 00:03:16 -07:00
gsxdsm
bdc8ecca77 Merge pull request #47 from timothyjlaurent/timothyjlaurent/fix-anthropic-logout
fix(auth): prevent credential resurrection after Anthropic logout
2026-05-06 00:02:40 -07:00
Timothy Laurent
5fd678d619 fix(dashboard): resolve default model from settings for mission interview
The mission interview route passed modelProvider/modelId from the request
body directly without resolving the configured default model from settings.
When "Use default" was selected, both values were undefined, causing
createFnAgent to use pi's internal fallback instead of the user's
configured default (e.g. zai/glm-5.1). This produced "AI returned no
valid JSON" errors.

Use resolvePlanningSettingsModel() to resolve the effective model from
the settings hierarchy (planning-specific → project → global defaults),
with explicit request overrides still taking precedence.

Closes #48

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-05 22:24:38 -07:00
Timothy Laurent
dfb255249f fix(auth): prevent credential resurrection after Anthropic logout
The logout flow had two bugs causing credentials to reappear immediately:

1. The codebase has two separate auth storage Proxy chains:
   - createFusionAuthStorage (engine, for agents)
   - mergeAuthStorageReads (CLI, for dashboard UI)
   Neither had a logout trap, so supplemental credentials from
   ~/.claude/.credentials.json were never excluded after logout.

2. The upstream AuthStorage.hasAuth() checks environment variables
   (ANTHROPIC_API_KEY), which always returns true regardless of logout.

Fix: Add loggedOutProviders tracking to both Proxy chains. All query
traps (has, hasAuth, get, getAll, list, getApiKey) return false/undefined
for logged-out providers instead of delegating to the underlying storage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-05 20:51:44 -07:00
gsxdsm
12193d265c feat(FN-3299): auto-install bundled runtime plugins on first save
Hermes / OpenClaw / Paperclip runtime cards in Settings now lazily
register themselves on first Save instead of failing with `Plugin
"fusion-plugin-...-runtime" not found`. The CLI also bundles each
runtime plugin (with @fusion/plugin-sdk inlined via esbuild) into
dist/plugins/<id>/bundled.js so npm/npx-installed Fusion can load them
without the workspace SDK dependency.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 20:47:38 -07:00
gsxdsm
d47e48fa78 fix(dashboard): drop terminated-state leftovers and AgentListModal duplicate Resume
Removes no-op `agents.filter((a) => true)` calls (a leftover from the
terminated AgentState refactor) flagged by eslint and updates affected
tests and fixtures so `terminated` is no longer referenced. Also:

- Deletes the duplicate `state === "paused"` render branch in
  AgentListModal list view that produced two "Resume" buttons.
- Updates the AgentDetailView help text to reflect the current
  deletable states ("idle or paused").
- Aligns the bundled-plugin-install test with the new auto-load
  behavior for already-installed enabled plugins.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 20:47:38 -07:00
gsxdsm
8eb5c3dc60 refactor(agents): remove terminated AgentState; collapse to paused/error
Drops "terminated" from AGENT_STATES. The agent lifecycle now runs through
idle | active | running | paused | error. paused (carrying a pauseReason)
absorbs every former terminated use case — manual stop, heartbeat run
termination, spawned-child cleanup. Run status (agentRuns.status) is
unchanged: "terminated" stays a valid run-status value.

AGENT_VALID_TRANSITIONS allows direct any→idle transitions so resetAgent
no longer needs the intermediate hop.

Stack-wide:
- core/agent-store: lastError clearing + resetAgent simplified.
- engine/agent-heartbeat, executor, in-process-runtime: terminated state
  writes → paused; halt-state listener fires on paused/error.
- dashboard: AgentsView/AgentListModal/AgentDetailView lose the Terminated
  badge/option/state-block; agent pickers no longer filter terminated;
  agentHealth drops the Terminated branch; routes/state cast widened to
  the new AgentState union.

Tests across core and engine updated to assert paused for AgentState and
left "terminated" intact for run-status assertions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 20:47:38 -07:00
Fusion
dfbaee1e93 feat(FN-3298): add regression test for runtime plugin alias
Adds a regression test for runtime plugin alias functionality (FN-3298 Step 3), covering 25 lines of test coverage for this feature.

Fusion-Task-Id: FN-3298
2026-05-05 20:47:37 -07:00
Fusion
e30fe5d245 feat(FN-3118): document avatar storage in agents and architecture
Added avatar storage and field documentation to the agents guide, with a minor reference added to the architecture docs.

Fusion-Task-Id: FN-3118
2026-05-05 20:47:37 -07:00
Fusion
0aef085f13 feat(FN-3368): tighten research view test coverage and resolve dashboard ty
This merge introduces an eval automation domain store with persistence schema and a plugin dashboard view registry (FN-3512/FN-3513), adds scheduled eval batch architecture documentation (FN-3388), and includes substantial test coverage for Research routes and hooks (FN-3368 steps 1-3). The branch a

Fusion-Task-Id: FN-3368
2026-05-05 13:05:57 -07:00
Fusion
30f6381ec0 feat(FN-3513): add eval domain store, plugin dashboard view registry, and G
This merge adds three major features: an eval domain (`eval-store.ts`, `eval-types.ts`) with persistence schema for evaluation data; a plugin dashboard view registry with navigation integration for third-party dashboard extensions; and GitHub source metadata traceability that locks and enforces issu

Fusion-Task-Id: FN-3513
2026-05-05 12:25:50 -07:00
Fusion
d7880c66b0 feat(FN-3157): add plugin dashboard view registry with nav integration
Merged FN-3157 to add a plugin dashboard views system, including a plugin view registry with lazy loading, navigation integration for Header and MobileNavBar, a usePluginDashboardViews hook with cache and refetch support, and tests covering the no-loader path. Also added documentation in `docs/PLUGI

Fusion-Task-Id: FN-3157
2026-05-05 12:14:20 -07:00
Fusion
c87c9e2e1f feat(FN-3387): add eval domain with store and persistence schema
Introduced a new evaluation persistence layer in `@fusion/core` with domain contracts, SQLite-backed storage APIs, and retention/window-rollup support, wired through the core store and documented in the architecture and storage docs.

Fusion-Task-Id: FN-3387
2026-05-05 12:01:53 -07:00
Fusion
f2accb736f feat(FN-3209): fix refine continuation flow in planning mode and add local
Merges fixes for the planning refine continuation flow (FN-3209) alongside a new local startup script for development environments. The changes include updates to `PlanningModeModal.tsx`, new and updated tests for the planning system, route handler improvements in `chat.ts` and `planning.ts`, and do

Fusion-Task-Id: FN-3209
2026-05-05 11:32:05 -07:00
gsxdsm
b4a2e7a486 feat(chat): unify QuickChat backend path and consolidate render toggle
Backend
- chat.ts now routes both regular chat and QuickChat through
  createResolvedAgentSession instead of branching to createFnAgent for
  the no-runtime-hint case. This removes the divergent path where
  pi-ai's cleanupSessionResources(sessionId) could tear down resources
  the next generation depends on.
- sendMessage's finally only disposes the agent if it still owns the
  activeGenerations slot. A newer generation that has pre-empted us
  cleans up its own agent in its own finally — disposing here would
  yank the underlying CLI process out from under it.
- __setCreateFnAgent test helper now mirrors its mock into the
  createResolvedAgentSession slot so existing test setups still work
  after the unification.

Frontend
- Extract createChatStreamHandlers (RAF coalescing, accumulators,
  tool-call dedup, fallback handling) — useChat and useQuickChat were
  duplicating ~85 LOC each. Both now compose the shared factory.
- Move shared chat types into chatTypes.ts. The hooks re-export them
  for backward compatibility with existing consumers.
- Removed per-message Markdown/plain-text eye toggles. A single
  thread-level toggle in the chat header now flips every assistant
  bubble (including the streaming one) between rendered Markdown and
  plain text.
- Model-only chats hide the per-message agent identity row entirely;
  the model name is already in the thread header.

Tests
- Updated ChatView tests to reflect the new render-toggle contract
  (single header toggle drives all bubbles) and the model-only avatar
  suppression.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 11:04:48 -07:00
gsxdsm
a77932205c fix(chat): revert cancelGeneration-on-disconnect
req.on("close") was firing for healthy SSE connections in this
Node/Express setup, which cancelled the in-flight agent the client was
still listening to and made even msg #1 fail after a fresh reload.
Keep the beginGeneration (no dispose) change from the same commit —
that one's correct.
2026-05-05 09:08:51 -07:00
gsxdsm
b85743db84 fix(chat): cancel orphaned generation on client disconnect
Closing the QuickChat browser tab mid-response left the backend agent
running with no listener. The `activeGenerations` slot persisted and the
next message's freshly-opened CLI SessionManager raced against the
lingering agent on the same session file, so the model produced no
output for the new prompt.

- POST /chat/sessions/:id/messages now calls cancelGeneration on
  req.on("close") if the response hasn't ended yet, so disconnects stop
  the agent promptly.
- beginGeneration only aborts the prior controller; it no longer
  disposes the prior agent. Disposing pre-emptively could yank the CLI
  process out from under the new generation's session opened on the
  same file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 09:04:14 -07:00
gsxdsm
41375736e7 Reapply "fix: isolate chat SSE broadcasts per generation"
This reverts commit 46f1f042b0.
2026-05-05 08:21:33 -07:00
gsxdsm
46f1f042b0 Revert "fix: isolate chat SSE broadcasts per generation"
This reverts commit 9d27064c29.
2026-05-05 08:14:10 -07:00
gsxdsm
9d27064c29 fix: isolate chat SSE broadcasts per generation
After stopping a streaming chat reply, the next message would appear
sent but show no Stop button or "Connecting…" indicator. The cancel
broadcast from the prior generation was leaking into the new SSE
subscription and immediately marking it as errored.

Each `chatManager.sendMessage` now allocates a per-generation id;
`ChatStreamManager` only delivers tagged broadcasts to subscribers
from the matching generation. `sendMessage`'s cleanup also stops
deleting a newer generation's `activeGenerations` slot when an older
one finally unwinds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 07:35:18 -07:00
Fusion
9e2a8006b9 feat(FN-3430): preserve and consume final assistant done payload
This merge adds done-payload snapshot handling across the chat system (FN-3430), normalizing how final assistant messages are preserved and consumed in the dashboard hooks, plus it normalizes dashboard mailbox and user identity for inter-agent messaging (FN-3484) and introduces plugin workflow step

Fusion-Task-Id: FN-3430
2026-05-05 06:42:18 -07:00
Fusion
59f6c8426e feat(FN-3484): normalize dashboard mailbox and user identity for messaging
This merge normalizes dashboard user identity and mailbox messaging (FN-3484, 4 steps), adds workflow step execution for plugins (FN-3490), and updates the restart integration store mock for plugin templates (FN-3096). Core changes touch the message store and store modules with identity normalizatio

Fusion-Task-Id: FN-3484
2026-05-05 06:32:34 -07:00
Fusion
5bf33e8f66 feat(FN-3096): update restart integration store mock for plugin templates
Updates the restart integration test mock to account for plugin template behavior, keeping the test in sync with recent plugin template changes.

Fusion-Task-Id: FN-3096
2026-05-05 06:32:34 -07:00
gsxdsm
af0bc4bd07 feat(FN-3475): merge fusion/fn-3475
Fusion-Task-Id: FN-3497
2026-05-05 06:32:33 -07:00
Fusion
112d8894a5 feat(FN-3446): expand dashboard guide view sections and add regression test
Merged two commits completing the FN-3446 dashboard guide feature: the documentation was expanded with new view sections, and a regression test suite was added for the dashboard guide to prevent future regressions.

Fusion-Task-Id: FN-3446
2026-05-05 06:32:33 -07:00
Fusion
6e6413263f feat(FN-3415): add todo documentation contract test
Adds a contract test for todo documentation in the core task store, covering the behavior documented in the system.

Fusion-Task-Id: FN-3415
2026-05-05 06:32:33 -07:00
Fusion
51866654b8 feat(FN-3416): verify auth route provider expectations in step 2
Test-only merge for FN-3416: adds verification for auth route provider expectations, completing Step 2 of the task with no file changes reported.

Fusion-Task-Id: FN-3416
2026-05-05 01:24:14 -07:00
Fusion
6ce27545ba feat(FN-3462): add workflow theme regression test for WorkflowResultsTab
Adds regression coverage for WorkflowResultsTab theme styling by moving a hardcoded box-shadow fallback into the global stylesheet and adding a test that validates the theme-specific status background renders correctly.

Fusion-Task-Id: FN-3462
2026-05-05 00:31:36 -07:00
Fusion
43dd04860c feat(FN-3471): apply tokenized sizing and focus styles to component CSS
Merged CSS changes that apply tokenized sizing and focus styles to InsightsView and DesktopModeChooser components, with the majority of changes in InsightsView.css.

Fusion-Task-Id: FN-3471
2026-05-05 00:21:21 -07:00
Fusion
aab28e1adb feat(FN-3434): add Claude OAuth credential interop with verification and st
This merge lands four major features: the desktop app gains shell onboarding with remote mode support via a new `DesktopModeChooser` and `shell-settings` module (FN-3399); the dashboard gains full archived insights support with the `InsightsView` redesign and `useInsights` hook overhaul (FN-3315); C

Fusion-Task-Id: FN-3434
2026-05-04 23:47:26 -07:00
Fusion
b45b4dd17a feat(FN-3315): add test coverage for archived insights in three test suites
Adds test coverage for archived insights across the core store, `InsightsView` component, and `useInsights` hook — 156 lines of new tests covering FN-3315.

Fusion-Task-Id: FN-3315
2026-05-04 23:47:26 -07:00
Fusion
854c59398a feat(FN-3413): update auth route fixtures to github-copilot
Updates authentication route test fixtures to use "github-copilot" as the provider name instead of the previous value, ensuring tests align with the current auth provider configuration.

Fusion-Task-Id: FN-3413
2026-05-04 23:47:25 -07:00
Fusion
1655ef578f feat(FN-3301): render commit body in expanded git views
Completes the commit body rendering in expanded git views within `GitManagerModal`, including updated component implementation and tests. The dashboard git routes and modal component now properly display full commit body content.

Fusion-Task-Id: FN-3301
2026-05-04 22:17:10 -07:00
Fusion
e0e871555d feat(FN-3116): add docker node provisioning routes with planning modal and
This merge adds Docker node provisioning infrastructure with API routes for provisioning lifecycle, Docker node management, and failure-state handling, along with corresponding test coverage for onboarding, lifecycle, and error flows. It also introduces planning session rewind capability with a moda

Fusion-Task-Id: FN-3116
2026-05-04 21:21:22 -07:00
Fusion
7b45ae15ee feat(FN-3447): add planning session rewind capability with modal back actio
This merge delivers four major features: a planning session rewind system (FN-3447, steps 1–4) with a new backend route for rolling back sessions, modal back-action wiring, and updated typing; workspace verification gates (FN-3385) for agent prompt editing; an agents view org chart spacing rework (F

Fusion-Task-Id: FN-3447
2026-05-04 21:21:22 -07:00
gsxdsm
f909688dd9 Merge pull request #30 from timothyjlaurent/fix/sqlite-corruption-wal-pragmas
fix: prevent SQLite B-tree corruption with WAL tuning and batched agent logs
2026-05-04 21:20:32 -07:00
Fusion
8f0f9257ed feat(FN-3114): stabilize docker config modal recreate indicator test
The merge stabilizes a test case in the NodeDetailModal test file related to the docker config modal's recreate indicator, correcting an assertion that was causing intermittent failures.

Fusion-Task-Id: FN-3114
2026-05-04 19:05:48 -07:00
Fusion
739e10bf3c feat(FN-3356): ship llama.cpp provider integration, mobile org chart contro
This merge delivers v0.19.0 with several major features and reliability improvements: a new llama.cpp provider integration for the pi extension and mobile dashboards, an extensive refactor of the agent heartbeat system with per-agent configuration and test coverage, a large PlanningModeModal test su

Fusion-Task-Id: FN-3356
2026-05-04 18:19:38 -07:00
Fusion
53ae8c5465 feat(FN-3324): add runtime guard regression sentinel
Adds a regression test sentinel in the engine's in-process runtime test suite to guard against runtime guard behavior regressions (FN-3324).

Fusion-Task-Id: FN-3324
2026-05-04 15:33:39 -07:00
Fusion
95d368e7d7 feat(FN-3211): document app CPU metric in system stats
Updated the architecture documentation to document the app CPU metric in the system stats section.

Fusion-Task-Id: FN-3211
2026-05-04 15:16:53 -07:00
Fusion
a66ddf2e7f feat(FN-3314): align auth route assertion in agents routes test
Test FN-3314 completes its final step by refining an auth route assertion in the agents routes test, ensuring the test accurately validates the expected behavior.

Fusion-Task-Id: FN-3314
2026-05-04 15:04:36 -07:00
Timothy Laurent
cd09f12c77 merge main: resolve db.test.ts import conflict
Combined both branches: TaskStore import from main + rmSync import
from our branch (needed for fresh DB test cleanup).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-04 14:58:47 -07:00
Timothy Laurent
8e7b8e139f fix(tests): resolve 4 failing tests across cli and dashboard packages
- task.test.ts: save/delete GITHUB_REPOSITORY env before
  runTaskPrCreate fallback test so CI env doesn't bypass the
  getCurrentRepo code path
- app.test.tsx: increase waitForFrameContains timeout for ASCII QR
  render from 3s to 6s to accommodate slower CI environments
- remote-auth.test.ts: switch createRemoteSettings default from
  tailscale to cloudflare with a static ingressUrl so
  resolveRemoteBaseUrl doesn't 409 when no tunnel is running

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-04 14:54:55 -07:00