Commit Graph

357 Commits

Author SHA1 Message Date
gsxdsm
34c11a7078 feat(FN-1259): add review handoff mechanism for user assignment
- Add assigneeUserId field to Task type and SQLite schema for human assignment
- Add reviewHandoffPolicy setting to control automatic handoff behavior
- Implement handoff detection in executor: detect user assignment during review and auto-transition task
- Add dashboard API routes for user assignment, handoff queries, and completion
- Add frontend API functions: getHandoffTask, assignTaskToUser, completeHandoff
- Add comprehensive tests for store methods, API routes, and executor handoff logic
- Update memory documentation with review handoff pattern
2026-04-09 21:06:19 -07:00
gsxdsm
0c845b97bc fix: force-requeue stuck task when hung subprocess blocks executor unwind
When a stuck task's session is disposed but an in-flight bash subprocess
keeps running, the executor's Promise never resolves, so the requeue
finally block never fires and the task stays stranded in-progress
indefinitely (observed with FN-1269).

Add a 60s safety-net timer in markStuckAborted: if the task is still in
executing after the grace period, force-requeue it directly by clearing
the worktree, setting status=stuck-killed, moving to todo, and removing
it from the executing set so the scheduler can re-dispatch normally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 20:12:09 -07:00
gsxdsm
7bd98d888c feat(FN-1429): enforce always-green test-suite instructions for executor agents
- Add explicit always-green test suite instructions to executor agent prompts
- Update executor to enforce test-suite validation before task completion
- Add tests for agent prompt generation and executor behavior
- Ensure test failures block merge-ready state rather than allowing broken builds
2026-04-09 19:33:44 -07:00
gsxdsm
db0d5c8dc9 feat(FN-1133): add plugin hot-reload support
- Add PluginLoader hot-load/unload with watch mode, auto-recovery, and staged loading
- Add PluginRunner reactive integration with executor dynamic tools registration
- Add dashboard reload endpoint (POST /api/plugins/reload) and PluginManager UI
- Add comprehensive tests for plugin-hot-reload (core) and plugin-runner (engine)
- Update plugin authoring docs and add memory notes
- Add changeset for @gsxdsm/fusion minor release
2026-04-09 19:15:53 -07:00
gsxdsm
ecb5baeea5 feat(FN-1113): complete Step 2 — executor integration with PluginRunner 2026-04-09 18:33:46 -07:00
gsxdsm
c9eacbfdf4 test: fix assertions broken by runContext propagation
store.logEntry, assignTask, and checkoutTask now receive an extra
runContext argument. Updated test assertions in executor.test.ts,
agent-heartbeat.test.ts, and restart.integration.test.ts to match
the current call signatures using expect.objectContaining where
appropriate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 18:31:54 -07:00
gsxdsm
c36b6d1f53 fix: use canonical task ID in stuck-task-detector for step-session mode
In step-session mode each step is registered with StuckTaskDetector
under a compound key (e.g. "FN-1452-step-1") rather than the bare
task ID. When stuck detection fired, event.taskId was that compound
key, breaking three things simultaneously:

1. beforeRequeue("FN-1452-step-1") → store.getTask() threw (no such
   task) → stuckKillCount never incremented on the real task.

2. markStuckAborted("FN-1452-step-1") → activeStepExecutors.get()
   returned undefined (keyed by "FN-1452") → terminateAllSessions()
   never called, other step sessions kept running.

3. stuckAborted.set("FN-1452-step-1") → executor checks
   stuckAborted.has("FN-1452") → miss → stuckRequeue never set
   → task never moved to todo.

Fix: add a canonicalTaskId field to TrackedTask (defaults to the
tracking key for single-session mode where they are identical).
StepSessionExecutor now passes taskDetail.id as the third arg to
trackTask(). killAndRetry() uses entry.canonicalTaskId for all
external callbacks so they always resolve to the real task ID.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 18:16:55 -07:00
gsxdsm
b682898caf feat(FN-1454): improve mission autopilot and stale recovery
- Unify slice activation and auto-triage semantics for mission progression
- Align engine progression with stale recovery logic for active missions
- Fix scheduler delegation check to use feature.missionId instead of deprecated field
- Add integration tests for stale mission recovery scenarios
- Fix mission API recovery gaps for active missions (activate on first non-done slice)
- Update README.md autopilot documentation section
2026-04-09 18:10:29 -07:00
gsxdsm
daabb51e71 feat(FN-1399): add background memory summarization after task completion
- Add MemoryInsights class in @fusion/core for AI-powered memory audit generation
- Add post-run hook to CronRunner for triggering memory summarization after scheduled tasks
- Wire memory background processing in both dashboard and serve commands
- Add memoryAuditEnabled and memoryAuditSchedule settings for configurable automation
- Fix startup ordering: sync automation before cronRunner.start() to prevent race conditions
- Add comprehensive tests for memory-insights and dashboard/serve integration
- Update contributing.md and settings-reference.md with documentation
2026-04-09 16:14:44 -07:00
gsxdsm
8ba375549c feat(FN-1453): fix mission autopilot progression and state refresh
- Fix mission autopilot slice activation when tasks complete
- Fix state refresh in MissionManager to properly reflect autopilot status
- Fix scheduler to correctly trigger autopilot progression events
- Add unit tests for mission store autopilot state transitions
- Add component tests for MissionManager autopilot toggle and state display
- Add e2e tests for mission autopilot lifecycle (enable → task completion → slice progression)
- Update documentation with autopilot state machine details
2026-04-09 16:12:58 -07:00
gsxdsm
a1e5cbce2b fix(FN-1384): increase timeouts for CI-slow agent store tests
- Increase heartbeat test timeout from 150ms to 250ms for CI environments
- Increase in-process-runtime test timeouts to handle slower CI execution
- Prevents flaky test failures in slow CI runners
2026-04-09 14:54:58 -07:00
gsxdsm
7d484dd972 feat(FN-1257): add runContext audit trail for task mutations
- Add RunMutationContext type to track which agent run caused a mutation
- Thread runContext through TaskStore.logEntry, addComment, addSteeringComment, and pauseTask
- Propagate runContext from HeartbeatMonitor.executeHeartbeat to task store operations
- Propagate runContext from TaskExecutor.execute to task store operations
- Add GET /api/agents/:id/runs/:runId/mutations endpoint to query mutations by runId
- Add createTaskLogToolWithContext for heartbeat tools with run context support
- Add comprehensive tests for RunMutationContext across store and heartbeat modules
- Update memory.md with RunMutationContext usage convention
2026-04-09 13:59:43 -07:00
gsxdsm
e26321790c refactor(FN-1353): simplify mission autopilot to single toggle
- Deprecate autoAdvance field in favor of autopilotEnabled as the sole control
- Remove autoAdvance guard logic from MissionAutopilot engine class
- Simplify MissionManager UI to use single autopilot toggle with visual state indicator
- Update MissionAutopilot tests to use autopilotEnabled instead of autoAdvance
- Update MissionManager component tests for simplified UI
- Update AGENTS.md documentation to reflect the simplified autopilot model
2026-04-09 13:45:19 -07:00
gsxdsm
008f664183 feat(FN-1224): add peer gossip protocol for mesh network synchronization
- Add peer exchange types (MeshSyncState, PeerExchangeMessage, PeerGossipConfig) to core types
- Add peer merge and sync methods to CentralCore (mergeProject, syncWithPeer, getMeshState)
- Add mesh sync API endpoints (GET /api/mesh/state, POST /api/mesh/sync)
- Implement PeerExchangeService background gossip engine for periodic peer synchronization
- Add comprehensive tests for CentralCore mesh methods and PeerExchangeService
- Update memory docs with peer gossip protocol documentation
2026-04-09 13:22:29 -07:00
gsxdsm
7ab96cc876 feat(FN-1381): add Send Back dropdown for in-progress tasks
- Add Send Back dropdown to TaskCard showing for in-progress tasks with available target columns
- Thread onMoveTask prop through Column component to BoardView
- Terminate agent sessions when tasks move away from in-progress column
- Add executor tests for move-away session termination
- Add TaskCard send-back UI tests with dropdown visibility and interaction verification
2026-04-09 13:00:37 -07:00
gsxdsm
ced3ad3be6 fix(FN-1187): integration fixes for mission health and type updates
- Add /missions/health endpoint handling to MissionManager test mocks
- Add listMissionsWithSummaries to mission-e2e test mock
- Add planState to Slice type and mock factories
- Add stuckKillCount to retry task test assertions
- Update log message for stuck-killed retry
2026-04-09 12:21:51 -07:00
gsxdsm
6328c18c9c feat(FN-1373): add mission feature reconciliation on startup
- Add reconcileAllMissionFeatures() method to sync task status with mission features
- Refresh selected mission detail when feature:updated SSE event fires
- Add unit tests for reconcileAllMissionFeatures and SSE handler
- Fix async getTask call in reconcileAllMissionFeatures (keep await)
2026-04-09 12:06:10 -07:00
gsxdsm
27dce00c17 fix(FN-1228): Update tests to match spec requirements
- DELETE /api/nodes/:id now returns 204 No Content
- GET /api/nodes/:id/metrics returns systemMetrics from node
- Added test for GET /api/mesh/state endpoint
2026-04-09 11:55:17 -07:00
gsxdsm
5e38eace77 feat(FN-1228): complete Step 1 — Backend API Routes modifications
- Modified POST /api/nodes to make type optional (defaults to 'remote')
- Changed DELETE /api/nodes/:id to return 204 No Content
- Updated GET /api/nodes/:id/metrics to return SystemMetrics from node.systemMetrics
- Added GET /api/mesh/state route for full mesh topology state
2026-04-09 11:51:03 -07:00
gsxdsm
97c6edd105 feat(FN-1373): add tests for reconcileAllMissionFeatures and feature:updated SSE handler 2026-04-09 11:34:56 -07:00
gsxdsm
7d1a16ffcd feat(FN-1373): add reconcileAllMissionFeatures() for startup reconciliation 2026-04-09 11:28:56 -07:00
gsxdsm
ac07be790b feat(FN-1348): export HeartbeatMonitor and HeartbeatTriggerScheduler from @fusion/engine 2026-04-09 09:42:21 -07:00
gsxdsm
4d1a14f49e fix: use null instead of undefined to clear worktree/branch in executor updateTask calls
The store's updateTask treats `undefined` as "no change" and `null` as
"clear field". Six places in executor.ts passed `undefined` when intending
to clear worktree/branch, leaving stale references that caused tasks to
get stuck in in-progress with no active session after stuck-kills, pauses,
and transient error retries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:43:14 -07:00
gsxdsm
a0606884cb fix: recover orphaned in-progress tasks even when worktree exists on disk
Previously, recoverOrphanedExecutions() skipped tasks whose worktree
directory still existed, assuming an active session. After engine crashes
where resumeOrphaned() failed, these tasks were stuck forever. Now uses
a tiered grace period: 60s for missing worktrees, 5min for existing ones
to avoid racing with startup recovery.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 07:21:14 -07:00
gsxdsm
7a9148d25d perf: speed up tests with parallel execution and fix type errors
- Add isolate: true to vitest configs for safe parallel test execution
- Simplify engine test script from 7 sequential runs to single parallel run
- Fix TypeScript type errors in Column, Board, WorktreeGroup, and App components
- Fix board-mobile test to match current TaskCard tap behavior
- Relax App deep-link test to handle React Strict Mode behavior
2026-04-08 23:53:14 -07:00
gsxdsm
6250cf4efb fix(FN-1256): auto-recover tasks with all steps done but no task_done call
When context overflow or compaction causes an agent to lose awareness of
the task_done tool, the executor now checks if all steps are complete
before failing — treating it as an implicit task_done. Also adds
self-healing recovery for tasks that already slipped through as
misclassified failures in in-review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 22:12:53 -07:00
gsxdsm
f2829c7634 fix(FN-1290): recover orphaned stuck tasks 2026-04-08 20:22:58 -07:00
gsxdsm
a05cfd4b55 feat(FN-1255): add comment-aware heartbeat wakes and blocked-state dedup
- Add BlockedStateSnapshot typing/export and AgentStore persistence APIs for last blocked heartbeat state
- Deduplicate blocked-task heartbeat comments using blockedBy + context hash, and clear blocked snapshots when tasks are no longer blocked
- Thread triggeringCommentIds/triggeringCommentType through heartbeat execution, wake context, scheduler assignment triggers, and runtime wiring
- Trigger immediate heartbeat runs from task/steering comment routes for assigned immediate-response agents, with validation for comment wake fields on /api/agents/:id/runs
- Expand core, engine, and dashboard tests to cover blocked dedup logic, comment-triggered wakes, validation, and skip scenarios
2026-04-08 18:38:06 -07:00
gsxdsm
61117c8a2b feat(FN-1254): add inbox-lite task selection for heartbeat agents
- Add InboxTask typing and TaskStore.selectNextTaskForAgent() with priority ordering, dependency checks, paused filtering, and FIFO selection
- Wire heartbeat execution to auto-select and assign inbox work when no task is set, with optional checkout attempts and graceful conflict fallback
- Add POST /api/agents/:id/inbox to expose next-task selection details (task, priority, reason) and return task:null when no work is available
- Expand core, engine, and dashboard tests to cover selection priorities, heartbeat precedence/metadata, checkout-conflict handling, and route behavior with type-safe mocks
2026-04-08 17:57:16 -07:00
gsxdsm
2911fe7d44 feat(FN-1253): implement task checkout leasing end-to-end
- Add checkout lease types and conflict error exports, plus DB schema v20 migration for checkedOutBy/checkedOutAt
- Persist checkout lease fields in TaskStore and add AgentStore checkout/release/force-release/get-holder operations
- Add dashboard checkout API routes for acquire/release/force-release/status with explicit 409 conflict and 403 holder enforcement
- Enforce checkout ownership in heartbeat execution with graceful checkout_conflict exits when another agent holds the lease
- Expand core and dashboard test coverage for schema, store behavior, API routes, and leasing workflows, and document leasing behavior in AGENTS.md
2026-04-08 17:01:44 -07:00
gsxdsm
f60c06be79 feat(FN-1298): add stop-agent-run flow across engine and dashboard
- Add heartbeat stopRun support in the engine and wire it into the dashboard server lifecycle
- Add an agent run stop API route and client helper with route-level test coverage
- Add stop controls in AgentDetailView and AgentRunHistory with updated UI tests
- Add a changeset for @gsxdsm/fusion documenting the new stop run feature
2026-04-08 16:17:34 -07:00
gsxdsm
8aa77c8b77 refactor(FN-1288): consolidate GitHub remote parsing in @fusion/core
- Replace dashboard calls to local getCurrentGitHubRepo helpers with getCurrentRepo from @fusion/core
- Update engine scheduler PR-monitor startup paths to use shared core repo resolution
- Remove duplicated remote parsing implementations from dashboard and engine packages
- Mark gap analysis finding 6.3 as resolved after centralizing parsing logic
2026-04-08 15:53:38 -07:00
gsxdsm
1d57fb4b50 refactor(FN-1317): rename remaining kb references to fn
- Update executor, triage, and merger prompt strings to identify the product as "fn"
- Align branch/worktree documentation examples with fusion/fn-* naming conventions
- Rename dashboard websocket attachment guard from __kbWebSocketsAttached to __fnWebSocketsAttached
- Refresh engine tests, dashboard utility comments, and TUI header text to remove stale kb wording
2026-04-08 14:38:36 -07:00
gsxdsm
8354a86a82 feat(FN-1196): support API-key providers in dashboard auth flow
- Wrap dashboard auth storage with API-key provider helpers derived from model registry providers
- Normalize provider display names and bridge set/clear/has API-key operations to AuthStorage credentials
- Expand route and onboarding tests for mixed OAuth/API-key states and API-key-authenticated setup paths
- Stabilize assignment-trigger heartbeat timing test by replacing fixed delays with waitFor assertions
2026-04-08 13:54:30 -07:00
gsxdsm
b0b3ca7e4b fix(FN-1300): capture agent run output in heartbeat and step sessions
- Wire AgentLogger into heartbeat runs, including tool/text callbacks and stdout excerpts on run records
- Persist heartbeat context taskId snapshots earlier and ensure logger flushes on success and failure paths
- Pass TaskStore into StepSessionExecutor and flush per-attempt agent logs in finally cleanup
- Expand heartbeat and step-session tests to verify log persistence and flush behavior, and add a patch changeset for @gsxdsm/fusion
2026-04-08 12:46:24 -07:00
gsxdsm
abbb4eab11 feat(FN-1272): add task document tools for triage and executor
- Add task_document_write and task_document_read factories with schemas, revision-aware responses, and error handling in agent-tools
- Wire document tools into executor and triage sessions and update prompts to persist and reuse planning artifacts across runs
- Export document tool factories and parameter schemas from engine public entrypoints while keeping executor re-export compatibility
- Add comprehensive tests covering write/read success paths, empty/not-found cases, and store failure handling
2026-04-08 12:27:11 -07:00
gsxdsm
105d224b7f feat(FN-1264): enforce heartbeat budget governance for trigger execution
- Gate heartbeat runs in executeHeartbeat when agents are over budget and skip timer runs above threshold
- Pause agents with pauseReason "budget-exhausted" when run usage pushes them over budget
- Budget-gate assignment and timer triggers in HeartbeatTriggerScheduler and include budgetStatus in assignment wake context
- Expand agent-heartbeat test coverage for budget exhaustion, threshold behavior, pause transitions, and trigger gating
2026-04-08 12:03:38 -07:00
gsxdsm
9ac5b19646 fix(FN-1285): harden async listener error guards
- Wrap TaskExecutor task:updated async listener logic in a top-level guard and log uncaught listener failures
- Add explicit catch handling for ProjectManager activity logging and dashboard stuck-detector settings-triggered checkNow calls
- Document async EventEmitter guard conventions in scheduler and hybrid executor listener wiring
- Add regression tests for executor and dashboard listener guards and include a patch changeset for @gsxdsm/fusion
2026-04-08 11:49:33 -07:00
gsxdsm
20f6a4998d fix(FN-1284): move terminal execution failures to in-review
- Move single-session and step-session executor failure paths to in-review after marking tasks failed
- Route exhausted transient recovery retries to in-review instead of leaving tasks outside review flow
- Move stuck-kill budget exhaustion failures in self-healing to in-review and update failure log wording
- Add regression tests in executor and self-healing suites to verify in-review transitions on these failure states
2026-04-08 11:01:04 -07:00
gsxdsm
4c7db73ffe test(FN-1279): expand child-process runtime and worker coverage
- Refactor ChildProcessRuntime tests with typed fork/IPC mocks and deterministic command-response helpers
- Add lifecycle and resilience assertions for startup failures, stop idempotency, heartbeat checks, and exponential restart backoff
- Verify IPC event forwarding, metrics fallback behavior, and not-accessible runtime API guards
- Add child-process-worker tests covering START/STOP/GET_STATUS/GET_METRICS handlers, runtime event bridging, and SIGTERM/SIGINT shutdown paths
2026-04-08 10:17:44 -07:00
gsxdsm
bfc3c80841 feat(FN-1218): harden mission autopilot with self-healing recovery
- Add mission self-healing project settings for stale activation thresholds, task retry budgets, and mission health-check intervals
- Extend MissionAutopilot with failed-task retry handling, blocked feature escalation, stale activating mission recovery, and periodic feature/task consistency reconciliation
- Wire autopilot failure and recovery flows through Scheduler and InProcessRuntime, including startup recovery for watched missions after crashes
- Add blocked feature status support in core mission types and CLI mission status labels
- Expand mission-autopilot coverage for retry flows, stale/startup recovery, health checks, and regression scenarios, and include a patch changeset for @gsxdsm/fusion
2026-04-08 10:01:06 -07:00
gsxdsm
185ee2e2f5 refactor(FN-1251): harden child runtime timer lifecycle
- Add generation tracking plus dedicated SIGKILL and restart timer fields in ChildProcessRuntime
- Guard delayed kill/restart callbacks so stale generations and stopping runtimes are ignored
- Clear pending lifecycle timers during stop and before rescheduling to prevent stacked callbacks
- Expand child-process runtime tests to cover timer cancellation, generation safety, and spawn generation increments
2026-04-08 09:56:28 -07:00
gsxdsm
2a76761ce8 fix(FN-1249): degrade failed wave worktrees to sequential fallback
- Track per-step worktree creation failures in step-session execution waves
- Split wave execution into parallel and sequential phases so failed-worktree steps run on the primary worktree
- Cherry-pick only successful parallel-step commits and return consistently ordered results
- Add comprehensive tests covering partial/all worktree creation failures, fallback ordering, and cleanup behavior
2026-04-08 09:47:26 -07:00
gsxdsm
468b0070c5 fix: include remaining local updates 2026-04-08 08:57:19 -07:00
gsxdsm
c152517d1e fix: recover approved triage tasks stuck specifying 2026-04-08 08:57:09 -07:00
gsxdsm
2a923ea1a0 feat(FN-1217): add mission observability events and APIs
- Add mission observability types and core exports for mission health snapshots and event records
- Extend SQLite schema and MissionStore with mission_events persistence plus health and staleness query helpers
- Emit mission start and autopilot lifecycle events from MissionAutopilot for richer runtime telemetry
- Add dashboard mission observability routes and end-to-end coverage for mission events and health APIs
- Expand unit tests across core and engine and include a changeset for mission observability updates
2026-04-08 08:22:33 -07:00
gsxdsm
14c0041e61 feat(FN-1185): inject agent rating feedback into runtime instructions
- Extend agent instruction resolution to append a Performance Feedback section with average score, trend, category breakdown, and recent comments when ratings exist
- Add rating-aware instruction resolution with graceful fallback when no store is configured, agent IDs are missing, or rating lookup fails
- Wire executor custom instruction loading to fetch agent rating summaries and include them in resolved instructions
- Expand agent-instructions tests to cover feedback formatting, trend indicators, comment limits, and fallback/error paths
2026-04-08 06:18:47 -07:00
gsxdsm
a7eb95909a feat(FN-1182): add agent reflection service and executor integration
- Extend project settings with reflection enablement, interval, and post-task trigger defaults
- Implement AgentReflectionService to gather agent/task history, generate structured AI reflections, and persist reflection metrics
- Add reflect_on_performance tool factory with optional focus area input and human-readable reflection output
- Wire reflection tool into TaskExecutor only when reflection is enabled and the task has an assigned agent
- Add comprehensive reflection service/tool tests and stabilize agent-store org tree expectation ordering
2026-04-08 05:55:36 -07:00
gsxdsm
7d7c7efbd9 feat(FN-1127): add awaiting-approval ntfy notifications
- Extend ntfy event types and default ntfyEvents to include awaiting-approval
- Send high-priority "Plan needs approval" notifications for awaiting-approval task updates with deep-link support
- Add Notifications settings checkbox handling for awaiting-approval event selection in Settings modal
- Expand notifier and settings modal tests for awaiting-approval defaults, toggles, filtering, and deduplication
- Update AGENTS.md ntfy documentation and sample config to include the new event
2026-04-08 02:00:39 -07:00
gsxdsm
d30419d70b feat(FN-1191): hot-swap active executor sessions on model changes
- Show resolved default executor, validator, and planning models in the task Model tab
- Pass merged settings into the Model tab from TaskDetailModal so default badges reflect effective runtime resolution
- Hot-swap active single-session executor models when task overrides change, including fallback to project defaults when overrides are cleared
- Add dashboard and executor tests for default model display, hot-swap behavior, fallback logic, and failure logging
- Document hot-swap behavior and limitations in AGENTS.md and add a patch changeset for @gsxdsm/fusion
2026-04-08 01:18:01 -07:00