Commit Graph

1887 Commits

Author SHA1 Message Date
gsxdsm
d2182dc48f scrutiny: round 4 synthesis for execution-loop milestone
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 20:19:03 -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
32b1a2aacc scrutiny: round 3 synthesis for execution-loop milestone
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 20:03:33 -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
4929661674 test(data-model): add user-testing synthesis for milestone validation
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 17:53:55 -07:00
gsxdsm
164053ad83 chore: add data-model milestone scrutiny synthesis
Scrutiny validation for data-model milestone:
- All 3 features pass (FEAT-001, FEAT-002, FEAT-003)
- 28 VAL-DM validation contract items addressed
- Test suite passes (2212 core + 1889 engine tests)
- Typecheck passes
- Lint has pre-existing errors unrelated to data-model features
2026-04-11 17:46:02 -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
aa1866cc82 chore: add mission infrastructure for execution loop validation system
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-11 16:06:24 -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
2a0e9bc5e5 docs(FN-1426): restore memory file with vite alias pitfall 2026-04-10 22:43:28 -07:00
gsxdsm
7576331a6c docs(FN-1426): update project memory with vite alias pitfall 2026-04-10 22:42:28 -07:00
gsxdsm
8c1fce0011 feat(FN-1426): update docs with new Prompts section in Settings modal 2026-04-10 22:38:52 -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
gsxdsm
3fdd04d6cb feat(FN-1583): merge fusion/fn-1583 2026-04-10 22:20:39 -07:00
gsxdsm
05229a5c0f fix(FN-1567): fix plugin loader type and ntfy events test
- Fix ConstructorParameters type in plugin loader
- Update ntfy events test to expect awaiting-user-review event
2026-04-10 21:52:58 -07:00
gsxdsm
34b2af26a7 Fix task card step progress 2026-04-10 21:46:06 -07:00
gsxdsm
e258279a5f feat(FN-1567): add mission contract assertions model types and APIs
- Add mission contract assertions model with types: ContractAssertion, ContractAssertionStatus, ContractAssertionType
- Add assertions table to schema v29 with migration from v28
- Implement assertion APIs: create, update, link/unlink to features, list, getWithContext
- Add rollup computation (assertion counts, pass rates) for missions and milestones
- Add many-to-many feature-to-assertion linking via featureAssertions table
- Add project memory documentation for assertion lifecycle and patterns
- Update schema version assertions in db.test.ts, run-audit.test.ts, and task-documents.test.ts
2026-04-10 21:29:54 -07:00
gsxdsm
c812bdbc2a feat(FN-1578): merge fusion/fn-1578 2026-04-10 21:23:06 -07:00
gsxdsm
39ffb4b456 feat(FN-1562): merge fusion/fn-1562 2026-04-10 21:22:59 -07:00
gsxdsm
7be8c17279 feat(FN-1490): merge fusion/fn-1490 2026-04-10 21:22:50 -07:00
gsxdsm
ed700ba1d1 fix(dashboard): restore jest-dom matchers in QuickEntryBox/InlineCreateCard tests
Changed @testing-library/jest-dom import to @testing-library/jest-dom/vitest
in vitest.setup.ts to properly provide type definitions for jest-dom matchers
like toBeInTheDocument, toHaveClass, toBeDisabled, and toHaveAttribute in the
vitest environment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 21:22:34 -07:00
gsxdsm
1bf4db2277 fix(types): correct GitHubOperations interface and test type assertions
- Tighten GitHubOperations.findPrForBranch and mergePr param types to
  match the literal unions in FindPrParams/MergePrParams, fixing the
  GitHubClient assignability error in dashboard.ts and serve.ts
- Cast MockStore as unknown as TaskStore at mesh-routes.test.ts call
  site to satisfy TaskStore shape without implementing 117 methods
- Double-cast AgentGenerationSession via unknown in agent-generation.test.ts
  to silence the unsafe conversion diagnostic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 21:16:42 -07:00
gsxdsm
1a3ff011d3 chore: snapshot WIP across dashboard, engine, and core
Bundles staged work-in-progress modifications across multiple packages
(routes, store, agent-instructions, self-healing, QuickEntryBox, etc.)
plus the dashboard theme-data.css preload fix.

Note: an unstaged 621-line deletion in .fusion/memory.md was deliberately
NOT committed — it appears to be an accidental overwrite of architecture
notes and is left in the working tree for review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 21:12:40 -07:00
gsxdsm
534fcf20b6 docs(FN-1567): add project memory for mission contract assertions pattern 2026-04-10 21:10:26 -07:00