pub struct GuardianState {
pub phase: GuardianPhase,
pub guardian_child_id: Option<String>,
pub last_verdict: Option<GuardianVerdict>,
pub last_reviewed_at_round: u32,
pub review_count: u32,
pub created_at: String,
pub updated_at: String,
}Expand description
Durable guardian record persisted in session.metadata.
Fields§
§phase: GuardianPhaseLifecycle phase of the current review pass.
guardian_child_id: Option<String>The session id of the in-flight (or most recent) guardian child, if any. Used by the completion coordinator to correlate a completing child with the review this parent actually dispatched.
last_verdict: Option<GuardianVerdict>The most recent guardian verdict, if a review has completed.
last_reviewed_at_round: u32The round at which the last verdict was recorded. Observability/diagnostics only — NOT currently read by the gate.
KNOWN v1 SCOPE: the gate does not yet re-review work produced after an approval (e.g. during a Gold goal-continuation) or across top-level user turns, and the review budget is session-cumulative. A robust staleness re-review needs a cross-turn-monotonic “new work” signal (the per-run round counter resets each turn) plus a per-turn budget reset; deferred until the feature is enabled in production.
review_count: u32How many guardian review passes have fired this session (the budget).
created_at: String§updated_at: StringImplementations§
Source§impl GuardianState
impl GuardianState
Sourcepub fn record_spawn(&mut self, child_id: impl Into<String>)
pub fn record_spawn(&mut self, child_id: impl Into<String>)
Record that a guardian child has been spawned (move to Pending), and
charge the review budget.
Sourcepub fn record_verdict(&mut self, verdict: GuardianVerdict, round: u32)
pub fn record_verdict(&mut self, verdict: GuardianVerdict, round: u32)
Record a completed guardian verdict (move to Reviewed).
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear the in-flight review pass (after it has been acted upon), keeping the budget count and the last verdict as the durable record.
Sourcepub fn budget_exhausted(&self, max_reviews: u32) -> bool
pub fn budget_exhausted(&self, max_reviews: u32) -> bool
Whether the review budget is spent, mirroring the goal loop’s
continuation_count >= max_auto_continuations gate.
Sourcepub fn last_approved(&self) -> bool
pub fn last_approved(&self) -> bool
Whether the most recent verdict approved stopping the run.
Trait Implementations§
Source§impl Clone for GuardianState
impl Clone for GuardianState
Source§fn clone(&self) -> GuardianState
fn clone(&self) -> GuardianState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more