Skip to main content

PipelineEvent

Enum PipelineEvent 

Source
pub enum PipelineEvent {
Show 14 variants Lifecycle(LifecycleEvent), Planning(PlanningEvent), Development(DevelopmentEvent), Review(ReviewEvent), PromptInput(PromptInputEvent), Agent(AgentEvent), Rebase(RebaseEvent), Commit(CommitEvent), AwaitingDevFix(AwaitingDevFixEvent), ContextCleaned, CheckpointSaved { trigger: CheckpointTrigger, }, FinalizingStarted, PromptPermissionsRestored, LoopRecoveryTriggered { detected_loop: String, loop_count: u32, },
}
Expand description

Pipeline events representing all state transitions.

Events are organized into logical categories for type-safe routing to category-specific reducers. Each category has a dedicated inner enum.

§Event Categories

  • Lifecycle - Pipeline start/stop/resume
  • Planning - Plan generation events
  • Development - Development iteration and continuation events
  • Review - Review pass and fix attempt events
  • Agent - Agent invocation and chain management events
  • Rebase - Git rebase operation events
  • Commit - Commit generation events
  • Miscellaneous events (context cleanup, checkpoints, finalization)

§Example

// Type-safe event construction
let event = PipelineEvent::Agent(AgentEvent::InvocationStarted {
    role: AgentRole::Developer,
    agent: "claude".to_string(),
    model: Some("opus".to_string()),
});

// Pattern matching routes to category handlers
match event {
    PipelineEvent::Agent(agent_event) => reduce_agent_event(state, agent_event),
    // ...
}

§⚠️ FROZEN - DO NOT ADD VARIANTS ⚠️

This enum is FROZEN. Adding new top-level variants is PROHIBITED.

§Why is this frozen?

PipelineEvent provides category-based event routing to the reducer. The existing categories (Lifecycle, Planning, Development, Review, etc.) cover all pipeline phases. Adding new top-level variants would indicate a missing architectural abstraction or an attempt to bypass phase-specific event handling.

§What to do instead

  1. Express events through existing categories - Use the category enums:

    • PlanningEvent for planning phase observations
    • DevelopmentEvent for development phase observations
    • ReviewEvent for review phase observations
    • CommitEvent for commit generation observations
    • AgentEvent for agent invocation observations
    • RebaseEvent for rebase state machine transitions
  2. Return errors for unrecoverable failures - Don’t create events for conditions that should terminate the pipeline. Return Err from the effect handler instead.

  3. Extend category enums if needed - If you truly need a new event within an existing phase, add it to that phase’s category enum (e.g., add a new variant to ReviewEvent rather than creating a new top-level category).

§Enforcement

The freeze policy is enforced by the pipeline_event_is_frozen test in this module, which will fail to compile if new variants are added. This is intentional.

See LifecycleEvent documentation for additional context on the freeze policy rationale.

Variants§

§

Lifecycle(LifecycleEvent)

Pipeline lifecycle events (start, stop, resume).

§

Planning(PlanningEvent)

Planning phase events.

§

Development(DevelopmentEvent)

Development phase events.

§

Review(ReviewEvent)

Review phase events.

§

PromptInput(PromptInputEvent)

Prompt input materialization events.

§

Agent(AgentEvent)

Agent invocation and chain events.

§

Rebase(RebaseEvent)

Rebase operation events.

§

Commit(CommitEvent)

Commit generation events.

§

AwaitingDevFix(AwaitingDevFixEvent)

AwaitingDevFix phase events.

§

ContextCleaned

Context cleanup completed.

§

CheckpointSaved

Checkpoint saved.

Fields

§trigger: CheckpointTrigger

What triggered the checkpoint save.

§

FinalizingStarted

Finalization phase started.

§

PromptPermissionsRestored

PROMPT.md permissions restored.

§

LoopRecoveryTriggered

Loop recovery triggered (tight loop detected and broken).

Fields

§detected_loop: String

String representation of the detected loop.

§loop_count: u32

Number of times the loop was repeated.

Implementations§

§

impl PipelineEvent

pub fn pipeline_started() -> Self

Create a PipelineStarted event.

pub fn pipeline_resumed(from_checkpoint: bool) -> Self

Create a PipelineResumed event.

pub fn pipeline_completed() -> Self

Create a PipelineCompleted event.

pub fn planning_phase_started() -> Self

Create a PlanningPhaseStarted event.

pub fn planning_phase_completed() -> Self

Create a PlanningPhaseCompleted event.

pub fn planning_prompt_prepared(iteration: u32) -> Self

Create a PlanningPromptPrepared event.

pub fn planning_agent_invoked(iteration: u32) -> Self

Create a PlanningAgentInvoked event.

pub fn planning_xml_cleaned(iteration: u32) -> Self

Create a PlanningXmlCleaned event.

pub fn planning_xml_extracted(iteration: u32) -> Self

Create a PlanningXmlExtracted event.

pub fn planning_xml_missing(iteration: u32, attempt: u32) -> Self

Create a PlanningXmlMissing event.

pub fn planning_xml_validated( iteration: u32, valid: bool, markdown: Option<String>, ) -> Self

Create a PlanningXmlValidated event.

pub fn planning_markdown_written(iteration: u32) -> Self

Create a PlanningMarkdownWritten event.

pub fn planning_xml_archived(iteration: u32) -> Self

Create a PlanningXmlArchived event.

pub fn plan_generation_completed(iteration: u32, valid: bool) -> Self

Create a PlanGenerationCompleted event.

pub fn planning_output_validation_failed(iteration: u32, attempt: u32) -> Self

Create a PlanningOutputValidationFailed event.

§

impl PipelineEvent

pub fn prompt_input_oversize_detected( phase: PipelinePhase, kind: PromptInputKind, content_id_sha256: String, size_bytes: u64, limit_bytes: u64, policy: String, ) -> Self

pub fn planning_inputs_materialized( iteration: u32, prompt: MaterializedPromptInput, ) -> Self

pub fn development_inputs_materialized( iteration: u32, prompt: MaterializedPromptInput, plan: MaterializedPromptInput, ) -> Self

pub fn review_inputs_materialized( pass: u32, plan: MaterializedPromptInput, diff: MaterializedPromptInput, ) -> Self

pub fn commit_inputs_materialized( attempt: u32, diff: MaterializedPromptInput, ) -> Self

pub fn xsd_retry_last_output_materialized( phase: PipelinePhase, scope_id: u32, last_output: MaterializedPromptInput, ) -> Self

§

impl PipelineEvent

pub fn development_phase_started() -> Self

Create a DevelopmentPhaseStarted event.

pub fn development_iteration_started(iteration: u32) -> Self

Create a DevelopmentIterationStarted event.

pub fn development_context_prepared(iteration: u32) -> Self

Create a DevelopmentContextPrepared event.

pub fn development_prompt_prepared(iteration: u32) -> Self

Create a DevelopmentPromptPrepared event.

pub fn development_agent_invoked(iteration: u32) -> Self

Create a DevelopmentAgentInvoked event.

pub fn development_xml_extracted(iteration: u32) -> Self

Create a DevelopmentXmlExtracted event.

pub fn development_xml_cleaned(iteration: u32) -> Self

Create a DevelopmentXmlCleaned event.

pub fn development_xml_missing(iteration: u32, attempt: u32) -> Self

Create a DevelopmentXmlMissing event.

pub fn development_xml_validated( iteration: u32, status: DevelopmentStatus, summary: String, files_changed: Option<Vec<String>>, next_steps: Option<String>, ) -> Self

Create a DevelopmentXmlValidated event.

pub fn development_outcome_applied(iteration: u32) -> Self

Create a DevelopmentOutcomeApplied event.

pub fn development_xml_archived(iteration: u32) -> Self

Create a DevelopmentXmlArchived event.

pub fn development_iteration_completed( iteration: u32, output_valid: bool, ) -> Self

Create a DevelopmentIterationCompleted event.

pub fn development_phase_completed() -> Self

Create a DevelopmentPhaseCompleted event.

pub fn development_iteration_continuation_triggered( iteration: u32, status: DevelopmentStatus, summary: String, files_changed: Option<Vec<String>>, next_steps: Option<String>, ) -> Self

Create a DevelopmentIterationContinuationTriggered event.

pub fn development_iteration_continuation_succeeded( iteration: u32, total_continuation_attempts: u32, ) -> Self

Create a DevelopmentIterationContinuationSucceeded event.

pub fn development_output_validation_failed( iteration: u32, attempt: u32, ) -> Self

Create a DevelopmentOutputValidationFailed event.

pub fn development_continuation_budget_exhausted( iteration: u32, total_attempts: u32, last_status: DevelopmentStatus, ) -> Self

Create a DevelopmentContinuationBudgetExhausted event.

pub fn development_continuation_context_written( iteration: u32, attempt: u32, ) -> Self

Create a DevelopmentContinuationContextWritten event.

pub fn development_continuation_context_cleaned() -> Self

Create a DevelopmentContinuationContextCleaned event.

§

impl PipelineEvent

pub fn review_phase_started() -> Self

Create a ReviewPhaseStarted event.

pub fn review_pass_started(pass: u32) -> Self

Create a ReviewPassStarted event.

pub fn review_context_prepared(pass: u32) -> Self

Create a ReviewContextPrepared event.

pub fn review_prompt_prepared(pass: u32) -> Self

Create a ReviewPromptPrepared event.

pub fn review_agent_invoked(pass: u32) -> Self

Create a ReviewAgentInvoked event.

pub fn review_issues_xml_extracted(pass: u32) -> Self

Create a ReviewIssuesXmlExtracted event.

pub fn review_issues_xml_cleaned(pass: u32) -> Self

Create a ReviewIssuesXmlCleaned event.

pub fn review_issues_xml_missing( pass: u32, attempt: u32, error_detail: Option<String>, ) -> Self

Create a ReviewIssuesXmlMissing event.

pub fn review_issues_xml_validated( pass: u32, issues_found: bool, clean_no_issues: bool, issues: Vec<String>, no_issues_found: Option<String>, ) -> Self

Create a ReviewIssuesXmlValidated event.

pub fn review_issues_markdown_written(pass: u32) -> Self

pub fn review_issue_snippets_extracted(pass: u32) -> Self

pub fn review_issues_xml_archived(pass: u32) -> Self

pub fn fix_prompt_prepared(pass: u32) -> Self

pub fn fix_agent_invoked(pass: u32) -> Self

pub fn fix_result_xml_extracted(pass: u32) -> Self

pub fn fix_result_xml_missing( pass: u32, attempt: u32, error_detail: Option<String>, ) -> Self

pub fn fix_result_xml_validated( pass: u32, status: FixStatus, summary: Option<String>, ) -> Self

pub fn fix_result_xml_cleaned(pass: u32) -> Self

pub fn fix_outcome_applied(pass: u32) -> Self

pub fn fix_result_xml_archived(pass: u32) -> Self

pub fn review_completed(pass: u32, issues_found: bool) -> Self

Create a ReviewCompleted event.

pub fn fix_attempt_started(pass: u32) -> Self

Create a FixAttemptStarted event.

pub fn fix_attempt_completed(pass: u32, changes_made: bool) -> Self

Create a FixAttemptCompleted event.

pub fn review_phase_completed(early_exit: bool) -> Self

Create a ReviewPhaseCompleted event.

pub fn review_pass_completed_clean(pass: u32) -> Self

Create a ReviewPassCompletedClean event.

pub fn review_output_validation_failed( pass: u32, attempt: u32, error_detail: Option<String>, ) -> Self

Create a ReviewOutputValidationFailed event.

pub fn fix_continuation_triggered( pass: u32, status: FixStatus, summary: Option<String>, ) -> Self

Create a FixContinuationTriggered event.

pub fn fix_continuation_succeeded(pass: u32, total_attempts: u32) -> Self

Create a FixContinuationSucceeded event.

pub fn fix_continuation_budget_exhausted( pass: u32, total_attempts: u32, last_status: FixStatus, ) -> Self

Create a FixContinuationBudgetExhausted event.

pub fn fix_output_validation_failed( pass: u32, attempt: u32, error_detail: Option<String>, ) -> Self

Create a FixOutputValidationFailed event.

§

impl PipelineEvent

pub fn agent_invocation_started( role: AgentRole, agent: String, model: Option<String>, ) -> Self

Create an AgentInvocationStarted event.

pub fn agent_invocation_succeeded(role: AgentRole, agent: String) -> Self

Create an AgentInvocationSucceeded event.

pub fn agent_invocation_failed( role: AgentRole, agent: String, exit_code: i32, error_kind: AgentErrorKind, retriable: bool, ) -> Self

Create an AgentInvocationFailed event.

pub fn agent_fallback_triggered( role: AgentRole, from_agent: String, to_agent: String, ) -> Self

Create an AgentFallbackTriggered event.

pub fn agent_model_fallback_triggered( role: AgentRole, agent: String, from_model: String, to_model: String, ) -> Self

Create an AgentModelFallbackTriggered event.

pub fn agent_retry_cycle_started(role: AgentRole, cycle: u32) -> Self

Create an AgentRetryCycleStarted event.

pub fn agent_chain_exhausted(role: AgentRole) -> Self

Create an AgentChainExhausted event.

pub fn agent_chain_initialized( role: AgentRole, agents: Vec<String>, max_cycles: u32, retry_delay_ms: u64, backoff_multiplier: f64, max_backoff_ms: u64, ) -> Self

Create an AgentChainInitialized event.

pub fn agent_rate_limited( role: AgentRole, agent: String, prompt_context: Option<String>, ) -> Self

Create an AgentRateLimited event.

pub fn agent_auth_failed(role: AgentRole, agent: String) -> Self

Create an AgentAuthFailed event.

pub fn agent_timed_out(role: AgentRole, agent: String) -> Self

Create an AgentTimedOut event.

pub fn agent_session_established( role: AgentRole, agent: String, session_id: String, ) -> Self

Create an AgentSessionEstablished event.

pub fn agent_xsd_validation_failed( role: AgentRole, artifact: ArtifactType, error: String, retry_count: u32, ) -> Self

Create an AgentXsdValidationFailed event.

pub fn agent_template_variables_invalid( role: AgentRole, template_name: String, missing_variables: Vec<String>, unresolved_placeholders: Vec<String>, ) -> Self

Create an AgentTemplateVariablesInvalid event.

§

impl PipelineEvent

pub fn rebase_started(phase: RebasePhase, target_branch: String) -> Self

Create a RebaseStarted event.

pub fn rebase_conflict_detected(files: Vec<PathBuf>) -> Self

Create a RebaseConflictDetected event.

pub fn rebase_conflict_resolved(files: Vec<PathBuf>) -> Self

Create a RebaseConflictResolved event.

pub fn rebase_succeeded(phase: RebasePhase, new_head: String) -> Self

Create a RebaseSucceeded event.

pub fn rebase_failed(phase: RebasePhase, reason: String) -> Self

Create a RebaseFailed event.

pub fn rebase_aborted(phase: RebasePhase, restored_to: String) -> Self

Create a RebaseAborted event.

pub fn rebase_skipped(phase: RebasePhase, reason: String) -> Self

Create a RebaseSkipped event.

pub fn commit_generation_started() -> Self

Create a CommitGenerationStarted event.

pub fn commit_diff_prepared(empty: bool, content_id_sha256: String) -> Self

Create a CommitDiffPrepared event.

pub fn commit_diff_failed(error: String) -> Self

Create a CommitDiffFailed event.

pub fn commit_diff_invalidated(reason: String) -> Self

pub fn commit_prompt_prepared(attempt: u32) -> Self

Create a CommitPromptPrepared event.

pub fn commit_agent_invoked(attempt: u32) -> Self

Create a CommitAgentInvoked event.

pub fn commit_xml_extracted(attempt: u32) -> Self

Create a CommitXmlExtracted event.

pub fn commit_xml_missing(attempt: u32) -> Self

Create a CommitXmlMissing event.

pub fn commit_xml_validated(message: String, attempt: u32) -> Self

Create a CommitXmlValidated event.

pub fn commit_xml_validation_failed(reason: String, attempt: u32) -> Self

Create a CommitXmlValidationFailed event.

pub fn commit_xml_archived(attempt: u32) -> Self

Create a CommitXmlArchived event.

pub fn commit_xml_cleaned(attempt: u32) -> Self

pub fn commit_message_generated(message: String, attempt: u32) -> Self

Create a CommitMessageGenerated event.

pub fn commit_message_validation_failed(reason: String, attempt: u32) -> Self

Create a CommitMessageValidationFailed event.

pub fn commit_created(hash: String, message: String) -> Self

Create a CommitCreated event.

pub fn commit_generation_failed(reason: String) -> Self

Create a CommitGenerationFailed event.

pub fn commit_skipped(reason: String) -> Self

Create a CommitSkipped event.

pub fn context_cleaned() -> Self

Create a ContextCleaned event.

pub fn checkpoint_saved(trigger: CheckpointTrigger) -> Self

Create a CheckpointSaved event.

pub fn finalizing_started() -> Self

Create a FinalizingStarted event.

pub fn prompt_permissions_restored() -> Self

Create a PromptPermissionsRestored event.

Source§

impl PipelineEvent

Source

pub fn loop_recovery_triggered(detected_loop: String, loop_count: u32) -> Self

Construct a LoopRecoveryTriggered event.

Trait Implementations§

Source§

impl Clone for PipelineEvent

Source§

fn clone(&self) -> PipelineEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PipelineEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PipelineEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PipelineEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,