Commit Graph

44 Commits

Author SHA1 Message Date
gsxdsm
cd845d39be perf(merger): skip redundant in-merge verification and lockfile-stable installs
Two cuts to wasted work in the merge verification loop:

1. After the in-merge fix agent runs, fingerprint the working tree
   (`git diff HEAD` + `git status --porcelain`, sha256). If the post-fix
   fingerprint matches pre-fix and is non-empty, the agent didn't actually
   change anything — re-running the same failing command can only yield
   the same failure, so log and report the attempt as unsuccessful without
   paying the test/build cost. Empty fingerprints (snapshot tooling failed)
   fall through to the existing re-run path so we never silently swallow a
   real fix.

2. Inside `syncDependenciesForMerge`, hash the active lockfile and compare
   against `node_modules/.fusion-install-marker` (written after each
   successful install). When they match, skip `pnpm install
   --frozen-lockfile` even if `package.json` is staged. Covers the common
   case where `package.json` changes but the lockfile doesn't, and
   amortizes install across auto-recovery re-enqueues that hit the same
   worktree.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 12:24:57 -07:00
gsxdsm
986a928fa9 fix(dashboard): forward removeDependencyReferences flag in deleteTask
useTasks.deleteTask had a single-arg signature and dropped the options
object, so the modal's "remove dependency references" confirmation
flag never reached the API and deletion still failed with
TASK_HAS_DEPENDENTS. Forward options through the hook and widen the
matching taskOperations.deleteTask type in AppModals.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 06:49:05 -07:00
Fusion
44cc899eb9 feat(FN-3185): preserve progress on task reset with explicit confirmation d
This merge implements a "preserve progress" option for task resets across the system. FN-3185 adds a `preserveProgress` flag to `moveTask` that keeps status/history when resetting tasks back to `todo`, with required explicit confirmation dialogs to prevent accidental resets. The feature is wired thr

Fusion-Task-Id: FN-3185
2026-05-02 10:20:44 -07:00
gsxdsm
4887a113b9 fix: clear-search restores board and enable partial-match search
- useTasks debounced effect bailed when searchQuery transitioned back to
  undefined (App passes `searchQuery || undefined`), so clearing the
  input never refetched the unfiltered list. Track previous value via
  ref and only skip the initial mount.
- FTS5 search used bare tokens (exact term match), so "frob" did not
  match "frobnicator". Append `*` to each token (and to quoted tokens)
  for prefix matching. LIKE fallback already did substring matching.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 21:01:13 -07:00
gsxdsm
e7c86aa08f feat(engine): preserve branches on auto-requeue + add fn_run_verification
Three coordinated fixes for the FN-2978 incident class — auto-requeues
that orphaned committed work and watchdog kills on long verification runs.

**Auto-requeue branch reuse** (executor.ts, worktree-pool.ts)
- executor.ts:1782 now uses `task.branch || fusion/<id>` so persisted
  branches are honored on requeue. Previously the hardcoded fallback
  always tried to re-create the original branch, hit a conflict with
  the prior run's ref, and got suffix -2/-3. Other call sites already
  honor task.branch — this aligns the worktree-acquisition path.
- worktree-pool.ts:181 prepareForTask now probes existing branches with
  `git rev-parse --verify` and checks them out as-is. Falls through to
  suffixed creation only when the branch is genuinely in use by another
  live worktree. Previously force-reset with `checkout -B`, destroying
  prior commits.
- New private reconcileStepsFromGitHistory walks `git log
  baseCommitSha..HEAD` for `feat(FN-X): complete Step N` commits and
  marks matching steps[] as done so resumes don't redo committed work.

**Manual reset endpoint + UI** (dashboard)
- POST /api/tasks/:id/reset (requires `confirm: true`) — clears worktree,
  branch, all retry counters, resets steps[] to pending, moves to todo.
  Distinct from /retry which is the soft-resume path.
- Reset button alongside Retry in TaskDetailModal with confirm dialog,
  wired through useTasks → AppModals → API.

**fn_run_verification tool** (run-verification-tool.ts, executor.ts)
- New custom tool wrapping test/lint/build commands with a heartbeat
  callback (per-line + 60s synthetic), 200KB head+tail output cap, hard
  timeout with SIGTERM→SIGKILL escalation, and auto-bootstrap detection
  for missing node_modules. Prevents the inactivity watchdog from
  killing sessions during long compiles.
- Cross-platform via `shell: true` (Node picks /bin/sh on POSIX,
  cmd.exe on Windows). Prompt section in EXECUTOR_SYSTEM_PROMPT and
  EXECUTOR_PROMPT_TEXT instructs agents to prefer package-scoped
  verification first and reserve workspace-scoped runs for final
  integration.

**Tests** (64 passing)
- detect-pseudo-pause.test.ts (27 tests) — covers all 7 regex patterns,
  structural fallback, FN-2978 regression text.
- reconcile-step-regex.test.ts (25 tests) — pins the commit-message
  regex against a wide variant set.
- run-verification-command.test.ts (12 tests) — basic execution, output
  capture, heartbeat callbacks, timeout, error handling. POSIX-specific
  cases (multi-cmd `;`, `>&2`, `\$USER`) gated behind itPosix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 10:19:54 -07:00
gsxdsm
bb9b0f1d1a fix(FN-3005): preserve card timer across reruns 2026-04-29 23:13:38 -07:00
Fusion
0b14a6fea1 feat(FN-2975): merge fusion/fn-2975
- Stabilize QuickChatFAB search refresh lifecycle to prevent redundant or stale queries (`useTasks.ts`, `QuickChatFAB.tsx`)
- Add unit tests for QuickChatFAB component and `useTasks` hook
- Refactor QuickChatFAB styles and component structure

Commits merged:
- feat(FN-2975): complete Step 2 — stabilize search refresh lifecycle
- feat(FN-2972): merge fusion/fn-2972

Files changed:
packages/dashboard/app/components/QuickChatFAB.css | 60 ++++++++++++++++----
 packages/dashboard/app/components/QuickChatFAB.tsx | 65 +++++++++++-----------
 .../app/components/__tests__/QuickChatFAB.test.tsx | 32 +++++++++++
 .../dashboard/app/hooks/__tests__/useTasks.test.ts | 48 ++++++++++++++++
 packages/dashboard/app/hooks/useTasks.ts           |  4 +-
 5 files changed, 165 insertions(+), 44 deletions(-)

Fusion-Task-Id: FN-2975
2026-04-29 19:43:50 -07:00
gsxdsm
d8baa7a6fd fix(FN-XXX): show planning-created tasks without refresh 2026-04-29 15:25:06 -07:00
Fusion
04d859be37 feat(FN-2527): add bulk actions for in-progress and in-review columns
- Extend column action menus beyond Todo to include In Progress and In Review
- Add Stop All action that pauses only non-paused tasks with confirmation and success/error toasts
- Add Move All to Todo action with confirmation and partial-failure handling for bulk moves
- Thread pauseTask through useTasks, App, and Board so column menus can trigger task pausing
- Expand Column tests to cover new menu actions, disabled states, and bulk operation behavior
2026-04-25 15:11:54 -07:00
gsxdsm
99999e5c3e fix(dashboard): keep previous tasks visible during project switch
Dropping the render-phase setTasks([]) on projectId change avoids the
blank flash and full empty→populated Board reconcile that made project
switches feel like a multi-second hang. The existing fetch/version
guards already reject late responses and stale SSE events, so the
previous project's rows safely stay on screen until the new fetch lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 16:57:58 -07:00
Fusion
53babb3524 feat(FN-1850): aggregate projects across connected nodes
- Add /api/projects/across-nodes to merge local projects with online remote node project lists
- Expose fetchProjectsAcrossNodes and ProjectInfoWithSource, and switch useProjects to consume cross-node data
- Update ProjectOverview and ProjectCard with node badges, node count stats, and a node filter dropdown plus responsive styles
- Add server and dashboard test coverage for cross-node aggregation, filtering, and hook behavior changes
- Include a changeset for @gsxdsm/fusion minor release and preserve stale-channel SSE reconnect guards during merge
2026-04-18 03:08:00 -07:00
Fusion
76123c9538 fix(FN-2048): prevent stale SSE reconnects after channel teardown
- Add a closed flag to sse-bus channel state so teardown permanently disables reconnect scheduling
- Guard useTasks onReconnect callbacks against stale effect instances when toggling views
- Add regression tests for sse-bus and useTasks to ensure closed/unmounted channels do not reconnect
- Document the leak root cause and closed-flag pattern in .fusion/memory.md
2026-04-18 02:53:49 -07:00
Fusion
0433ce5dd8 fix(FN-2024): gate task SSE subscriptions by active view
- Add an sseEnabled option to useTasks and skip SSE subscription setup when disabled
- Compute taskSseEnabled in App based on board/list views and pass it through to useTasks
- Migrate useRemoteNodeEvents from raw EventSource management to shared subscribeSse bus usage
- Update App, useTasks, and useRemoteNodeEvents tests to cover SSE gating and bus-based event wiring
2026-04-17 15:21:15 -07:00
Fusion
96aeb67a4f feat(FN-2014): merge fusion/fn-2014 2026-04-17 14:31:43 -07:00
gsxdsm
30eaa814e6 feat(FN-1657): merge fusion/fn-1657 2026-04-12 19:31:13 -07:00
gsxdsm
8f0bcf7f00 feat(FN-1465): merge fusion/fn-1465 2026-04-12 07:00:49 -07:00
gsxdsm
5984584d22 perf(dashboard): slim task list + auto-archive stale done tasks
GET /api/tasks was returning ~69 MB of JSON per call (67.9 MB of agent
logs across 1199 tasks), causing the dashboard to hang for 2+ minutes.

- core: extend listTasks() with slim and includeArchived options
- dashboard: GET /api/tasks now uses slim mode and excludes archived
  by default; ?includeArchived=1 opts in
- frontend: lazy-load archived tasks when the archived column is first
  expanded via new useTasks.loadArchivedTasks()
- engine: self-healing maintenance now auto-archives done tasks older
  than 48h (data stays in SQLite, column flips done -> archived)
- tests: slim mode + includeArchived coverage in store.test.ts;
  routes.test.ts assertion updated for new args

Also bundles in-progress test-setup noise filters and pre-existing
QuickEntryBox/routes test work that was already modified locally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 20:16:20 -07:00
gsxdsm
d693e45f2b fix: resolve dashboard performance bottlenecks causing sporadic hangs
The dashboard was sporadically hanging for several seconds during task
creation and settings loading due to multiple compounding issues:

- checkForChanges() polled every 1s with SELECT * FROM tasks + full
  JSON.stringify comparison, blocking the Node.js event loop. Now uses
  incremental polling (only changed tasks via updatedAt filter).
- allocateId() called readConfig() which always ran listWorkflowSteps(),
  adding unnecessary DB queries while holding the serialization lock.
  Now uses readConfigFast() that skips workflow steps.
- Task creation triggered listWorkflowSteps() up to 3 times per request.
  Added in-memory cache with invalidation on create/update/delete.
- Route handlers used getSettings() (slow path) where getSettingsFast()
  suffices (POST /tasks, GET /config).
- SSE effect in useTasks had searchQuery and refreshTasks in its
  dependency array, causing EventSource teardown/rebuild on every search
  change. Moved to refs since the EventSource URL doesn't use searchQuery.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 11:01:15 -07:00
gsxdsm
dcbad95fd6 feat(FN-1260): add full-text search for tasks and comments
- Add FTS5 virtual table with v21 database migration for task search
- Add searchTasks() method to TaskStore with FTS5 query support
- Add q= search parameter to GET /api/tasks route for server-side search
- Update useTasks hook and frontend API to support searchQuery prop
- Update Board.tsx and App.tsx to pass searchQuery through component hierarchy
- Add comprehensive tests for FTS5 index and searchTasks functionality
2026-04-09 10:17:02 -07:00
gsxdsm
74c0f8fdc2 fix(FN-732): fix dashboard real-time updates and SSE pipeline
- Fix SSE event relay to properly broadcast task store events to dashboard clients
- Use named heartbeat events instead of SSE comments for reliable keep-alive
- Add missing event emission in core task store for state changes
- Add comprehensive tests for SSE pipeline, event emission, and UI hooks
- Remove broken useTerminal hook and AgentLogViewer tests, fix flaky test suites
2026-04-02 19:34:35 -07:00
gsxdsm
e701e7d900 feat(FN-723): add optimistic state insertion for createTask and duplicateTask
- Insert new tasks at correct sorted position in useTasks cache immediately on create/duplicate
- Compute insertIndex based on columnMovedAt/createdAt sorting to maintain board order
- Add comprehensive tests for optimistic insertion ordering in useTasks hook
- Cover edge cases: empty columns, single-item columns, and multi-item sorted columns
2026-04-02 18:47:38 -07:00
gsxdsm
05f2114743 fix(FN-000): scope dashboard project flows 2026-04-02 17:51:04 -07:00
gsxdsm
6fd1fa3c2f chore: resolve merge conflicts 2026-04-02 09:29:31 -07:00
gsxdsm
7f47013d13 fix(FN-673): harden dashboard task resync and Claude usage handling
- resync dashboard tasks after stream reconnects and when the tab becomes visible again
- add regression coverage for stale board recovery and usage-fetch edge cases
- replace direct Claude usage API calls with the CLI-based usage command
- document the dashboard resync safeguards and include a published package changeset
2026-04-01 13:01:52 -07:00
gsxdsm
83ab5b0fda feat(KB-662): refresh tasks when the dashboard regains focus
- Add a debounced visibilitychange refresh path to useTasks
- Reuse task normalization when refreshing task data from the API
- Preserve project-scoped fetching during initial and visibility-triggered reloads
- Add hook tests covering visibility refresh, normalization, debounce, and cleanup
2026-04-01 12:37:06 -07:00
gsxdsm
31fbe031e7 feat(FN-674): add multi-project dashboard support
- Add Project Overview page with responsive grid and health status cards
- Add Project Selector dropdown in header for quick context switching
- Add project drill-down navigation with task board/list views
- Add Setup Wizard components for first-run project registration
- Add global activity feed with project attribution and filtering
- Add project-aware task fetching to backend API
- Add project health polling and status badges
- Update ActivityLogModal with project filter and useActivityLog hook
2026-04-01 07:27:29 -07:00
gsxdsm
79ba5013e1 feat(KB-662): add visibility change listener with debouncing to task refresh
- Add visibilitychange listener in useTasks hook to refresh tasks when tab becomes visible
- Implement 1-second debounce to prevent rapid refetching on visibility changes
- Add comprehensive tests for visibility change behavior including debouncing
- Clean up unused variable in SettingsModal from merge conflict resolution
2026-04-01 07:05:49 -07:00
gsxdsm
fa37de1bed feat(KB-648): enable parallel test execution and optimize test performance
- Optimize backup tests using fake timers instead of real timeouts

- Enable parallel file execution in core, engine, CLI, and dashboard packages

- Add inline test helpers to reduce dependencies in dashboard routes tests

- Update executor tests with exact command matching and improved assertions

- Update AGENTS.md with test optimization patterns (fake timers, unique temp dirs)
2026-04-01 06:54:50 -07:00
gsxdsm
c6be1323d1 feat(FN-674): implement multi-project dashboard UX
- Add Project Overview page with responsive grid and health status cards
- Add Project Selector dropdown in header for quick project switching
- Add Setup Wizard for registering new projects with auto-detection
- Implement project drill-down: click project to view its tasks
- Add global activity feed with cross-project activity log
- Add project health monitoring with real-time status polling
- Add deep linking support for tasks via ?task= URL parameter
- Add useTasks hook with project context filtering
- Add ntfy notification deep link to open tasks in dashboard
- Fix terminal error message formatting for agent failures
- Unify comment style across codebase (// instead of /** */)
- Add comprehensive tests for multi-project components
2026-04-01 01:36:24 -07:00
gsxdsm
0855097235 feat(KB-662): add visibility change listener with debouncing
- Add page visibility change detection with debounced state handling

- Implement visibility listener for managing background task behavior

- Add comprehensive tests for debouncing and visibility transitions

- Resolve type conflicts in types.ts and SettingsModal.tsx
2026-03-31 23:32:06 -07:00
gsxdsm
7344a80e40 feat(KB-618): add multi-project support to dashboard
- Add project API methods and types (fetchProjects, registerProject, fetchProjectHealth, etc.)
- Add ProjectCard component with health metrics, status badges, and pause/resume actions
- Add server-side project management routes for multi-project orchestration
- Add ActivityFeed component with grouped entries and project badges
- Add SetupWizard component with 5-step project creation flow
- Fix TypeScript errors in server routes for listProjects and getGlobalConcurrencyState
2026-03-31 23:19:03 -07:00
gsxdsm
954bb16cf4 feat(KB-662): add visibility change listener with debouncing to useTasks hook
- Add visibilitychange event listener to refresh tasks when tab becomes visible
- Implement 1-second debounce to prevent excessive fetch requests
- Add comprehensive tests for visibility change behavior and debouncing
- Gracefully handle fetch errors during visibility changes
2026-03-31 22:50:27 -07:00
gsxdsm
9030eeebd7 fix(KB-613): resolve status update race condition and fix stuck timeout units
- Add timestamp comparison logic in handleUpdated to prevent stale websocket data from overwriting newer task state
- Rename stuck timeout setting from minutes to milliseconds for finer control
- Add comprehensive tests for status update race condition scenarios
- Add changeset for status update race condition fix
2026-03-31 17:37:31 -07:00
gsxdsm
3f77d80096 feat(KB-330): rename internal packages from @kb/* to @fusion/*
- Rename @kb/core, @kb/dashboard, @kb/engine to @fusion/* namespace
- Update all import statements across 143+ files to use new package names
- Update workspace dependencies and root package.json references
- Fix bundler configurations (tsup, vite) for new package names
- Update test files and fix typecheck issues
- Add changeset file documenting the package rename
2026-03-31 13:33:44 -07:00
gsxdsm
304506b237 feat(KB-069): add Archive All Done feature
- Add archiveAllDone method to TaskStore with filtering and batch archive
- Add POST /tasks/archive-all-done API endpoint with tests
- Add useTasks hook support and API function for archiveAllDone
- Add Archive All button to done column header in Board UI
- Wire up onArchiveAllDone through Board component hierarchy
2026-03-30 16:50:34 -07:00
gsxdsm
50cd478f2e feat(KB-129): dashboard performance optimizations
- Fix SSE hook cleanup to prevent memory leaks and stale connections
- Cap agent log memory and optimize batch log processing
- Memoize Board, Column, and TaskCard with custom comparator to reduce re-renders
- Stabilize column task arrays and preserve pagination across live updates
- Add TaskCardBadge component for PR/issue state display
- Remove deprecated GitHub polling code and archive functionality from core store
2026-03-30 11:26:55 -07:00
gsxdsm
61303f1438 docs(KB-041): complete Step 6 — add refine feature to README and create changeset 2026-03-29 21:05:19 -07:00
gsxdsm
37afb24d60 feat(KB-034): add task archive/unarchive functionality
- Add 'archived' column to task store with archiveTask and unarchiveTask methods
- Add CLI commands: kb task archive <id> and kb task unarchive <id>
- Add pi extension tools for archive and unarchive operations
- Add dashboard API endpoints POST /api/tasks/:id/archive and /unarchive
- Add Archived column to board UI with archive/unarchive buttons
- Prevent drag-drop into archived column, add visual distinction
- Include duplicateTask from concurrent branch in merge resolution
2026-03-29 20:03:43 -07:00
gsxdsm
6c151b6591 feat(KB-051): add duplicate task button in task detail modal
- Add duplicateTask action to useTasks hook for creating task copies

- Add Duplicate button to TaskDetailModal with visual styling

- Wire up duplicateTask action through App.tsx task handlers

- Add comprehensive tests for duplicate button functionality

- Include changeset for the new duplicate task feature
2026-03-29 19:56:07 -07:00
gsxdsm
3b71d032a6 feat(KB-048): add collapsible list sections to dashboard
- Add section expansion state management with localStorage persistence
- Update section headers with chevron toggle controls
- Implement conditional task row rendering based on section state
- Add Expand All / Collapse All toolbar controls
- Add CSS styles for chevron rotation animation and section headers
- Add comprehensive tests for collapsible section behavior
2026-03-29 19:51:41 -07:00
Dustin Byrne
c802108a02 refactor(HAI-116): rename kb to hai across all packages, CLI, and docs
- Rename npm packages from @kb/* to @hai/* and update all workspace references
- Rename CLI binary from kb to hai and config directory from .kb to .hai
- Update dashboard UI branding, titles, and references from kb to hai
- Update all test files, CI workflows, and documentation to reflect new naming
- Run comprehensive grep verification to ensure no stale kb references remain
2026-03-26 22:44:11 -04:00
Dustin Byrne
35177f448f feat(HAI-055): add failed task status handling with retry support
- Set task status to 'failed' on execution failure in engine executor
- Add failed indicator styling on TaskCard component
- Add POST /tasks/:id/retry API endpoint and client function
- Add retry button in TaskDetailModal for failed tasks
- Add tests for failed indicator, retry endpoint, and modal behavior
2026-03-25 23:50:11 -04:00
Dustin Byrne
918941a555 feat: merge HAI-002 React dashboard + add merge flow 2026-03-25 18:38:34 -04:00
Dustin Byrne
57a8015ee3 feat(HAI-002): implement shared hooks and API layer 2026-03-25 18:25:13 -04:00