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
iterationis always<= total_iterationsreviewer_passis always<= total_reviewer_passesagent_chainmaintains fallback order and retry counts- State transitions only occur through the
reducefunction
§See Also
reducefor state transitionsdetermine_next_effectfor effect derivation
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: boolTracks whether the commit prompt was prepared for the current commit attempt.
commit_diff_prepared: boolTracks whether the commit diff has been computed for the current attempt.
commit_diff_empty: boolTracks 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: boolTracks whether the commit agent was invoked for the current commit attempt.
commit_xml_cleaned: boolTracks whether .agent/tmp/commit_message.xml was cleaned for the current attempt.
commit_xml_extracted: boolTracks 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: boolTracks 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: u32Count 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: ContinuationStateContinuation state for development iterations.
Tracks context from previous attempts when status is “partial” or “failed” to enable continuation-aware prompting.
metrics: RunMetricsRun-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: boolWhether 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: PromptInputsStateCanonical, 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
impl PipelineState
pub fn initial(developer_iters: u32, reviewer_reviews: u32) -> Self
Sourcepub fn initial_with_continuation(
developer_iters: u32,
reviewer_reviews: u32,
continuation: ContinuationState,
) -> Self
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);Sourcepub fn is_complete(&self) -> bool
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:
- A checkpoint has been saved (normal Ctrl+C interruption path)
- 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:
- TriggerDevFixFlow effect writes completion marker to filesystem
- Dev-fix agent is dispatched (optional remediation attempt)
- 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
AwaitingDevFix → TriggerDevFixFlow → 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 completionInterruptedwith checkpoint saved: Resumable stateInterruptedfromAwaitingDevFix: Completion marker written, failure signaled
pub fn current_head(&self) -> String
Trait Implementations§
Source§impl Clone for PipelineState
impl Clone for PipelineState
Source§fn clone(&self) -> PipelineState
fn clone(&self) -> PipelineState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PipelineState
impl Debug for PipelineState
Source§impl<'de> Deserialize<'de> for PipelineState
impl<'de> Deserialize<'de> for PipelineState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<PipelineCheckpoint> for PipelineState
impl From<PipelineCheckpoint> for PipelineState
Source§fn from(checkpoint: PipelineCheckpoint) -> Self
fn from(checkpoint: PipelineCheckpoint) -> Self
Auto Trait Implementations§
impl Freeze for PipelineState
impl RefUnwindSafe for PipelineState
impl Send for PipelineState
impl Sync for PipelineState
impl Unpin for PipelineState
impl UnwindSafe for PipelineState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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