Commit Graph

295 Commits

Author SHA1 Message Date
gsxdsm
a5567ad45c feat(FN-925): add memoryEnabled setting with UI toggle and engine integration
- 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
2026-04-04 15:06:57 -07:00
gsxdsm
0c00194d79 fix: repair pre-existing engine test failures from missing pi-ai mock
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>
2026-04-04 13:59:08 -07:00
gsxdsm
1b3eb7bf10 fix(FN-915): use getFusionDir() for agent storage location
- 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
2026-04-04 12:35:15 -07:00
gsxdsm
de074420d2 fix: defer stuck-kill requeue to executor finally block to prevent race
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>
2026-04-04 12:26:13 -07:00
gsxdsm
647bd75864 feat(FN-835): add script-mode workflow step execution with validation hardening
- Implement script-mode workflow steps that execute named commands from project settings with 2-minute timeout
- Harden PATCH /api/workflow-steps/:id validation to reject empty names, check resulting state validity
- Add comprehensive executor tests (420 lines) covering script mode execution, timeout, missing scripts, and prompt mode
- Add dashboard route tests for PATCH validation edge cases
- Update AGENTS.md and README.md with script-mode engine behavior documentation
2026-04-04 11:21:13 -07:00
gsxdsm
357086ab61 fix(FN-834): fix branch prefix drift, add merger branch guard, and fix test OOM
- Fix resolveBaseBranch to use stored branch name and consistent fusion/ prefix
  for both explicit deps and blockedBy paths (was using kb/ for blockedBy)
- Add main branch checkout verification in merger before squash merge to prevent
  feature code from landing on wrong branch lineage
- Align all branch prefix references from stale kb/ to fusion/ across executor,
  merger, store, and routes
- Fix executor test OOM by mocking merger fully, adding fake timers to retry
  tests, and switching vitest pool to vmThreads
- Update all test assertions to use fusion/ branch prefix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 11:11:59 -07:00
gsxdsm
866b97a1c2 fix(FN-874): recover stuck-killed tasks reliably 2026-04-04 09:45:45 -07:00
gsxdsm
9bc8e79aad fix(FN-756): fix branch name prefix in prune tests and document stale worktree recovery
- Fix branch name assertion in executor test: use kb/ prefix instead of fusion/
- Add comprehensive tests for stale worktree and branch reference recovery (267 lines)
- Document stale worktree/branch recovery procedure in README
2026-04-04 09:26:39 -07:00
gsxdsm
0486e12c2e fix: retry with new agent session when task_done is not called
Instead of immediately failing when an agent finishes without calling
task_done, spawn a fresh session with a recovery prompt that asks the
agent to review the worktree state and complete the task. Only fail
if the retry also doesn't produce a task_done call.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 09:15:01 -07:00
gsxdsm
6d1c6411d9 fix(FN-850): harden merge readiness and reopen done tasks 2026-04-04 08:35:19 -07:00
gsxdsm
e9fddc44cb fix: use merge-base for diffStat in merger and show files changed on done task cards
The merger was using `git diff HEAD..branch --stat` which includes
artifacts from other tasks when branches fork from older main commits.
Switch to `git diff $(merge-base)..branch --stat` so commit messages
only describe the branch's own changes.

Also surface the "files changed" button on done task cards using
mergeDetails, opening the same ChangedFilesModal with commit-backed
diffs (matching the Changes tab in the task modal).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 08:33:53 -07:00
gsxdsm
b2e444ea88 feat(FN-850): add no-progress loop detection and improve stuck-task detector
- Add explicit no-progress loop detection signals to executor agent sessions
- Enhance stuck-task detector with configurable strategies (timeout, no-progress, combined)
- Add comprehensive test coverage for stuck-task detector (371 lines of tests)
- Remove modelFilter test utilities (198 lines of dead test code)
- Simplify modelFilter.ts by removing unused filtering logic
- Clean up dashboard server startup and minor README fix
2026-04-04 07:48:47 -07:00
gsxdsm
c5bbb4bcb5 feat(FN-834): add per-workflow-step model overrides for execution
- Extend WorkflowStep type with optional modelProvider, modelId, validatorModelProvider, validatorModelId fields
- Add API endpoints (PATCH /api/workflow-steps/:id) to update model overrides on workflow steps
- Update executor to use per-step model overrides when running workflow step agents
- Add AgentDetailView support for displaying workflow step model configuration
- Add store and executor tests for new model override behavior
2026-04-04 04:08:16 -07:00
gsxdsm
5cfb93ecbc feat(FN-840): add closed/merged PR feedback contract and clean up unused code
- Add closed/merged PR feedback contract to pr-monitor for post-merge follow-up behavior
- Fix PR monitor drainComments + consume/drain behavior with comprehensive tests
- Add PR feedback follow-up tests and scheduler follow-up logic
- Remove unused activity log, agent log viewer, and multi-agent log code from dashboard
- Remove unused store methods, types, API endpoints, and route handlers
- Update README docs to document manual-merge PR follow-up behavior and fix auth wording
- Add dashboard CLI test coverage for new commands
2026-04-04 02:01:58 -07:00
gsxdsm
2c9def070b feat(FN-832): add event-driven scheduling on task unpause and auto-resume in-progress tasks
- Auto-resume in-progress tasks that were paused and then unpaused, picking up from their last step
- Add event-driven scheduler trigger on task unpause so resumed tasks are immediately scheduled
- Update Store and TaskStore with unpause handling, type changes for resume tracking
- Refactor executor, merger, and scheduler tests for improved reliability
- Remove dead code: mission-interview, pr-comment-handler, taskStuck util, OpenRouter model sync changeset
- Update AGENTS.md documentation for pause/unpause behavior
2026-04-04 00:40:32 -07:00
gsxdsm
eef15f077c feat(engine): harden review pipeline with strict scope, build retry, and E2E tests
Improve the plan→review→approve→merge agent pipeline:

- Harden verdict extraction with JSON block parsing and anchored regexes
- Consolidate legacy/new merger conflict APIs into thin deprecated wrappers
- Add configurable strict scope enforcement (strictScopeEnforcement setting)
- Add build retry with timeout to merger (buildRetryCount, buildTimeoutMs)
- Add handleChangesRequested to PrCommentHandler for review feedback loop
- Remove dead code: handleFsChange, processTaskChange, unused imports/fields
- Add E2E multi-verdict sequence tests for the full review pipeline
- Fix unused parameter warnings across engine and core packages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 00:29:34 -07:00
gsxdsm
0f16463ec9 feat(FN-828): lock in compaction behavior with comments and regression tests
- Add explicit comments to pi.ts documenting auto-compaction behavior during agent context management
- Add regression tests verifying compaction triggers correctly and preserves conversation integrity
- Document auto-compaction behavior in README under AI Engine section
2026-04-04 00:02:33 -07:00
gsxdsm
6a192d009c fix(FN-827): fix orphaned pause path so gracefully-paused tasks return to todo
- Fix executor bug where tasks paused during execution with a graceful session exit were silently dropped instead of moved back to todo
- When session.dispose() resolves the prompt without throwing, the paused-aborted flag now triggers moveTask(todo) so the scheduler can resume after unpause
- Add executor test suite covering pause via graceful exit, pause via abort error, and pause during session disposal
- Document corrected pause/unpause behavior for in-progress tasks in README and AGENTS.md
2026-04-03 22:09:56 -07:00
gsxdsm
2fad82ea14 feat(FN-813): add project-aware ntfy deep links
- Thread real project context (projectName, projectId) into ntfy notification deep links
- Dashboard deep-link URL now honors project context with /project/:name/task/:id pattern
- Update App.tsx routing to handle project-scoped deep link navigation
- Add project info to NtfyNotifier types and wire through notification payload
- Add changeset for published @gsxdsm/fusion package
- Add tests for notifier project context and dashboard routing
2026-04-03 21:34:39 -07:00
gsxdsm
960567f0d0 feat(FN-829): persist triage model selection into agent log
- Log the selected model provider and ID during triage so the agent log records which model was used
- Add agent-log entry capturing triage model choice for observability
- Add comprehensive tests for triage model logging behavior
- Update AgentsView component and dashboard docs for consistency
- Remove obsolete AgentsView test
2026-04-03 20:57:10 -07:00
gsxdsm
e176d1af27 fix(engine): prevent extractVerdict from matching verdict keywords in review body text
The body-scan fallback (includes("APPROVE") etc.) would misclassify verdicts
when the reviewer mentioned a keyword in context without it being the actual
verdict — e.g. "this does not yet merit APPROVE". Replaced with a
line-anchored regex that only matches "Verdict: X" lines, and expanded the
primary regex to also catch bold/italic formatted verdicts like **Verdict: APPROVE**.
UNAVAILABLE is now the honest fallback when no structured verdict is found,
triggering a retry rather than silently misclassifying.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 18:09:25 -07:00
gsxdsm
bcb9915968 feat: add SelfHealingManager for unattended multi-day operation
Adds four self-healing subsystems to enable the engine to recover from
common failure modes without human intervention:

- Auto-unpause: clears rate-limit-triggered globalPause with escalating
  backoff (5 min → 60 min cap), resets on sustained recovery
- Stuck kill budget: caps task stuck-kill retries (default 3) to prevent
  infinite stuck→todo→stuck loops
- Periodic maintenance (every 15 min): git worktree prune, orphan cleanup,
  SQLite WAL checkpoint
- Worktree cap enforcement: removes oldest idle worktrees when count
  exceeds 2× maxWorktrees

New settings: autoUnpauseEnabled, autoUnpauseBaseDelayMs,
autoUnpauseMaxDelayMs, maxStuckKills, maintenanceIntervalMs.
New task field: stuckKillCount (schema v8 migration).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 15:35:12 -07:00
gsxdsm
171f3aee31 feat: add three guardrails against out-of-scope agent deletions
1. Scoping rules in agent prompts: executor, triage template, and reviewer
   now explicitly forbid deleting/gutting modules, settings, interfaces,
   exports, or test files outside the task's declared File Scope. Reviewer
   will REVISE if out-of-scope removals are detected.

2. Pre-merge diffstat scope check: merger.ts validates the git diffstat
   against the task's PROMPT.md File Scope before merging. Large deletions
   outside scope are logged as warnings on the task (soft guardrail).

3. Changeset requirement for feature removal: triage template now requires
   a .changeset/ entry when removing existing functionality. Executor and
   reviewer enforce this requirement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 12:51:29 -07:00
gsxdsm
8c246b036f feat(FN-775): add recoverable-retry with bounded exponential backoff
- Add  state to tasks: persisted in DB, gates scheduler pickup to prevent immediate retry of transient failures
- Introduce shared recovery-policy module with bounded exponential backoff (1s → 60s, max 5 attempts)
- Wire recovery policy into executor, scheduler, and triage so all agents respect the same retry cadence
- Persist retry state (attempt count, next eligible time) in task metadata via store and DB schema
- Add DB migration for new retry columns and update schema tests
- Update README with recovery policy documentation
- Refactor dashboard Header component and styles, consolidate header tests
- Fix session-files route tests to align with updated route signatures
2026-04-03 07:58:45 -07:00
gsxdsm
e314f89224 fix(FN-756): harden stale worktree/branch recovery in executor
- Add git worktree prune as first recovery step before branch deletion to release stale locks
- Add git update-ref -d fallback when git branch -D fails on corrupted references
- Handle stale references in the fallback conflict path (not just primary path)
- Expand invalid-reference pattern matching to cover additional error outputs (unable to resolve reference, stale file handle, not a valid ref, unable to delete ref)
- Add detailed logging at each recovery step for operational traceability
2026-04-03 07:11:31 -07:00
gsxdsm
71aa63e584 fix(FN-756): reset recycled worktree baselines 2026-04-03 07:09:27 -07:00
gsxdsm
ca7c2ca0ec fix(FN-766): load pi extension providers for engine 2026-04-02 22:18:47 -07:00
gsxdsm
fb9827b700 fix(FN-745): improve fallback model recovery 2026-04-02 21:50:41 -07:00
gsxdsm
c82b997402 feat(FN-742): add describeModel helper and log model in agent creation sites
- Add describeModel() helper in pi.ts to format provider/model info for logging
- Log resolved model details in executor, reviewer, and triage agent creation
- Update executor and reviewer to call describeModel before session start
- Add unit tests for describeModel covering all input combinations
- Fix test mocks to account for new describeModel dependency
2026-04-02 19:52:35 -07:00
gsxdsm
371ec764b8 fix(FN-000): harden project migration runtime 2026-04-02 17:55:25 -07:00
gsxdsm
86f8653b8f fix(FN-710): fix addSteeringComment to persist comments and correct type usage
- Fix addSteeringComment to skip auto-refinement and write directly to steeringComments array
- Update formatCommentForInjection to accept SteeringComment type instead of raw string
- Export SteeringComment type from @fusion/core for executor usage
- Add tests verifying steering comments are persisted to task store
- Fix executor import to use exported SteeringComment type
2026-04-02 14:17:19 -07:00
gsxdsm
321feb0b8d feat(FN-709): store branch name on tasks for reliable merge recovery
- Add 'branch' field to Task and ArchivedTaskEntry types with DB migration
- Executor stores branch name on task after worktree assignment
- Merger reads branch from task metadata instead of relying on worktree state
- Implement non-destructive conflict recovery in prepareForTask with reset/clean
- Add tests for branch storage, merger branch reading, and worktree recovery
2026-04-02 14:08:31 -07:00
gsxdsm
c1ff739a87 fix(FN-706): add branch conflict recovery and pool fallthrough in executor
- Add branch conflict recovery to worktree-pool prepareForTask when checkout fails
- Add fallthrough in executor to create fresh worktree when pool preparation fails
- Add tests for branch conflict recovery in worktree-pool
- Add tests for executor fallthrough on pool preparation failure
2026-04-02 13:48:08 -07:00
gsxdsm
281fd206ba feat(FN-705): add rate-limit retry with exponential backoff for AI agents
- Add rate-limit retry utility with exponential backoff, jitter, and configurable limits
- Integrate retry logic into executor, triage, and merger agent sessions
- Export retryOnRateLimit from engine package index
- Remove unused DirectoryPicker component, stale CSS, and dead dashboard routes
- Update SetupWizardModal and usage tests to reflect cleanup
2026-04-02 13:39:04 -07:00
gsxdsm
e6dc02354b fix(FN-703): fix overly broad usage limit pattern and add transient error retry
- Narrow 'insufficient' usage-limit regex to require quota/credit/balance/fund context
- Add transient error detection in executor and triage to retry instead of failing
- Improve scheduler pause/resume logging with actionable messages and resume confirmation
- Add SSE active connection counter for observability
- Add duplicate usage-limit pause suppression logging
2026-04-02 13:29:48 -07:00
gsxdsm
a0fb5c40f4 test(FN-695): add assertion for updateProject call in addProject test 2026-04-02 10:45:51 -07:00
gsxdsm
e979111a28 fix(FN-695): transition project status from initializing to active in addProject() 2026-04-02 10:45:28 -07:00
gsxdsm
f2aaea0655 test(FN-690): add tests for event filtering 2026-04-02 10:32:20 -07:00
gsxdsm
d18bc1a4ce feat(FN-690): update NtfyNotifier to respect ntfyEvents setting 2026-04-02 10:30:55 -07:00
gsxdsm
203b6588fb feat(FN-693): add projectId to NtfyNotifier for multi-project deep links
- Add projectId parameter to NtfyNotifier constructor and sendMessage method
- Include projectId in notification deep links for multi-project context
- Add unit tests for deep link URL construction with projectId in App.tsx
- Add unit tests verifying project ID handling in notifier
2026-04-02 10:27:49 -07:00
gsxdsm
182fa8eeb2 feat(FN-675): align session-files endpoint with diff endpoint
- Add git diff for session-files using baseCommitSha with double-dot syntax
- Add merge-base fallback to find common ancestor when baseCommitSha is missing
- Add HEAD~1 fallback when merge-base fails (e.g., no remote main)
- Add 10-second in-memory cache for session-files computation
- Fix scheduler to immediately schedule tasks created via dashboard
- Add task:moved to done handler for immediate scheduling on status change
- Add comprehensive unit tests for scheduler immediate scheduling
- Add unit tests for session-files caching and base ref resolution
2026-04-02 09:22:50 -07:00
gsxdsm
2c48ce0852 feat: rename data directory, add global project settings, multi-project CLI commands, and provider badge in model selector
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 09:10:42 -07:00
gsxdsm
5654d2e230 feat: add per-provider timeout for usage panel to prevent blocking on slow responses
fix: update scheduler filesystem path from .kb to .fusion for task validation

style: clean up TaskDetailModal styling with reusable CSS classes

test: add comprehensive tests for file-service operations with mocked filesystem
2026-04-01 22:38:18 -07:00
gsxdsm
7fd5704a80 Removed unwanted files marked in .gitignore 2026-04-01 21:25:08 -07:00
gsxdsm
07adb42d64 feat(KB-503): merge kb/kb-503
- feat(KB-503): complete Step 5 other command project support
- fix(KB-503): align task resolution with shared project context
- fix(KB-503): preserve local task command fallback
- test(KB-503): complete Step 4 task command coverage
- test(KB-503): harden Step 3 CLI parser coverage
- fix(KB-503): keep settings set scope explicit
- fix(KB-503): allow implicit project resolution for project settings
- fix(KB-503): enforce explicit settings scope rules
- fix(KB-503): restore shared settings resolution behavior
- fix(KB-503): align settings scope and project flag behavior
- feat(KB-503): complete Step 5 — add project-aware settings, git, and backup behavior
- fix(KB-503): enforce settings scope for global and project modes
- fix(KB-503): preserve project-scoped settings and cwd-aware git helpers
- fix(KB-503): add scoped settings behavior and git project tests
- feat(KB-503): complete Step 5 — add project-aware git and backup coverage
- test(KB-503): cover remaining project-aware task command paths
- fix(KB-503): use shared resolution flow for all task commands
- fix(KB-503): restore legacy task fallback and correct task mocks
- fix(KB-503): align task resolution order and kb storage paths
- fix(KB-503): restore local task store fallback without project flag
- test(KB-503): cover remaining project-aware task handlers
- fix(KB-503): preserve branch naming and avoid duplicate log resolution
- test(KB-503): expand project-aware task command coverage
- fix(KB-503): restore cwd fallback for path-based task commands
- fix(KB-503): add project-aware task output and tests
- fix(KB-503): harden project command output and coverage
- fix(KB-503): preserve legacy task resolution without project flag
- test(KB-503): add bin routing coverage for project flag parsing
- feat(KB-503): complete Step 3 — CLI argument parsing updates
- fix(KB-503): add defaultProjectId to GlobalSettings type and fix TypeScript errors
- test(KB-503): fix resolveProject mock in task tests for runTaskLogs follow mode
- docs(KB-503): add multi-project CLI documentation and changeset
- test(KB-503): add project-context mock to task tests
- test(KB-503): update git tests for new cwd parameter
- feat(KB-503): Step 3 — CLI argument parsing updates with --project flag support
- feat(KB-503): Steps 1-2 — project context utilities and project subcommands
2026-04-01 15:06:58 -07:00
gsxdsm
a51a84db8d feat(KB-648): enable parallel test execution across packages
- Optimize backup tests with fake timers and deterministic timestamps
- Enable Vitest fileParallelism in core, engine, cli, and dashboard packages
- Fix SettingsModal scope initialization regression covered by merge resolution
- Update affected dashboard and engine tests for the new parallel-friendly behavior
- Add a changeset and document test optimization patterns in AGENTS.md
2026-04-01 15:00:07 -07:00
gsxdsm
e8b6b98d57 feat(KB-635): integrate mission workflows across CLI, extension, and engine
- Add mission CLI commands and pi extension tools for creating missions, milestones, slices, features, and task links
- Extend core mission storage and schema migrations with auto-advance support, task slice linkage, and comment normalization coverage
- Wire mission-aware scheduler and executor behavior so linked features progress with task execution and completed slices can auto-activate follow-on work
- Add regression tests for mission CLI parsing, extension behaviors, scheduler mission semantics, and executor integration
2026-04-01 13:45:56 -07:00
gsxdsm
1b3729a70b feat(FN-670): enforce merge build verification and activity feed fallback
- Add activity feed fallback to the local project log when central activity is empty or unavailable
- Pass configured build commands into executor and merger prompts with hard-gate instructions
- Add merger build-failure reporting via report_build_failure and stop commits when verification fails
- Expand engine and dashboard regression coverage for activity feed fallback and merge build verification
2026-04-01 13:24:57 -07:00
gsxdsm
0da3fea13c feat(FN-671): preserve quick entry disclosure and normalize comment migration
- Keep QuickEntryBox disclosure state persisted and covered by updated UI tests
- Add normalized legacy comment migration logic to unify steering comments without duplication
- Update database migration tests to verify schema v5 comment handling behavior
- Carry merged dashboard, engine, and routing changes into the squash commit
2026-04-01 13:07:26 -07:00
gsxdsm
035aea3161 test(FN-705): add comprehensive unit tests for IpcHost and IpcWorker
- Add IpcHost tests: constructor, sendCommand correlation, ping, event forwarding, malformed message handling, disconnection cascade, explicit cleanup
- Add IpcWorker tests: constructor validation, PING auto-response, command handler registration/dispatch, OK/ERROR responses, sendEvent/sendErrorEvent, shutdown idempotency
- Fix TypeScript type mismatch in mock ChildProcess.send signature
- Mock logger and process IPC to enable isolated unit testing without real child processes
- Cover edge cases: timeouts, disconnected sends, unknown commands, malformed messages
2026-04-01 10:00:17 -07:00