- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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)
- 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
- 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
- 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
- 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)
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>
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>
- 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
- 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
- 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
- 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
- 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
- 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)
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>
- 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
- 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
- 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
- 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
- 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
- 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
- Add phase field to workflow step definitions (pre-merge vs post-merge) with persistence and API
- Execute pre-merge steps in executor before merge; post-merge steps in merger after successful merge
- Pre-merge failures block merge and keep task in in-review; post-merge failures are logged only
- Expose phase controls and phase-aware results in the dashboard UI
- Add changeset for the published @gsxdsm/fusion package
- Add memoryEnabled boolean setting to core types and default settings
- Add Memory section toggle to SettingsModal dashboard UI
- Integrate memoryEnabled check in executor and triage engine prompts
- Add tests for settings UI, executor prompt behavior, and triage prompt behavior
- Update SettingsModal section count test for the new Memory section
Add @mariozechner/pi-ai mock to restart.integration.test.ts and
project-runtime.test.ts to fix module linking errors. Fix call count
assertions in executor and restart tests to account for the
retry-without-task_done behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add getFusionDir() method to TaskStore for resolving agent database path
- Update in-process-runtime to use getFusionDir() instead of hardcoded path
- Update dashboard routes AgentStore initialization to use getFusionDir()
- Add changeset for published package patch bump
When the stuck task detector killed a task and immediately called
moveTask("todo"), the scheduler could re-dispatch the task before the
old execution's finally block cleared this.executing. The new execute()
call hit the guard and silently returned, stranding the task in
"in-progress" with no active session or worktree (seen on FN-810/FN-912).
Move the requeue responsibility from StuckTaskDetector.killAndRetry to
the executor's finally block, which runs after this.executing.delete().
The beforeRequeue budget check now runs before session.dispose() and its
result is passed via StuckTaskEvent.shouldRequeue → markStuckAborted().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>