Commit Graph

1704 Commits

Author SHA1 Message Date
gsxdsm
494b7da5f1 fix(FN-1473): recover no-progress task_done failures 2026-04-12 12:13:06 -07:00
gsxdsm
ce82e94153 feat(FN-1612): merge fusion/fn-1612 2026-04-12 12:03:08 -07:00
gsxdsm
e82736a171 fix(FN-1600): update merger tests for -X theirs escalation strategy
The FN-1598 merger.ts async conversion introduced an escalation strategy where
attempt 3 uses -X theirs and succeeds when AI fails. The tests were expecting
the merge to fail after 3 AI attempts, but now attempt 3 succeeds via the
theirs strategy.

This commit fixes the test mocks to make the -X theirs merge fail so all
3 attempts exhaust and the function throws as expected.
2026-04-12 11:47:27 -07:00
gsxdsm
8843999f3b refactor(FN-1615): convert CLI execSync to async exec
- Replace execSync with promisified execAsync in init.ts detectProjectName() for non-blocking git remote lookups
- Replace execSync with promisified execAsync in task-lifecycle.ts cleanupMergedTaskArtifacts() for non-blocking git worktree/branch cleanup
- Add 30s timeout to git operations to prevent indefinite hangs
- Update test mocks to support both callback-style and promise-style exec usage
2026-04-12 11:46:57 -07:00
gsxdsm
577f01b280 fix dashboard task payload freezes 2026-04-12 11:32:39 -07:00
gsxdsm
29bb15e0ee feat(FN-1593): merge fusion/fn-1593 2026-04-12 10:55:53 -07:00
gsxdsm
5caaead7a0 fix(FEAT-009-FIX-002): correct MilestoneValidationRollup field names and tooltip
The dashboard used incorrect field names (passedCount/failedCount/blockedCount/pendingCount)
that don't exist on the type. The backend returns passedAssertions/failedAssertions etc.
Fixed MissionManager.tsx to use correct field names with ?? 0 fallback for tooltip text.
2026-04-12 10:12:45 -07:00
gsxdsm
f7f69b5ae6 fix(FEAT-009-FIX-001): resolve 3 blocking issues from integration user testing
1. Fix TypeError in run history: fetchValidationRuns now correctly
   destructures .runs from paginated API response {runs, total, offset}

2. Fix assertions panel rendering: inline fetch calls in loadMissionDetail
   and toggleMilestoneExpanded to avoid forward-reference of callback hooks.
   Added Array.isArray guard to prevent .map on undefined state values.

3. Add missing UI components:
   - Clickable lineage indicator for fix features (navigates to source)
   - Retry budget 'Attempt X of Y' display on feature cards
   - 'No fix features generated' empty state
   - Milestone validation state badge in header (already existed, now
     loads correctly)
   - Validation rollup badge with coverage bar in milestone header

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-12 09:37:05 -07:00
gsxdsm
28e0061b2f feat(FN-1613): merge fusion/fn-1613 2026-04-12 08:25:17 -07:00
gsxdsm
8f0bcf7f00 feat(FN-1465): merge fusion/fn-1465 2026-04-12 07:00:49 -07:00
gsxdsm
86f1f93de9 feat(FN-1599): merge fusion/fn-1599 2026-04-12 06:50:53 -07:00
gsxdsm
db4badcae7 feat(FN-1598): merge fusion/fn-1598 2026-04-12 06:50:45 -07:00
gsxdsm
003ef625ab fix blocking hot path operations 2026-04-11 21:23:36 -07:00
gsxdsm
d423dfcff6 fix: suppress execution output on stdout 2026-04-11 21:13:16 -07:00
gsxdsm
c4e6c0fd37 feat(FEAT-006): add validation and loop state API endpoints
Implemented:
- POST /api/missions/features/:featureId/validate - triggers validation run
- GET /api/missions/features/:featureId/validation-loop - returns loop snapshot
- GET /api/missions/features/:featureId/validation-runs - returns run history with pagination
- GET /api/missions/validation-runs/:runId - returns run detail with assertion results
- POST /api/missions/recover - triggers recovery of active missions
- SSE events for milestone:validation:updated via assertion CRUD and link/unlink

All 4xx/5xx responses use consistent {"error": "message"} format.
Uses existing badRequest, notFound, internalError helpers.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 21:03:15 -07:00
gsxdsm
bab269dada feat(FN-1586): update ChatView with model selector
- Add model selector to ChatView component for AI model selection
- Update ChatView tests to cover model selector functionality
- Add styles for model selector in chat interface
2026-04-11 20:48:48 -07:00
gsxdsm
9a242c46b5 fix engine build and test resolution 2026-04-11 20:42:26 -07:00
gsxdsm
5f43316609 feat(FEAT-005): add contract assertion CRUD API endpoints
- Add GET /api/missions/milestones/:milestoneId/assertions
- Add POST /api/missions/milestones/:milestoneId/assertions
- Add GET /api/missions/assertions/:assertionId
- Add PATCH /api/missions/assertions/:assertionId
- Add DELETE /api/missions/assertions/:assertionId
- Add POST /api/missions/milestones/:milestoneId/assertions/reorder
- Add POST /api/missions/features/:featureId/assertions/:assertionId/link
- Add POST /api/missions/features/:featureId/assertions/:assertionId/unlink
- Add GET /api/missions/features/:featureId/assertions
- Add GET /api/missions/assertions/:assertionId/features
- Add GET /api/missions/milestones/:milestoneId/validation

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 20:36:53 -07:00
gsxdsm
67d2222202 Harden dashboard worktree shutdown handling 2026-04-11 20:28:34 -07:00
gsxdsm
f6ba5aa75a test(FEAT-004-FIX-002): add comprehensive unit tests for MissionExecutionLoop
Tests cover:
- parseValidationResult with JSON extraction from markdown code blocks and malformed responses
- handleValidationPass verifying feature marked 'passed' and autopilot notified
- handleValidationFail verifying fix feature generated and retry budget decremented
- handleValidationBlocked verifying feature marked 'blocked' without fix generation
- Retry budget enforcement preventing further implementations when exhausted
- recoverActiveMissions verifying actual processTaskOutcome calls for features in validating/needs_fix states

Added 23 new tests (1916 total, up from 1893).
2026-04-11 20:13:47 -07:00
gsxdsm
b2dc6ee90d feat(FN-1455): thread project scope into subtask session persistence 2026-04-11 19:50:19 -07:00
gsxdsm
98bf55c356 fix(FEAT-004-FIX-001): fix MissionExecutionLoop validation parsing and recovery
- Implement actual AI response parsing in parseValidationResult() with JSON extraction
  from markdown code blocks, repair for common JSON issues, and assertion result parsing
- Fix notifyValidationComplete to pass feature.taskId instead of featureId to
  handleTaskCompletion() in in-process-runtime, dashboard, and serve
- Fix recoverActiveMissions() to actually transition validating features back to
  implementing and call processTaskOutcome for features with completed tasks
- Add comprehensive unit tests for MissionExecutionLoop lifecycle, processTaskOutcome,
  recoverActiveMissions, and error handling
2026-04-11 19:48:53 -07:00
gsxdsm
01479ca64b Merge branch 'fusion/fn-1449'
# Conflicts:
#	packages/cli/src/commands/__tests__/serve.test.ts
2026-04-11 19:30:33 -07:00
gsxdsm
9b56460ac4 feat(FN-1449): complete agent UI field parity with Agent Companies
This change aligns agent editing surfaces across dashboard UI, API payloads,
and import/template flows so every first-class editable agent field is
round-trippable.

Backend changes:
- Add memory and bundleConfig fields to POST/PATCH /api/agents routes
- Fix agent-companies-parser to use first-class fields (title, icon, role,
  reportsTo, instructionsText) instead of metadata fallbacks
- Update import dry-run preview to show more manifest fields

UI changes:
- Enable identity field editing (name, title, icon, role, reportsTo) in
  AgentDetailView ConfigTab
- Add instruction bundle configuration (mode, entry file, files, external
  path) to ConfigTab
- Add memory field to NewAgentDialog
- Fix AI generation mapping to preserve systemPrompt as instructionsText
- Update AgentImportModal preview to show icon, reportsTo, and instructions

Test fixes:
- Update parser tests for new first-class field behavior
- Add MissionExecutionLoop mock for serve tests

Documentation:
- Add agent field parity matrix to docs/agents.md
- Create changeset for @gsxdsm/fusion
2026-04-11 19:02:32 -07:00
gsxdsm
89abece8cb test(scrutiny): fix missing MissionExecutionLoop mock in serve.test.ts
Add MissionExecutionLoop mock to @fusion/engine vi.mock block in
serve.test.ts. The mock provides start, stop, processTaskOutcome,
and recoverActiveMissions methods to match the actual class interface.

Also adds the scrutiny synthesis report for milestone execution-loop
which identifies 3 blocking issues in FEAT-004:
- parseValidationResult stub always returns pass
- notifyValidationComplete passes featureId instead of taskId
- recoverActiveMissions doesn't perform state transitions

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 18:37:49 -07:00
gsxdsm
bc3688badf fix(engine): run user commands via async exec to avoid blocking event loop
The merger's test/build verification, executor's worktreeInitCommand,
setupScript, and script-mode workflow steps all used execSync, which
blocks Node's event loop until the child process exits. A hanging
pnpm test could freeze the entire engine (no logs, heartbeats, or
other task progress) for the full 5-minute timeout.

Switch these call sites to promisify(exec) with awaited calls so the
engine keeps running while user-configured commands execute. Short
internal git plumbing (rev-parse, branch -d, worktree remove) still
uses execSync since those commands are bounded and measured in ms.

Document the rule in AGENTS.md under a new "Engine process rules"
section so future agents don't reintroduce blocking behavior.

Tests: update child_process mocks in merger.test, executor.test, and
restart.integration.test to route the new async exec through the
existing execSync mock and expose promisify.custom so destructuring
{ stdout, stderr } matches real child_process.exec semantics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 18:28:05 -07:00
gsxdsm
46fff0d33f feat(FEAT-004): add MissionExecutionLoop class and wiring
- Create MissionExecutionLoop class for validation cycle orchestration
- Wire loop into dashboard.ts and serve.ts startup/shutdown alongside MissionAutopilot
- Integrate processTaskOutcome into scheduler's task:moved handler for mission-linked tasks
- Implement validation pass/fail/blocked/error handling with fix feature generation
- Implement retry budget exhaustion handling via createGeneratedFixFeature
- Implement recoverActiveMissions on startup to re-enqueue pending validations
- Wire loop into InProcessRuntime lifecycle
- Add AI session integration with createKbAgent and promptWithFallback
- Implement autopilot coordination via notifyValidationComplete callback
- Add error handling for AI/store failures with graceful loop continuation
- Extend SchedulerOptions with optional missionExecutionLoop field
- Export MissionExecutionLoop from engine barrel

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 18:04:21 -07:00
gsxdsm
90e6824232 feat(FEAT-003): add validator failures, fix features, snapshot methods and loop state transitions
- Add recordValidatorFailures() method to store assertion failures with generated IDs
- Add createGeneratedFixFeature() to create fix features with lineage tracking
- Add getFeatureLoopSnapshot() to return complete loop state with retryBudgetRemaining
- Add getValidatorRunsByFeature() returning runs ordered by startedAt DESC
- Add getFailuresForRun() returning failures ordered by createdAt ASC
- Add transitionLoopState() with validation for all valid loop state transitions
- Implement retry budget enforcement: blocks implementing when budget exhausted
- Add rowToFailure() and rowToLineage() converters
- Add generateFailureId() and generateLineageId() ID generators
- Add DEFAULT_IMPLEMENTATION_RETRY_BUDGET constant (3 attempts)
- Update MissionFeatureLoopSnapshot interface to include retryBudgetRemaining

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 17:32:29 -07:00
gsxdsm
a5344f369e feat(FEAT-002): add startValidatorRun and completeValidatorRun methods
- Add validator-run:started and validator-run:completed events to MissionStoreEvents
- Add rowToValidatorRun converter method
- Add generateValidatorRunId method
- Implement startValidatorRun: creates run with status='running', sets startedAt, increments feature validatorAttemptCount, updates lastValidatorRunId, sets loopState to 'validating', emits event
- Implement completeValidatorRun: handles passed/failed/blocked/error transitions with correct loop state updates and durationMs computation
- Add tests for all validator run methods covering VAL-DM-015 through VAL-DM-020

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 17:23:44 -07:00
gsxdsm
429d5855ee feat(FEAT-001): add loop state columns and validator run tables for mission execution loop
This commit adds the schema migration and types for the mission execution loop validation system:
- Adds loop state tracking columns to mission_features table (loopState, implementationAttemptCount, validatorAttemptCount, lastValidatorRunId, lastValidatorStatus, generatedFromFeatureId, generatedFromRunId)
- Creates mission_validator_runs table for tracking validation runs
- Creates mission_validator_failures table for assertion failure records
- Creates mission_fix_feature_lineage table for tracking fix feature relationships
- Adds workflowStepRetries column to tasks table for retry tracking
- Adds FEATURE_LOOP_STATES and VALIDATOR_RUN_STATUSES enums
- Updates TaskStore to support workflowStepRetries field
- Updates TaskExecutor to handle workflow step failures with retry logic

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 17:06:41 -07:00
gsxdsm
b76a1011b6 feat(FN-1445): add project-scoping and fallback handling for AI routes and missions
- Add projectId parameter to refineText API and TaskForm for proper scoping
- Update mission routes to require projectId and add regression tests
- Add mission interview fallback to mission-level context when target not found
- Add AI refine route scoping tests for project isolation
- Update component tests to expect projectId argument
- Update prompt-keys test counts for new system prompts
2026-04-11 15:23:03 -07:00
gsxdsm
18f242b2bc feat(FN-1420): add pluggable memory backend system
- Add FileMemoryBackend with atomic writes, persistence, and conflict resolution
- Add ReadOnlyMemoryBackend for read-only/external memory management
- Add memoryBackendType setting to select backend type (file or readonly)
- Add GET /api/memory/backend endpoint to query current backend status and capabilities
- Update AGENTS.md, README.md, and docs with architecture and settings guidance
- Add memory-backend.test.ts with comprehensive tests for all backends
- Add routes.test.ts coverage for /api/memory/backend endpoint
- Fix settings parity test to include new memoryBackendType key
2026-04-11 12:13:25 -07:00
gsxdsm
12c38ef0ea feat(FN-1588): add truncated-prompt retry for merger context-limit recovery
- Detect when merge prompt exceeds context limit and gets truncated
- Retry merge with compacted prompt when truncation is detected
- Create fresh session after context limit recovery
- Add comprehensive tests for truncation detection and recovery flow
- Update merge prompt generation to include truncation signal
2026-04-11 11:39:50 -07:00
gsxdsm
98dc20b3d3 feat(FN-1584): add step-change dependency and polling to useTaskDiffStats
- Add step-based dependency to useTaskDiffStats hook to trigger refetch when task steps change
- Implement 5-second polling interval for live diff statistics updates
- Add comprehensive test coverage for polling behavior and step-change detection
- Update TaskCard to pass step information to useTaskDiffStats
- Add TaskCard unit tests for diff statistics display
2026-04-11 11:27:32 -07:00
gsxdsm
fee27abb56 feat(FN-1571): merge fusion/fn-1571 2026-04-11 11:04:04 -07:00
gsxdsm
03d72f06b1 feat(FN-1545): fix mobile More sheet safe-area padding
- Fix More sheet content padding on iOS devices with notched screens
- Add CSS regression tests for safe-area-inset-* rules in mobile nav bar
- Ensure consistent padding for content area across different device safe areas
2026-04-11 11:00:52 -07:00
gsxdsm
84ae3e0163 feat(FN-1501): enhance workflow step output rendering
- Add expanded view modal for workflow step output with full-screen display
- Add markdown/plain text toggle for output rendering in WorkflowResultsTab
- Add output rendering CSS styles with markdown and code block styling
- Update workflow steps documentation with output rendering features
- Add comprehensive tests for WorkflowResultsTab component (259 tests)
2026-04-11 09:39:32 -07:00
gsxdsm
05a310dc07 feat(FN-1495): merge fusion/fn-1495 2026-04-11 09:01:29 -07:00
gsxdsm
b40c9b5406 feat(FN-1433): wire prompt overrides into mission interview service
- Import resolvePrompt and PromptOverrideMap from @fusion/core
- Add promptOverrides parameter to all agent creation paths:
  - createMissionInterviewSession
  - submitMissionInterviewResponse
  - retryMissionInterviewSession
  - initializeAgent
  - createMissionInterviewAgent
  - ensureMissionInterviewAgent
- Use resolvePrompt('planning-system', promptOverrides) for effective prompt
- Fall back to MISSION_INTERVIEW_SYSTEM_PROMPT when override absent
- Update module docs to reflect prompt override behavior
2026-04-11 08:52:39 -07:00
gsxdsm
e48e034754 feat(FN-1416): merge fusion/fn-1416 2026-04-11 08:31:32 -07:00
gsxdsm
98ad63abcb fix(auto-merge): unblock review tasks stranded past retry limit
Broaden the auto-heal pattern to cover build-verification failures and
add a 30m idle cooldown so tasks that exhausted mergeRetries without
matching the narrow heal pattern get another sweep-driven attempt
instead of being stranded until a human clears the counter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 07:48:17 -07:00
gsxdsm
29a09d697f test: fix mission manager icon mock 2026-04-11 07:03:07 -07:00
gsxdsm
6dd66f6a31 fix(merger): truncate verification output and retry via in-progress
Deterministic verification failures were embedding the raw stderr/stdout
(up to 50MB per VERIFICATION_COMMAND_MAX_BUFFER) in a second log entry,
flooding logs/stdout and crashing the app. The runVerificationCommand
helper already wrote a truncated summary, so verifyDeterministicBuild
now just references it.

When the failure surfaces in the dashboard merge handler, kick the task
back to in-progress with a steering comment so the agent can fix the
failing test/build instead of parking it in in-review with a fatal
error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 06:56:18 -07:00
gsxdsm
302394b5f5 feat(FN-1489): reorganize Task Detail modal footer with split menus
- Add SplitMenu component for reusable dropdown menus in modal footers
- Update TaskDetailModal footer to use LeftMenu (Plan, Subtask, Models) and RightMenu (Save, Close)
- Add comprehensive tests for dropdown menu behavior in modal footers
- Update QuickEntryBox and NewTaskModal tests to match new menu patterns
- Add testing patterns for modal dropdown menus to project memory
2026-04-11 06:51:20 -07:00
gsxdsm
c8831f7b3b feat(FN-1553): reduce memory bloat with selective save behavior
- Update project memory instructions to encourage selective writes instead of unconditional appends
- Instruct agents to consolidate existing entries rather than add duplicates
- Add guidance to skip memory updates when no durable learnings were discovered
- Clarify what qualifies as durable learnings vs task-specific trivia
- Update user-facing memory documentation to reflect new selective behavior
- Add test coverage for selective memory write instructions
2026-04-11 00:38:42 -07:00
gsxdsm
afa2e153ee fix(FN-1488): add showQuickChatFAB setting to control Quick Chat FAB visibility
- Add showQuickChatFAB boolean setting to ProjectSettings type
- Add useAppSettings hook function for accessing the setting
- Wire QuickChatFAB visibility in App.tsx based on setting
- Hide QuickChatFAB in MobileNavBar when setting is false
- Add Settings UI toggle for the new setting
- Add CSS for hiding QuickChatFAB on mobile when disabled
- Add comprehensive tests for all affected components
- Fix QuickChatFAB onOpenChange test to use controlled mode
- Update settings reference documentation
2026-04-11 00:18:22 -07:00
gsxdsm
5efe862c68 feat(FN-1413): merge fusion/fn-1413 2026-04-10 23:20:39 -07:00
gsxdsm
a9e9abed9e fix(FN-1426): re-export PROMPT_KEY_CATALOG from types.ts for vite alias compatibility 2026-04-10 22:37:58 -07:00
gsxdsm
33cfef2592 feat(FN-1426): add tests for prompt override edit/reset/save behavior 2026-04-10 22:33:29 -07:00
gsxdsm
72d7de1835 feat(FN-1426): add Prompts section to Settings modal with per-prompt editor UI 2026-04-10 22:27:41 -07:00