pub struct State {Show 36 fields
pub current_round: u32,
pub max_iterations: u32,
pub codex_model: String,
pub codex_effort: String,
pub codex_timeout: u64,
pub push_every_round: bool,
pub full_review_round: u32,
pub plan_file: String,
pub plan_tracked: bool,
pub plan_mode: PlanMode,
pub plan_source_path: String,
pub plan_source_exists_at_start: bool,
pub plan_source_tracked_at_start: bool,
pub plan_source_sha256: String,
pub plan_snapshot_path: String,
pub plan_source_git_oid: Option<String>,
pub source_plan_id: Option<String>,
pub source_plan_revision: Option<u32>,
pub start_branch: String,
pub base_branch: String,
pub base_commit: String,
pub review_started: bool,
pub ask_codex_question: bool,
pub session_id: Option<String>,
pub agent_teams: bool,
pub started_at: Option<String>,
pub pr_number: Option<u32>,
pub configured_bots: Option<Vec<String>>,
pub active_bots: Option<Vec<String>>,
pub poll_interval: Option<u64>,
pub poll_timeout: Option<u64>,
pub startup_case: Option<String>,
pub latest_commit_sha: Option<String>,
pub latest_commit_at: Option<String>,
pub last_trigger_at: Option<String>,
pub trigger_comment_id: Option<String>,
}Expand description
Represents the state of an RLCR or PR loop.
Schema matches setup-rlcr-loop.sh exactly: All field names use snake_case as per YAML convention.
Fields§
§current_round: u32Current round number (0-indexed).
max_iterations: u32Maximum number of iterations allowed.
codex_model: StringCodex model name (e.g., “gpt-5.4”).
codex_effort: StringCodex reasoning effort (e.g., “high”, “xhigh”).
codex_timeout: u64Codex timeout in seconds.
push_every_round: boolWhether to push after each round.
full_review_round: u32Interval for full alignment checks (round N-1 for N, 2N-1, etc.).
plan_file: StringPath to the plan file (relative to project root).
plan_tracked: boolWhether the plan file is tracked in git.
plan_mode: PlanModeHow the source plan should be treated during the loop.
plan_source_path: StringOriginal source plan path captured when the loop started.
plan_source_exists_at_start: boolWhether the source plan existed when the loop started.
plan_source_tracked_at_start: boolWhether the source plan was tracked when the loop started.
plan_source_sha256: StringSHA-256 of the source plan when the loop started.
plan_snapshot_path: StringSnapshot plan path stored inside the loop directory.
plan_source_git_oid: Option<String>Optional git blob oid of the source plan at start.
source_plan_id: Option<String>Internal planning artifact id used to start this RLCR session.
source_plan_revision: Option<u32>Revision of the internal planning artifact used to start this RLCR session.
start_branch: StringBranch where the loop started.
base_branch: StringBase branch for code review.
base_commit: StringBase commit SHA.
review_started: boolWhether review phase has started.
ask_codex_question: boolWhether to ask Codex for clarification.
session_id: Option<String>Session identifier for this loop. Always serialized as empty string when None (shell contract).
agent_teams: boolWhether agent teams mode is enabled.
started_at: Option<String>Timestamp when the loop was created (ISO 8601).
pr_number: Option<u32>PR number for PR loops.
configured_bots: Option<Vec<String>>List of configured bots for PR review.
active_bots: Option<Vec<String>>List of active bots for PR review.
poll_interval: Option<u64>Polling interval for PR state checks (seconds).
poll_timeout: Option<u64>Timeout for PR polling (seconds).
startup_case: Option<String>Startup case for PR loop (e.g., “new_pr”, “existing_pr”).
latest_commit_sha: Option<String>Latest commit SHA for PR.
latest_commit_at: Option<String>Timestamp of latest commit.
last_trigger_at: Option<String>Timestamp of last trigger.
trigger_comment_id: Option<String>ID of trigger comment.
Implementations§
Source§impl State
impl State
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, StateError>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, StateError>
Parse state from a file containing YAML frontmatter.
Sourcepub fn from_markdown(content: &str) -> Result<Self, StateError>
pub fn from_markdown(content: &str) -> Result<Self, StateError>
Parse state from markdown content with YAML frontmatter.
Sourcepub fn from_markdown_strict(content: &str) -> Result<Self, StateError>
pub fn from_markdown_strict(content: &str) -> Result<Self, StateError>
Parse state from markdown with strict validation of required fields.
This matches the shell behavior in loop-common.sh parse_state_file_strict() which rejects missing required fields: current_round, max_iterations, review_started, and base_branch.
Sourcepub fn to_markdown(&self) -> Result<String, StateError>
pub fn to_markdown(&self) -> Result<String, StateError>
Serialize state to markdown with YAML frontmatter.
Sourcepub fn new_rlcr(
plan_file: String,
plan_tracked: bool,
plan_mode: PlanMode,
plan_source_path: String,
plan_source_exists_at_start: bool,
plan_source_tracked_at_start: bool,
plan_source_sha256: String,
plan_snapshot_path: String,
plan_source_git_oid: Option<String>,
source_plan_id: Option<String>,
source_plan_revision: Option<u32>,
start_branch: String,
base_branch: String,
base_commit: String,
max_iterations: Option<u32>,
codex_model: Option<String>,
codex_effort: Option<String>,
codex_timeout: Option<u64>,
push_every_round: bool,
full_review_round: Option<u32>,
ask_codex_question: bool,
agent_teams: bool,
review_started: bool,
) -> Self
pub fn new_rlcr( plan_file: String, plan_tracked: bool, plan_mode: PlanMode, plan_source_path: String, plan_source_exists_at_start: bool, plan_source_tracked_at_start: bool, plan_source_sha256: String, plan_snapshot_path: String, plan_source_git_oid: Option<String>, source_plan_id: Option<String>, source_plan_revision: Option<u32>, start_branch: String, base_branch: String, base_commit: String, max_iterations: Option<u32>, codex_model: Option<String>, codex_effort: Option<String>, codex_timeout: Option<u64>, push_every_round: bool, full_review_round: Option<u32>, ask_codex_question: bool, agent_teams: bool, review_started: bool, ) -> Self
Create a new RLCR state with the given parameters.
Sourcepub fn increment_round(&mut self)
pub fn increment_round(&mut self)
Increment the round counter.
Sourcepub fn is_max_iterations_reached(&self) -> bool
pub fn is_max_iterations_reached(&self) -> bool
Check if max iterations have been reached.
Sourcepub fn is_terminal_state_file(filename: &str) -> bool
pub fn is_terminal_state_file(filename: &str) -> bool
Check if this is a terminal state filename.
Sourcepub fn is_valid_terminal_reason(reason: &str) -> bool
pub fn is_valid_terminal_reason(reason: &str) -> bool
Check if a reason is a valid terminal state reason.
Sourcepub fn terminal_state_filename(reason: &str) -> Option<&'static str>
pub fn terminal_state_filename(reason: &str) -> Option<&'static str>
Get the terminal state filename for a given exit reason.
Returns None if the reason is not a valid terminal reason. Shell contract: invalid reasons should error, not silently map to unexpected.
Sourcepub fn rename_to_terminal<P: AsRef<Path>>(
state_path: P,
reason: &str,
) -> Result<PathBuf, StateError>
pub fn rename_to_terminal<P: AsRef<Path>>( state_path: P, reason: &str, ) -> Result<PathBuf, StateError>
Rename state file to terminal state file.
This implements the end-loop rename behavior from loop-common.sh:
After determining the exit reason, rename state.md to
Returns error if reason is not valid (matching shell end_loop behavior).