Skip to main content

PipelineState

Struct PipelineState 

Source
pub struct PipelineState {
Show 56 fields pub phase: PipelinePhase, pub previous_phase: Option<PipelinePhase>, pub iteration: u32, pub total_iterations: u32, pub reviewer_pass: u32, pub total_reviewer_passes: u32, pub review_issues_found: bool, pub planning_prompt_prepared_iteration: Option<u32>, pub planning_xml_cleaned_iteration: Option<u32>, pub planning_agent_invoked_iteration: Option<u32>, pub planning_xml_extracted_iteration: Option<u32>, pub planning_validated_outcome: Option<PlanningValidatedOutcome>, pub planning_markdown_written_iteration: Option<u32>, pub planning_xml_archived_iteration: Option<u32>, pub development_context_prepared_iteration: Option<u32>, pub development_prompt_prepared_iteration: Option<u32>, pub development_xml_cleaned_iteration: Option<u32>, pub development_agent_invoked_iteration: Option<u32>, pub analysis_agent_invoked_iteration: Option<u32>, pub development_xml_extracted_iteration: Option<u32>, pub development_validated_outcome: Option<DevelopmentValidatedOutcome>, pub development_xml_archived_iteration: Option<u32>, pub review_context_prepared_pass: Option<u32>, pub review_prompt_prepared_pass: Option<u32>, pub review_issues_xml_cleaned_pass: Option<u32>, pub review_agent_invoked_pass: Option<u32>, pub review_issues_xml_extracted_pass: Option<u32>, pub review_validated_outcome: Option<ReviewValidatedOutcome>, pub review_issues_markdown_written_pass: Option<u32>, pub review_issue_snippets_extracted_pass: Option<u32>, pub review_issues_xml_archived_pass: Option<u32>, pub fix_prompt_prepared_pass: Option<u32>, pub fix_result_xml_cleaned_pass: Option<u32>, pub fix_agent_invoked_pass: Option<u32>, pub fix_result_xml_extracted_pass: Option<u32>, pub fix_validated_outcome: Option<FixValidatedOutcome>, pub fix_result_xml_archived_pass: Option<u32>, pub commit_prompt_prepared: bool, pub commit_diff_prepared: bool, pub commit_diff_empty: bool, pub commit_diff_content_id_sha256: Option<String>, pub commit_agent_invoked: bool, pub commit_xml_cleaned: bool, pub commit_xml_extracted: bool, pub commit_validated_outcome: Option<CommitValidatedOutcome>, pub commit_xml_archived: bool, pub context_cleaned: bool, pub agent_chain: AgentChainState, pub rebase: RebaseState, pub commit: CommitState, pub execution_history: Vec<ExecutionStep>, pub checkpoint_saved_count: u32, pub continuation: ContinuationState, pub metrics: RunMetrics, pub dev_fix_triggered: bool, pub prompt_inputs: PromptInputsState,
}
Expand description

Immutable pipeline state - the single source of truth for pipeline progress.

This struct captures complete execution context and doubles as the checkpoint data structure for resume functionality. Serialize it to JSON to save state; deserialize to resume interrupted runs.

§Invariants

  • iteration is always <= total_iterations
  • reviewer_pass is always <= total_reviewer_passes
  • agent_chain maintains fallback order and retry counts
  • State transitions only occur through the reduce function

§See Also

Fields§

§phase: PipelinePhase§previous_phase: Option<PipelinePhase>§iteration: u32§total_iterations: u32§reviewer_pass: u32§total_reviewer_passes: u32§review_issues_found: bool§planning_prompt_prepared_iteration: Option<u32>

Tracks whether the planning prompt was prepared for the current iteration.

§planning_xml_cleaned_iteration: Option<u32>

Tracks whether .agent/tmp/plan.xml was cleaned for the current iteration.

§planning_agent_invoked_iteration: Option<u32>

Tracks whether the planning agent was invoked for the current iteration.

§planning_xml_extracted_iteration: Option<u32>

Tracks whether .agent/tmp/plan.xml was successfully extracted for the iteration.

§planning_validated_outcome: Option<PlanningValidatedOutcome>

Stores the validated outcome for the current planning iteration.

§planning_markdown_written_iteration: Option<u32>

Tracks whether PLAN.md has been written for the current iteration.

§planning_xml_archived_iteration: Option<u32>

Tracks whether .agent/tmp/plan.xml was archived for the current iteration.

§development_context_prepared_iteration: Option<u32>

Tracks whether development context was prepared for the current iteration.

Used to sequence single-task development effects.

§development_prompt_prepared_iteration: Option<u32>

Tracks whether the development prompt was prepared for the current iteration.

§development_xml_cleaned_iteration: Option<u32>

Tracks whether .agent/tmp/development_result.xml was cleaned for the current iteration.

§development_agent_invoked_iteration: Option<u32>

Tracks whether the developer agent was invoked for the current iteration.

§analysis_agent_invoked_iteration: Option<u32>

Tracks whether the analysis agent was invoked for the current iteration.

Analysis agent runs after EVERY development iteration to produce an objective assessment of progress by comparing git diff against PLAN.md. This ensures continuous verification throughout the development phase.

§development_xml_extracted_iteration: Option<u32>

Tracks whether .agent/tmp/development_result.xml was extracted for the current iteration.

§development_validated_outcome: Option<DevelopmentValidatedOutcome>

Stores the validated development outcome for the current iteration.

§development_xml_archived_iteration: Option<u32>

Tracks whether the development XML was archived for the current iteration.

§review_context_prepared_pass: Option<u32>

Tracks whether review context was prepared for the current pass.

Used to sequence single-task review effects (PrepareReviewContext -> …).

§review_prompt_prepared_pass: Option<u32>

Tracks whether the review prompt was prepared for the current pass.

§review_issues_xml_cleaned_pass: Option<u32>

Tracks whether .agent/tmp/issues.xml was cleaned for the current pass.

§review_agent_invoked_pass: Option<u32>

Tracks whether the reviewer agent was invoked for the current pass.

§review_issues_xml_extracted_pass: Option<u32>

Tracks whether .agent/tmp/issues.xml was successfully extracted for the current pass.

§review_validated_outcome: Option<ReviewValidatedOutcome>

Stores the validated outcome for the current review pass.

This is used to sequence post-validation single-task effects (write markdown, archive XML) before the reducer advances to the next pass/phase.

§review_issues_markdown_written_pass: Option<u32>

Tracks whether ISSUES.md has been written for the current pass.

§review_issue_snippets_extracted_pass: Option<u32>

Tracks whether review issue snippets were extracted for the current pass.

§review_issues_xml_archived_pass: Option<u32>§fix_prompt_prepared_pass: Option<u32>§fix_result_xml_cleaned_pass: Option<u32>§fix_agent_invoked_pass: Option<u32>§fix_result_xml_extracted_pass: Option<u32>§fix_validated_outcome: Option<FixValidatedOutcome>§fix_result_xml_archived_pass: Option<u32>§commit_prompt_prepared: bool

Tracks whether the commit prompt was prepared for the current commit attempt.

§commit_diff_prepared: bool

Tracks whether the commit diff has been computed for the current attempt.

§commit_diff_empty: bool

Tracks whether the computed commit diff was empty.

§commit_diff_content_id_sha256: Option<String>

Content identifier (sha256 hex) of the prepared commit diff.

This is recorded when the diff is prepared and is used by orchestration guards to avoid reusing stale materialized prompt inputs across checkpoint resumes or when tmp artifacts change.

§commit_agent_invoked: bool

Tracks whether the commit agent was invoked for the current commit attempt.

§commit_xml_cleaned: bool

Tracks whether .agent/tmp/commit_message.xml was cleaned for the current attempt.

§commit_xml_extracted: bool

Tracks whether .agent/tmp/commit_message.xml was extracted for the current attempt.

§commit_validated_outcome: Option<CommitValidatedOutcome>

Stores the validated commit outcome for the current attempt.

§commit_xml_archived: bool

Tracks whether commit XML has been archived for the current attempt.

§context_cleaned: bool§agent_chain: AgentChainState§rebase: RebaseState§commit: CommitState§execution_history: Vec<ExecutionStep>§checkpoint_saved_count: u32

Count of CheckpointSaved events applied to state.

This is a reducer-visible record of checkpoint saves, intended for observability and tests that enforce checkpointing happens via effects.

§continuation: ContinuationState

Continuation state for development iterations.

Tracks context from previous attempts when status is “partial” or “failed” to enable continuation-aware prompting.

§metrics: RunMetrics

Run-level execution metrics.

This is the single source of truth for all iteration/attempt/retry/fallback statistics. Updated deterministically by the reducer based on events.

§dev_fix_triggered: bool

Whether TriggerDevFixFlow has been executed in the current AwaitingDevFix phase.

This flag is set to true when DevFixTriggered event is reduced. It ensures the event loop allows at least one iteration to execute TriggerDevFixFlow before checking completion, preventing premature exit when max iterations is imminent.

§prompt_inputs: PromptInputsState

Canonical, reducer-visible prompt inputs after oversize materialization.

This is the single source of truth for any inline-vs-reference and model-budget truncation decisions. Effects must not silently re-truncate or re-reference content on retries; instead, they should consume these materialized inputs (or materialize them exactly once per content id).

Implementations§

Source§

impl PipelineState

Source

pub fn initial(developer_iters: u32, reviewer_reviews: u32) -> Self

Source

pub fn initial_with_continuation( developer_iters: u32, reviewer_reviews: u32, continuation: ContinuationState, ) -> Self

Create initial state with custom continuation limits from config.

Use this when you need to load XSD retry and continuation limits from unified config. Example:

// Config semantics: max_dev_continuations counts continuation attempts *beyond*
// the initial attempt. ContinuationState::max_continue_count semantics are
// "maximum total attempts including initial".
let continuation = ContinuationState::with_limits(
    config.general.max_xsd_retries,
    1 + config.general.max_dev_continuations,
    config.general.max_same_agent_retries,
);
let state = PipelineState::initial_with_continuation(dev_iters, reviews, continuation);
Source

pub fn is_complete(&self) -> bool

Returns true if the pipeline is in a terminal state for event loop purposes.

§Terminal States
  • Complete phase: Always terminal (successful completion)
  • Interrupted phase: Terminal under these conditions:
    1. A checkpoint has been saved (normal Ctrl+C interruption path)
    2. Transitioning from AwaitingDevFix phase (failure handling completed)
§AwaitingDevFix → Interrupted Path

When the pipeline encounters a terminal failure (e.g., AgentChainExhausted), it transitions through AwaitingDevFix phase where:

  1. TriggerDevFixFlow effect writes completion marker to filesystem
  2. Dev-fix agent is dispatched (optional remediation attempt)
  3. CompletionMarkerEmitted event transitions to Interrupted phase

At this point, the completion marker has been written, signaling external orchestration that the pipeline has terminated. The SaveCheckpoint effect will execute next, but the phase is already considered terminal because the failure has been properly signaled.

§Edge Cases

An Interrupted phase without a checkpoint and without previous_phase context is NOT considered terminal. This can occur when resuming from a checkpoint that was interrupted mid-execution.

§Non-Terminating Pipeline Architecture

The pipeline is designed to never exit early. All failure paths route through AwaitingDevFixTriggerDevFixFlow → completion marker write → Interrupted. This ensures orchestration can reliably detect completion via the marker file, even when budget is exhausted or all agents fail.

Terminal states:

  • Complete: Normal successful completion
  • Interrupted with checkpoint saved: Resumable state
  • Interrupted from AwaitingDevFix: Completion marker written, failure signaled
Source

pub fn current_head(&self) -> String

Trait Implementations§

Source§

impl Clone for PipelineState

Source§

fn clone(&self) -> PipelineState

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 PipelineState

Source§

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

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

impl<'de> Deserialize<'de> for PipelineState

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 From<PipelineCheckpoint> for PipelineState

Source§

fn from(checkpoint: PipelineCheckpoint) -> Self

Converts to this type from the input type.
Source§

impl Serialize for PipelineState

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>,