Skip to content

Mission Lifecycle Events

The mission-lifecycle families record the coarse-grained shape of a mission: when it is created and closed, which phase it is in, when it is completed, cancelled or reopened, and how a single automated run advances through its steps. They are emitted by the Spec Kitty CLI and runtime as a mission progresses and are consumed by the SaaS journal, the mission dashboard and any reducer that needs a mission’s current status.

Three modules carry these families. lifecycle.py holds the mission-level events and the authoritative lifecycle reducer; project_lifecycle.py holds the project-and-artifact events that frame the planning phases and work packages; mission_next.py holds the run-execution family that drives one mission run.

Mission-level lifecycle — lifecycle.py

The mission-level family tracks a mission’s catalog entry and its status over time. Its reducer also delegates work-package reduction to the status family.

Event typePayload modelMeaning
MissionCreatedMissionCreatedPayloadA mission is entered in the catalog (optional actor, carries who created it).
MissionClosedMissionClosedPayloadThe catalog entry is closed.
MissionStartedMissionStartedPayloadThe mission becomes active; sets mission_id, mission_type and the initial phase.
MissionCompletedMissionCompletedPayloadThe mission reaches the terminal completed status.
MissionCancelledMissionCancelledPayloadThe mission reaches the terminal cancelled status.
MissionOriginBoundMissionOriginBoundPayloadThe mission is bound to its origin (e.g. an upstream reference).
PhaseEnteredPhaseEnteredPayloadThe mission enters a named phase; appended to the ordered phases_entered.
ReviewRollbackReviewRollbackPayloadA review sends work backward; applied last within a concurrent group.
MissionReopenedMissionReopenedPayloadA completed/cancelled mission returns to the actionable reopened state.
FollowUpRecordedFollowUpRecordedPayloadA follow-up is recorded against the mission.

The status vocabulary is MissionStatus: active, completed, cancelled and reopened. Only completed and cancelled are in TERMINAL_MISSION_STATUSES; reopened is deliberately non-terminal, so a fresh MissionCompleted after a reopen is processed normally rather than flagged as a post-terminal anomaly. The nine mission-level types above make up MISSION_EVENT_TYPES (MissionOriginBound is defined as a type but is not a member of that frozenset).

MissionStarted

MissionCompleted

MissionCancelled

MissionReopened

MissionReopened

MissionCompleted

MissionCancelled

active

completed

cancelled

reopened

Reducer. reduce_lifecycle_events folds a sequence of events into a frozen ReducedMissionState — mission_id, mission_status, mission_type, current_phase, the ordered phases_entered, a wp_states map, anomalies, event_count and last_processed_event_id. It filters mission-level events to MISSION_EVENT_TYPES, delegates every WPStatusChanged event to reduce_status_events (see work and status), and merges the resulting WPState map into wp_states.

Durability. These events are journaled and reduced into durable state. A subset — MissionCreated, MissionClosed and PhaseEntered — is also projected onto the volatile Zeitgeist relay (VOLATILE_EVENT_TYPES in zeitgeist_attrs.py) as live mission moments.

Project and artifact lifecycle — project_lifecycle.py

This family frames project initialization, the three planning-phase artifacts, and work-package bookkeeping. It defines payloads and three grouped frozensets; it has no reducer of its own.

Event typePayload modelMeaning
ProjectInitializedProjectInitializedPayloadA project is initialized.
SpecifyStarted / SpecifyCompletedSpecifyStartedPayload / SpecifyCompletedPayloadThe specify artifact phase opens / closes.
PlanStarted / PlanCompletedPlanStartedPayload / PlanCompletedPayloadThe plan artifact phase opens / closes.
TasksStarted / TasksCompletedTasksStartedPayload / TasksCompletedPayloadThe tasks artifact phase opens / closes.
WPCreatedWPCreatedPayloadA work package is created.
WPAssignedWPAssignedPayloadA work package is assigned.
HistoryAddedHistoryAddedPayloadA history entry is added to a work package.
ErrorLoggedErrorLoggedPayloadAn error is logged against a work package.
DependencyResolvedDependencyResolvedPayloadA work-package dependency is resolved.

The groupings are PROJECT_LIFECYCLE_EVENT_TYPES (ProjectInitialized), ARTIFACT_LIFECYCLE_EVENT_TYPES (the six Specify/Plan/Tasks types) and WP_LIFECYCLE_EVENT_TYPES (the five WP types); their union is CANONICAL_LIFECYCLE_EVENT_TYPES. The artifact phases are enumerated by ArtifactPhase (specify, plan, tasks).

Durability. Journaled. The six artifact-phase start/complete types are also projected onto the volatile relay (VOLATILE_EVENT_TYPES).

Mission run execution — mission_next.py

This family drives a single automated mission run: the sequence of steps a runtime issues, auto-completes, and the decision inputs it blocks on.

Event typePayload modelMeaning
MissionRunStartedMissionRunStartedPayloadA run begins; sets run_id, mission_type and the RuntimeActorIdentity.
NextStepIssuedNextStepIssuedPayloadA step is issued and becomes the current step.
NextStepAutoCompletedNextStepAutoCompletedPayloadThe current step is auto-completed and appended to completed_steps.
DecisionInputRequestedDecisionInputRequestedPayloadThe run requests a decision input, keyed by decision_id.
DecisionInputAnsweredDecisionInputAnsweredPayloadA requested decision is answered.
MissionRunCompletedMissionRunCompletedPayloadThe run reaches the terminal completed status.

MISSION_NEXT_EVENT_TYPES also contains NextStepPlanned (constant NEXT_STEP_PLANNED, string "NextStepPlanned"), which is reserved: its payload contract is deferred until the runtime emits it, so no payload model is defined. The run status vocabulary is MissionRunStatus (running, completed); only completed is terminal (TERMINAL_RUN_STATUSES).

Reducer. reduce_mission_next_events folds run events into a frozen ReducedMissionRunState — run_id, mission_type, run_status, current_step_id, the ordered completed_steps, the pending_decisions and answered_decisions maps (keyed by decision_id), anomalies, event_count and last_processed_event_id.

Durability. Journaled and reduced into durable run state. Every mission-run type (MissionRunStarted, NextStepIssued, NextStepAutoCompleted, DecisionInputRequested, DecisionInputAnswered, MissionRunCompleted) is also projected onto the volatile relay as a live run moment.

See also

Schemas