- Add dashboard API routes and mission interview store support to list and inspect draft missions - Update Mission Manager UI to surface draft interview sessions with styling and regression coverage - Extend CLI mission commands and extension tools to expose draft listings consistently - Document the draft surfacing behavior and include a changeset for the published CLI package Fusion-Task-Id: FN-4124
16 KiB
Missions
Missions provide structured planning across multiple related tasks.
Roadmaps are a separate lightweight planning model (
Roadmap → RoadmapMilestone → RoadmapFeature) used for standalone planning. Missions remain the richer execution-oriented hierarchy when you need slice activation, autopilot, and feature-to-task delivery tracking.
Mission Hierarchy
Fusion models delivery as:
Mission → Milestone → Slice → Feature → Task
Example:
Mission: Improve Reliability
Milestone: Stabilize execution pipeline
Slice: Retry and recovery hardening
Feature: Stuck task recovery improvements
Task: FN-210
Task: FN-214
Creating Missions
Dashboard
Use the Mission Manager UI to create missions and build hierarchy interactively.
On mobile, Mission Manager surfaces the primary Plan New Mission CTA at the top of the mission list for faster access, while desktop keeps the split-layout sidebar CTA anchored in the bottom action region as the primary entry point.
CLI
fn mission create "Reliability initiative" "Reduce execution failures and improve recovery"
fn mission list
fn mission show mission_123
fn mission activate-slice slice_456
fn mission delete mission_123 --force
Mission Interview and Planning Workflow
The dashboard supports mission planning workflows where you can:
- Define mission outcomes
- Break work into milestones/slices/features
- Associate features to executable tasks
- Track progress at each layer
- Persisted missions with
interviewState: "in_progress"remain visible as interview-styled mission cards in the main mission list so planning work does not disappear after reloads - Resume in-progress mission interview sessions directly from separate transient session rows in the main missions list (
mission_interviewsessions ingenerating,awaiting_input, orerror) before a mission record is created - Banner-driven mission interview resumes are one-shot: if you close or send the interview to background, Missions re-fetches project-scoped
mission_interviewsessions and re-surfaces the transient row (including on the mobile stacked Missions view) so resume/retry remains discoverable without losing persistedinterviewState: "in_progress"mission cards
Mission Interview Drafts
Mission interview sessions are persisted in ai_sessions before a mission row exists, so unfinished drafts stay recoverable across reloads and restarts.
- Dashboard: the Missions view shows a Drafts section for in-flight
mission_interviewsessions with Resume and Discard actions. - CLI:
fn mission listshows drafts by default before normal mission status sections. Pass--no-draftsto hide them. - pi extension:
fn_mission_listincludes drafts by default and acceptsincludeDrafts: falseto suppress them. - Discarding drafts: discarding removes the
ai_sessionsrow even for cold drafts after a server restart.
Mission interview draft endpoints:
| Endpoint | Purpose |
|---|---|
GET /api/missions/interview/drafts |
List in-flight mission interview drafts |
POST /api/missions/interview/drafts/:sessionId/discard |
Discard a draft session |
Auto-Generated Assertions
When missions are created through the interview planning workflow, Fusion automatically generates contract assertions for each feature:
- Assertion text source priority:
acceptanceCriteria→feature.description→ fallback text ("Verify implementation of: {feature.title}") - Assertions are linked to features: Each auto-generated assertion is automatically linked to its feature, enabling mission validation rollup and enriched planning context
- Verification fields: Milestone and slice verification criteria from the interview are stored in dedicated
verificationfields rather than concatenated into descriptions - Partial plans handled: Auto-generation is robust to partial plans (missing slices/features or empty criteria) without throwing errors
Slice Activation and Progress
Slices represent staged execution windows.
- Pending slices remain inactive
- Active slices are currently allowed to progress
- Completion rolls up through feature → slice → milestone → mission
Manual activation is available through fn mission activate-slice <slice-id>.
Mission Autopilot
When autopilotEnabled is on, Fusion can watch completion events and progress missions automatically.
State machine:
inactivewatchingactivatingcompleting
Typical flow:
- Mission is watched
- Task completion updates feature status
- If a slice is complete, autopilot activates next pending slice
- When milestones are all complete, mission transitions to complete
autopilotEnabled vs autoAdvance
autopilotEnabled: primary control for autopilot behavior — enables background monitoring, orchestration, and automatic slice activation when a slice completes. Also triggers auto-planning (converting features to tasks) when a slice is activated.autoAdvance: legacy fallback for backward compatibility with existing mission data. Kept for compatibility — new missions should useautopilotEnabled.
Auto-planning behavior:
autopilotEnabled=true→ features in activated slices are automatically planned (converted to tasks)autopilotEnabled=false,autoAdvance=true→ features are planned (legacy compat)autopilotEnabled=false,autoAdvance=false→ manual slice activation only
Slice progression (on slice completion):
autopilotEnabled=true→ next pending slice is automatically activatedautopilotEnabled=false,autoAdvance=true→ next pending slice is activated (legacy compat)autopilotEnabled=false,autoAdvance=false→ manual activation required
Dashboard UI: The Mission Manager shows autopilotEnabled as the primary control. When enabling autopilot on an already-active mission, the system automatically checks whether recovery is needed (no active slice or completed active slice) and progresses accordingly.
Autopilot API Endpoints
| Endpoint | Purpose |
|---|---|
GET /api/missions/:missionId/autopilot |
Get autopilot status for mission |
PATCH /api/missions/:missionId/autopilot |
Enable/disable autopilot ({ enabled: boolean }) |
POST /api/missions/:missionId/autopilot/start |
Start watching manually |
POST /api/missions/:missionId/autopilot/stop |
Stop watching manually |
Validation Contract Lifecycle
Fusion's validation contract lifecycle is the structured feature delivery system for missions. It combines validation contracts, AI validation, and bounded retries to provide systematic, auditable feature completion. The lifecycle covers the full end-to-end path from clarification through blocked handoff.
End-to-End Flow
Clarification → Validation Contract → Feature Execution → Validator Loop
↑ ↓
│ Fix-Feature Retry ←─ (budget exhausted?) ←───────────┘
│
Blocked Handoff ←── (budget exhausted, root cause unresolvable)
Phase 1: Clarification
The clarification phase occurs during mission interview and planning. Operators define:
- Milestone outcomes and slice verification criteria stored in dedicated
verificationfields - Feature descriptions and acceptance criteria
These inputs flow directly into assertion auto-generation in the next phase.
Phase 2: Validation Contract
Contract assertions (MissionContractAssertion) formalize what must be true for a feature to be considered complete:
interface MissionContractAssertion {
id: string; // e.g., "CA-A3B7CD-E9F2"
milestoneId: string; // Parent milestone
title: string; // Human-readable title
assertion: string; // Behavioral plan
status: AssertionStatus; // pending | passed | failed | blocked
orderIndex: number; // Sort order within milestone
featureIds: string[]; // Linked features (many-to-many)
}
Assertion text source priority:
acceptanceCriteria(from feature planning)feature.description(fallback)- Fallback text:
"Verify implementation of: {feature.title}"
Coverage tracking: MilestoneValidationRollup computes per-milestone coverage:
interface MilestoneValidationRollup {
milestoneId: string;
totalAssertions: number;
passed: number;
failed: number;
blocked: number;
pending: number;
unlinked: number;
state: MilestoneValidationState;
}
Validation state precedence (highest priority wins):
not_started— no assertions existneeds_coverage— assertions exist but some are not linked to featuresready— assertions exist and are linked, but not all have passedpassed— all assertions have passedfailed— at least one assertion failedblocked— at least one assertion is blocked
Phase 3: Feature Execution Loop
Features track their implementation state via FeatureLoopState separate from task status:
type FeatureLoopState =
| "idle" // Not yet started
| "implementing" // Tasks are in-flight
| "validating" // Awaiting AI validation
| "needs_fix" // Validation failed, retry in progress
| "passed" // All assertions passed
| "blocked"; // Retry budget exhausted, cannot proceed
State transitions:
idle → implementing → validating → passed (all assertions pass)
↓
needs_fix → implementing (retry feature created)
↓
blocked (budget exhausted)
When a feature enters the implementing state, implementationAttemptCount is initialized and incremented on each retry.
Phase 4: Validator Loop
On task completion, the scheduler calls MissionExecutionLoop.processTaskOutcome() to run AI validation:
- Find the feature linked to the completed task
- Transition feature to
validatingstate - Fire AI validator agent against contract assertions
- Record
MissionValidatorRunwith per-assertion results
Validation runs are internal mission-loop operations: Fusion does not create visible 🔍 Validate: board tasks for single-feature validation.
interface MissionValidatorRun {
id: string;
featureId: string;
missionId: string;
taskId: string;
triggerType: "manual" | "automatic";
implementationAttempt: number;
validatorAttempt: number;
status: "started" | "passed" | "failed" | "blocked" | "error";
summary: string;
results: AssertionResult[];
blockedReason?: string;
startedAt: string;
completedAt?: string;
}
Validation timeout: 10 minutes (VALIDATION_TIMEOUT_MS = 10 * 60 * 1000). If the validator times out, the run is marked error and the feature remains in needs_fix for retry.
Phase 5: Fix-Feature Retries
When validation fails, MissionStore.createGeneratedFixFeature() creates a fix feature with lineage tracking:
interface MissionFixFeatureLineage {
sourceFeatureId: string; // Original feature being remediated
fixFeatureId: string; // New fix feature
runId: string; // Validator run that triggered this fix
failedAssertionIds: string[]; // Assertions that failed
}
The fix feature is auto-planned (converted to tasks) for immediate execution. Each fix increments implementationAttemptCount.
Default retry budget: 3 (DEFAULT_IMPLEMENTATION_RETRY_BUDGET). When implementationAttemptCount >= maxRetryBudget, the feature transitions to blocked.
Phase 6: Blocked Handoff
A feature transitions to blocked when:
- All retry budget is exhausted (
implementationAttemptCount >= maxRetryBudget) - Validation continues to fail
- Root cause cannot be resolved through iteration
Blocked semantics:
- Autopilot stops advancing the slice containing the blocked feature
MilestoneValidationRollup.statereflectsblockedassertions- The feature remains in
blockedstate until operator intervention
On engine restart, recoverActiveMissions() re-enqueues features in validating or needs_fix states from the activeValidations set, ensuring no validation work is lost.
Autopilot / Scheduler Interplay
The scheduler and autopilot collaborate through a carefully ordered call sequence:
1. Task completes → scheduler detects completion
2. scheduler.missionExecutionLoop.processTaskOutcome() — validation FIRST
- Finds linked feature, runs AI validation, records MissionValidatorRun
3. autopilot.handleTaskCompletion() — feature status sync SECOND
- Syncs feature status from task state, advances slice if complete
4. scheduler filters blocked missions from further advancement (line ~532)
Autopilot vs Execution Loop retry tracking:
- Autopilot: Per-task retry tracking for slice/feature completion events
- Execution Loop:
implementationAttemptCountfor retry budget enforcement (default: 3)
These are independent tracking mechanisms — autopilot monitors mission progress while the execution loop manages feature-level retry budgets.
Telemetry and Observability
MissionHealth snapshot fields:
activeSlices,activeFeatures,blockedFeaturesvalidationState,validationRollupinProgressCount,passedCount,failedCount,blockedCount
MissionEvent audit types:
slice_activated,feature_planned,feature_completedvalidation:started,validation:passed,validation:failed,validation:blockedfix_feature:created,feature:blocked
Validator run telemetry:
triggerType— manual vs automaticimplementationAttempt— which retry attempt this wasvalidatorAttempt— how many validator runs for this implementationstatus— started | passed | failed | blocked | errorsummary— natural language summary of results
Assertion failure records:
interface MissionAssertionFailureRecord {
assertionId: string;
assertionTitle: string;
expected: string;
actual: string;
message: string;
}
Full state snapshots: MissionFeatureLoopSnapshot captures complete loop state including all validator runs and lineage chains for post-mortem analysis.
Operator Troubleshooting
| Symptom | Diagnosis | Resolution |
|---|---|---|
| Feature stuck in "validating" | activeValidations set may be stale; engine restart needed |
Check logs for validator errors; restart engine to trigger recoverActiveMissions() |
| Fix feature not auto-planning | planFeature() may have errored; check logs |
Manual planning via fn mission plan-feature <id>; investigate planFeature() errors |
| Budget exhaustion loop | implementationAttemptCount >= maxRetryBudget (default: 3) |
Increase maxRetryBudget in mission settings or fix root cause |
| Blocked mission not advancing | MilestoneValidationRollup.state shows blocked |
Identify blocked assertions; operator must resolve root cause |
| Validation agent errors | AI session creation failed or VALIDATION_TIMEOUT_MS (10 min) exceeded |
Check model configuration and logs; verify AI provider auth |
| No validation runs after task completion | processTaskOutcome() not called; check scheduler logs |
Verify mission linkage on feature → task mapping; check scheduler event handlers |
| Recovery after engine restart | Features in validating/needs_fix state may not re-enqueue |
recoverActiveMissions() should run on startup; check recovery log count |
Parity Verification Tests
This lifecycle is validated by integration tests in two dependent tasks:
FN-1571 — Core parity tests:
packages/core/src/mission-factory-parity.integration.test.ts— MissionStore rollups, assertion persistence, validator run records, fix feature lineagepackages/engine/src/mission-factory-parity.integration.test.ts— Scheduler/autopilot/runtime parity with the validation loop
FN-1572 — Dashboard parity tests:
packages/dashboard/src/mission-e2e.test.ts— API contract telemetry round-trip (MissionContractAssertion → validator run → MissionHealth)packages/dashboard/app/components/__tests__/MissionManager.test.tsx— UI blocked/iterating state rendering
Screenshot
See also: Multi-Project and Task Management.
