Commit Graph

306 Commits

Author SHA1 Message Date
gsxdsm
438aff290a feat(FN-1079): add remote node runtime orchestration
- Add RemoteNodeClient and RemoteNodeRuntime with comprehensive lifecycle, status, and metrics test coverage
- Route projects by node assignment in ProjectManager and integrate remote runtime handling in HybridExecutor
- Introduce NodeHealthMonitor and wire diagnostic logging/export updates for remote node health tracking
- Harden remote runtime shutdown checks and type-safety paths surfaced during review feedback
2026-04-07 22:56:09 -07:00
gsxdsm
5f7f351a8a fix(triage): clear specifying status on pause/stuck and add StuckTaskDetector support
- Fix pause-abort handler using updateTask({status: undefined}) which was a
  no-op, leaving tasks stuck in 'specifying' forever after a pause interrupts
  a session post-APPROVE. Changed to status: null to actually clear the field.
- Apply same fix to transient-error retry and general error catch paths.
- Wire StuckTaskDetector into TriageProcessor: trackTask/untrackTask/recordActivity
  on session lifecycle, markStuckAborted to prevent stuck kills from being
  reported as errors, and clear status to null on stuck-kill for next-poll retry.
- Update dashboard.ts to pass stuckTaskDetector to TriageProcessor and call
  triageRef.current?.markStuckAborted in the shared onStuck callback.
- Add 3 tests covering pause-abort status clearing and stuck detector wiring.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 21:51:09 -07:00
gsxdsm
d653391d30 test(FN-1084): expand mission workflow automated test coverage
- Add dashboard mission e2e coverage for autopilot endpoint flows and mission summary behavior
- Add comprehensive mission interview tests for planning, step progression, and output handling
- Extend CLI mission command tests for add/link workflows and argument validation paths
- Strengthen engine mission scheduler assertions around activation sequencing and state transitions
- Add core mission store tests to validate mission persistence and related edge cases
2026-04-07 19:06:18 -07:00
gsxdsm
87d21e2d60 feat(FN-1065): add immediate message response mode for heartbeats
- Add MessageResponseMode and messageResponseMode runtime config to core agent heartbeat types and exports
- Extend MessageStore with an onMessageToAgent hook plus runtime hook updates for agent-directed messages
- Wire HeartbeatMonitor to wake agents on incoming messages when messageResponseMode is immediate and state is eligible
- Update AgentDetailView with a Message Response Mode setting, validation, and runtimeConfig persistence
- Expand core and engine tests to cover hook behavior, wake-on-message triggering, and start/stop hook lifecycle
2026-04-07 18:43:16 -07:00
gsxdsm
fb7edec4d5 feat(FN-1061): add heartbeat trigger scheduling for agent wakeup
- Add HeartbeatTriggerScheduler class with timer, assignment, and on-demand trigger types
- Wire timer-based periodic wakeups using per-agent heartbeatIntervalMs config
- Add agent:assigned event in AgentStore for assignment-triggered wakeups
- Enhance POST /api/agents/:id/runs with WakeContext and 409 conflict on concurrent runs
- Integrate trigger scheduler into InProcessRuntime lifecycle (start/stop)
- Add enabled field to AgentHeartbeatConfig for per-agent trigger control
- Update AGENTS.md with heartbeat trigger scheduling documentation
2026-04-07 15:55:09 -07:00
gsxdsm
335a20e1bd feat(FN-1050): add per-agent custom instructions support
- Add instructionsPath and instructionsText fields to Agent type and AgentStore
- Create agent-instructions resolver module in engine with priority-based resolution
- Wire custom instructions into executor, triage, reviewer, and merger agents
- Add PATCH /agents/:id/instructions API endpoint with file and text support
- Add instructions editor UI to dashboard agent detail config tab
- Add comprehensive tests for instructions resolver and AgentStore integration
- Add changeset for published package bump
2026-04-07 15:17:08 -07:00
gsxdsm
d25926fcbb fix(FN-1067): fix 3 pre-existing executor test failures
- Fix child agent session mock to use never-resolving prompt so spawned child count stays accurate during limit checks
- Remove flaky spawnedAgents assertion in terminateChildAgent test (cleanup is done by terminateAllChildren)
- Add missing prompt mock to runSpawnedChild dispose test session
2026-04-07 14:33:41 -07:00
gsxdsm
c68bf1f3f8 fix(FN-1068): switch vitest pool from vmThreads to threads to fix node:sqlite error
- Change vitest pool from vmThreads to threads in engine package
- Resolves node:sqlite compatibility issue caused by vmThreads isolation
- vmThreads creates separate VM contexts incompatible with native SQLite module
2026-04-07 14:20:55 -07:00
gsxdsm
5c2c848e1e feat(FN-1063): add per-task thinkingLevel override in executor
- Extract per-task thinkingLevel from task detail, falling back to global defaultThinkingLevel
- Apply override in initial execution, retry session, and spawned agent paths
- Add 3 tests: per-task override, global fallback, explicit 'off' overrides global
2026-04-07 14:12:04 -07:00
gsxdsm
98ccdb94b0 feat(FN-991): add per-task planning model override for triage and dashboard
- Add planningModelProvider/planningModelId fields to task model and API batch-update endpoint
- Wire triage engine to use per-task planning model override with settings hierarchy fallback
- Add planning model selector to TaskDetailModal Model tab
- Add comprehensive tests for triage engine planning model resolution and dashboard API/routes
2026-04-07 13:46:25 -07:00
gsxdsm
a716605747 feat(FN-1062): fix step status tracking and expose step session settings in CLI
- Fix step status not being tracked correctly in executor callbacks (done/skipped were not updated)
- Expose runStepsInNewSessions and maxParallelSteps settings in CLI settings command
- Add AGENTS.md documentation for runStepsInNewSessions and maxParallelSteps settings
- Add changeset for the published CLI package
- Add tests for CLI settings validation and executor step status tracking
2026-04-07 13:41:12 -07:00
gsxdsm
2476c5f6c9 feat(FN-1060): add task creation tracking in heartbeat runs
- Track tasks created during heartbeat runs and clean them up on subsequent heartbeats
- Add heartbeatRunId to correlate tasks created within the same run
- Implement stale heartbeat run cleanup in checkMissedHeartbeats
- Add comprehensive test suite (276 lines) covering run tracking, cleanup, and edge cases
- Extend HeartbeatMonitor with task creation metadata and run lifecycle management
2026-04-07 13:19:20 -07:00
gsxdsm
6f91753270 feat(FN-1058): add heartbeat execution with agent tool support
- Extract shared agent tools (bash, read, write, edit) from executor into agent-tools.ts for reuse
- Implement heartbeat execution in HeartbeatMonitor with configurable interval and task_done support
- Wire heartbeat execution into InProcessRuntime lifecycle (start/stop)
- Add comprehensive test suite covering execution, timeouts, concurrency, and error handling
- Add heartbeat-related log constants to logger
2026-04-07 13:02:05 -07:00
gsxdsm
5646a03d83 feat(FN-1048): add configurable agent prompts with built-in templates
- Add AgentPromptTemplate and AgentPromptsConfig types to ProjectSettings
- Create agent-prompts module with 7 built-in prompt templates and role resolver
- Wire engine agents (executor, reviewer, merger, triage) to use resolved prompts
- Add 25 test cases covering template resolution, role assignment, and validation
- Export new types from @fusion/core package
- Document agentPrompts configuration and built-in templates in AGENTS.md
2026-04-07 12:31:28 -07:00
gsxdsm
acae0e7aa0 feat(FN-1049): add per-agent heartbeat configuration via runtimeConfig
- Define AgentHeartbeatConfig interface in core types (heartbeatIntervalMs, heartbeatTimeoutMs, maxConcurrentRuns)
- Update HeartbeatMonitor to resolve per-agent config from AgentStore with validated min/max clamping
- Wire AgentStore into HeartbeatMonitor via InProcessRuntime initialization
- Add heartbeat settings section to dashboard AgentDetailView ConfigTab
- Add PATCH /api/agents/:id endpoint accepting runtimeConfig updates
- Add comprehensive tests for per-agent heartbeat config resolution and validation
- Document per-agent heartbeat configuration in AGENTS.md
2026-04-07 11:50:17 -07:00
gsxdsm
a22676b1d1 feat(FN-1053): add AI prompt executor for cron workflow steps
- Define AiPromptExecutor type and update CronRunner constructor to accept injected executor
- Implement executeAiPromptStep with real agent session execution in worktrees
- Create createAiPromptStepExecutor factory and wire up in dashboard CLI
- Add comprehensive tests for AI prompt step execution (mock agent, errors, output capture)
- Fix mock typing for dashboard test build compatibility
2026-04-07 11:20:48 -07:00
gsxdsm
92b516e5fa feat(FN-1022): add project memory bootstrap with agent integration
- Add project-memory module in @fusion/core with read/write/resolve helpers and upsert-on-store hook
- Bootstrap project memory during task creation (store) with structured task context
- Inject resolved project memory into executor and triage agent system prompts
- Add comprehensive tests for project-memory module, store integration, and agent prompt changes
- Document project memory architecture and usage in README
2026-04-07 00:41:19 -07:00
gsxdsm
05a00c2877 feat(FN-1040): add StepSessionExecutor for parallel step execution and integrate into executor
- Define StepSessionExecutor interfaces and utility types (FN-1039)
- Implement StepSessionExecutor class with parallel wave execution, conflict detection, and retry logic (FN-1039)
- Add comprehensive test suite for StepSessionExecutor (1225 lines) (FN-1039)
- Wire step-session execution branch into TaskExecutor with pause, stuck-kill, and global pause handlers
- Track active step executors per task for lifecycle management and cleanup
- Export StepSessionExecutor and types from engine package index
- Add executor integration tests for step session lifecycle (388 lines)
2026-04-06 22:43:31 -07:00
gsxdsm
ce1ca1af6d feat(FN-1036): add mergeDetails collection and storage in merger
- Add MergeDetails type import and mergeDetails field to TaskStore.updateTask signature
- Store merge details (commitSha, filesChanged, insertions, deletions, mergeCommitMessage, resolution info) after successful squash merge
- Capture best-effort commitSha even when branch is not found (mergeConfirmed: false)
- Add comprehensive tests for store updateTask with mergeDetails and merger detail collection
2026-04-06 21:36:31 -07:00
gsxdsm
d8a6d13392 feat(FN-1039): add StepSessionExecutor for parallel wave-based step execution
- Define StepSessionExecutor interfaces and utility types (StepResult, WavePlan, ConflictInfo)
- Implement StepSessionExecutor class with parallel wave scheduling and conflict detection
- Add determineParallelWaves algorithm grouping steps by dependency waves
- Add executeStep, executeWave, and executeSession lifecycle methods
- Add comprehensive test suite with 1225 lines covering waves, conflicts, retries, and error handling
2026-04-06 21:24:17 -07:00
gsxdsm
facd5c520b feat(FN-1017): enable proactive subtask splitting during triage and review
- Update triage agent to proactively suggest splitting large tasks into subtasks during specification
- Tighten reviewer guidance to flag undersplit tasks that should be broken down further
- Add comprehensive tests for proactive subtask creation in triage (192 lines)
- Add reviewer tests for undersplit task detection (12 lines)
- Update README with documentation on proactive subtask splitting behavior
2026-04-05 23:50:36 -07:00
gsxdsm
b89825054d feat(FN-980): add mission autopilot for autonomous slice progression
- Add MissionAutopilot class with state machine (inactive → watching → activating → completing)
- Add autopilot database schema: autopilotEnabled, autopilotState, lastAutopilotActivityAt columns
- Integrate autopilot with scheduler: handleTaskCompletion() triggers slice activation
- Add API routes: GET/PATCH /missions/:id/autopilot, POST start/stop endpoints
- Add autopilot toggle UI in MissionManager dashboard component
- Add retry logic with exponential backoff (up to 3 attempts) for slice activation
- Add background poll (60s) to detect stale autopilot missions
- Include changeset for @gsxdsm/fusion minor bump
2026-04-05 23:11:28 -07:00
gsxdsm
c336093aad feat(FN-1016): add comment-aware triage generation and stale approval invalidation
- Include user comments as context during AI triage spec generation and spec review
- Invalidate stale spec approvals when new user comments are added after approval
- Add lastApprovedAt tracking to task metadata for approval freshness detection
- Add comprehensive tests for comment-aware triage, review, and stale approval logic
- Add changeset for published package and update README with feature documentation
2026-04-05 23:04:27 -07:00
gsxdsm
bd4322fcd1 feat(FN-1000): add token cap detection for agent task execution
- Add tokenCap to ProjectSettings with tokenCapEnabled flag, default 500K tokens
- Create TokenCapDetector class with usage tracking and cap enforcement
- Wire TokenCapDetector into executor agentWork() to auto-fail tasks exceeding cap
- Add token cap input fields to Settings Modal dashboard UI
- Add comprehensive unit tests for TokenCapDetector (174 lines)
2026-04-05 22:50:03 -07:00
gsxdsm
6ff6e69e60 Fix workflow step execution wiring 2026-04-05 22:28:22 -07:00
gsxdsm
ef3136d601 fix(engine): fall back to provider template for unrecognized model IDs
When a configured primary/fallback model isn't found in the registry,
check if the provider has any known models and construct a model
on-the-fly using that provider as a template (mirroring the pi CLI's
buildFallbackModel logic). This lets any valid provider model ID work
(e.g. any OpenRouter model string) without requiring it to be in the
built-in or custom model list. Only throw if the provider itself is
completely unknown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 22:17:30 -07:00
gsxdsm
e3ad694d7a fix(engine): load custom models.json in createKbAgent
Pass the user's models.json path to ModelRegistry so custom and
non-built-in models (e.g. openrouter/qwen/qwen3.6-plus:free) are
available when resolving the configured primary/fallback model.
The pi CLI was already passing this path; kb was not, causing
'model not found in registry' errors for any model not built-in.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 22:08:52 -07:00
gsxdsm
b21fdc9420 fix(FN-1026): normalize formatResetAt to use calendar-day boundaries
- Fix formatResetAt to compute day difference from calendar midnight boundaries instead of raw millisecond division
- Prevents off-by-one day counts that caused inconsistent formatting near 7-day boundary
- Add comprehensive unit tests for formatResetAt boundary conditions (7-day edge, today, beyond 7 days)
- Fix pre-existing scheduler test assertion to use expect.objectContaining for worktree/baseBranch fields
2026-04-05 21:59:42 -07:00
gsxdsm
9a6592e299 chore: update stuck task handling and dashboard tweaks 2026-04-05 21:36:18 -07:00
gsxdsm
fc47b6eb01 fix: reserve and clear task worktrees correctly 2026-04-05 20:56:58 -07:00
gsxdsm
181ace2b27 fix(FN-1001): fix retry race condition in executor and scheduler
- Executor skips redundant moveTask call on manual retry (was causing race with scheduler)
- Scheduler now triggers scheduling on todo column transitions to pick up retried tasks
- Add tests for retry race condition fix covering both executor and scheduler paths
2026-04-05 19:13:51 -07:00
gsxdsm
9aa02d76ab fix: clear stale failed state on executor resume 2026-04-05 17:59:29 -07:00
gsxdsm
dbe764973c fix(FN-994): add missing steps property to resumeOrphaned test mock
- Add steps array to task mock in resumeOrphaned test case
- Ensures test mock matches expected Task shape with steps property
2026-04-05 17:37:27 -07:00
gsxdsm
8c7fe694b3 fix(FN-993): add safe-navigation for task.description in recoverCompletedTasks
- Add optional chaining (?.) on task.description.slice() to prevent null-reference crash
- Fallback to '(untitled)' when both title and description are absent
- Add changeset for @fusion/engine patch
2026-04-05 17:28:21 -07:00
gsxdsm
0ec1388c65 fix: require green tests build and typecheck across task scope 2026-04-05 17:27:03 -07:00
gsxdsm
c52b874763 fix(FN-985): clear transient fields when archiving and moving tasks to done
- Clear prInfo, issueInfo, and modelPresetId in unarchiveTask to avoid stale badge/model data
- Clear prInfo, issueInfo, and modelPresetId in moveToDone after successful merge
- Add regression tests for transient field clearing in both code paths
- Fix existing tests to use public API instead of private methods
2026-04-05 15:53:48 -07:00
gsxdsm
eb6fbbb42c fix: recover completed tasks stuck in progress 2026-04-05 15:24:32 -07:00
gsxdsm
1b98f167a0 feat(FN-978): add diagnostic logging, semaphore resilience, and executor tests
- Add structured diagnostic logging to executor, stuck-task-detector, and pi.ts with subsystem prefixes
- Add defensive guards to AgentSemaphore (limit minimum 1, invalid limit handling)
- Add comprehensive integration tests for agent execution flow (executor.test.ts)
- Add unit tests for semaphore resilience (concurrency.test.ts) and stuck-task-detector (stuck-task-detector.test.ts)
- Fix TypeScript errors in test task objects and duplicate execution test
- Document engine diagnostic logging points in AGENTS.md
2026-04-05 13:37:21 -07:00
gsxdsm
9dca3724a0 feat(FN-975): add agent spawning support for hierarchical task delegation
- Add spawn settings (maxSpawnedAgentsPerParent, maxSpawnedAgentsGlobal) to ProjectSettings type
- Implement AgentStore access and spawned agent tracking in TaskExecutor
- Add spawn_agent tool with child agent execution in isolated worktrees
- Wire up child termination on parent session end and system prompt generation
- Add comprehensive test suite (554 lines) covering spawning, limits, termination, and error handling
- Document agent spawning architecture, IPC protocol, and usage in AGENTS.md
2026-04-05 11:53:35 -07:00
gsxdsm
e0d773f60d feat(FN-972): auto-triage features when slice activated with autoAdvance
- When a slice is activated and has autoAdvance enabled, automatically triage all features in that slice
- Add auto-triage logic to mission-store activateSlice method
- Add comprehensive tests for auto-triage behavior covering edge cases
- Fix module import paths across mission-related files (mission.ts, extension.ts, mission-integration.test.ts, mission-routes.ts, scheduler.ts)
2026-04-05 11:04:16 -07:00
gsxdsm
80fc988410 fix(FN-962): clean up worktrees on retry and fix branch suffix mismatch
When tasks fail and retry, the old worktree lingered on disk and the new
worktree got a random name causing worktrunk to report it as unassigned.
Now: retry clears worktree/branch fields, removes old worktree from disk,
and createWorktree returns the actual branch name (including -2 suffixes)
so task.branch always matches reality.

Also fixes pre-existing test failures: Terminal WebSocket mock sessions
missing lastActivityAt, and TerminalModal keyboard overlap tests leaking
cached _initialViewportHeight between tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 10:09:14 -07:00
gsxdsm
9b1fb9860d feat(FN-960): strengthen undersplit detection and subtask guidance in triage and reviewer
- Strengthen TRIAGE_SYSTEM_PROMPT with explicit subtask guidance rules and examples
- Strengthen buildSpecificationPrompt to reinforce proper subtask decomposition
- Add undersplit detection to spec reviewer to flag oversized or overly broad tasks
- Add test assertions for improved prompts covering undersplit detection and subtask guidance
2026-04-05 00:35:03 -07:00
gsxdsm
e5391a05a5 feat(FN-957): filter silent transient errors from executor and triage logs
- Add isSilentTransientError() function to detect noisy transient errors (ETIMEDOUT, ENOTFOUND, ECONNRESET, etc.)
- Filter silent transient errors from executor error logging to reduce noise
- Filter silent transient errors from triage error logging to reduce noise
- Add unit tests for isSilentTransientError covering all error patterns
2026-04-04 22:03:42 -07:00
gsxdsm
e8e77ec234 feat(FN-955): add 'request was aborted' to transient error patterns
- Add /request was aborted/i pattern to TRANSIENT_ERROR_PATTERNS for AI provider abort errors
- Cover case-insensitive matching (e.g., Anthropic streaming aborts)
- Add tests for positive matches, negative cases (bare 'abort'), and classifyError behavior
- Ensure abort errors classify as 'transient', not 'usage-limit'
2026-04-04 21:36:07 -07:00
gsxdsm
2516463901 feat(FN-902): add deterministic createAgentWithTaskDone helper and testing docs
- Add createAgentWithTaskDone helper for deterministic test patterns with task_done tool
- Rewrite restart integration tests to use the new helper instead of verbose mock setup
- Document task_done testing pattern in README with code example
- Reduce test boilerplate by encapsulating agent creation and tool stubbing
2026-04-04 21:07:14 -07:00
gsxdsm
ee8d85471d fix(FN-891): stabilize flaky restart integration test assertions
- Replace exact createKbAgent call-count assertions with behavioral checks (toHaveBeenCalled, toBeGreaterThanOrEqual) to avoid flakiness from retry-with-new-session internals
- Add resume log entry assertions as stable behavioral guarantees for restart semantics
- Add testing guidance section to README for writing deterministic executor tests
2026-04-04 20:47:03 -07:00
gsxdsm
deb2dcc683 test(FN-889): add regression tests for merger import chain and runtime export contract
- Add integration tests verifying export/import contract for merger restart scenarios
- Enhance regression coverage for the full merger import chain
- Add developer note in README on keeping runtime exports in sync with dist artifacts
- All tests passing, build verified
2026-04-04 20:19:13 -07:00
gsxdsm
4c2be10d73 feat(FN-882): add loop detection recovery with compact-and-resume
- Add ContextLimitDetector to detect agent loops via repeated tool call patterns
- Implement compact-and-resume strategy: summarize conversation and restart agent from current step
- Add loop recovery to StuckTaskDetector with configurable attempt tracking and retry limits
- Extend executor with automatic loop recovery on context limit detection
- Add loop recovery support to pi executor with same compact-and-resume pattern
- Add comprehensive tests for context-limit-detector, stuck-task-detector loop detection, executor, and pi recovery
- Add changeset for patch bump to @gsxdsm/fusion
- Update README with loop detection and recovery documentation
2026-04-04 19:47:48 -07:00
gsxdsm
7b0e2a9c4c feat(FN-946): add orphaned branch scanning and automatic cleanup
- Add scanOrphanedBranches utility to worktree-pool for detecting fusion/* branches with no matching task
- Add cleanupOrphanedBranches to SelfHealingManager with dry-run support and task re-registration
- Wire branch cleanup into deleteTask and archiveTask so branches are removed when tasks are deleted or archived
- Add comprehensive tests for scanning, cleanup, and integration with delete/archive flows
2026-04-04 18:31:18 -07:00
gsxdsm
950c78c797 feat(FN-938): add feature triage, mission pause/stop/resume, and scheduler blocked check
- Add mission store methods for pausing, stopping, and resuming missions with proper state transitions
- Implement feature triage flow that evaluates and classifies mission features
- Add scheduler blocked-task check to prevent scheduling when dependencies are unmet
- Create dashboard mission management UI with pause/stop/resume controls
- Add mission API routes for triage, pause, stop, and resume operations
- Add e2e tests for mission routes and unit tests for mission store and scheduler
2026-04-04 18:03:03 -07:00