feat(FN-1453): fix mission autopilot progression and state refresh

- Fix mission autopilot slice activation when tasks complete
- Fix state refresh in MissionManager to properly reflect autopilot status
- Fix scheduler to correctly trigger autopilot progression events
- Add unit tests for mission store autopilot state transitions
- Add component tests for MissionManager autopilot toggle and state display
- Add e2e tests for mission autopilot lifecycle (enable → task completion → slice progression)
- Update documentation with autopilot state machine details
This commit is contained in:
gsxdsm
2026-04-09 16:12:58 -07:00
parent 5abd2d2cad
commit 2dd775ebf3
9 changed files with 456 additions and 13 deletions

View File

@@ -1252,7 +1252,9 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
const milestone = this.getMilestone(slice.milestoneId);
const mission = milestone ? this.getMission(milestone.missionId) : undefined;
const shouldAutoTriage = mission?.autoAdvance === true;
// Use autopilotEnabled as canonical, fall back to autoAdvance for backward compat
const shouldAutoTriage =
mission?.autopilotEnabled === true || mission?.autoAdvance === true;
const now = new Date().toISOString();
const updated = this.updateSlice(id, {
@@ -1260,7 +1262,7 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
activatedAt: now,
});
// Auto-triage features if autoAdvance is enabled
// Auto-triage features if autopilot is enabled (or legacy autoAdvance)
if (shouldAutoTriage) {
try {
await this.triageSlice(id);