Skip to main content

CloseRule

Struct CloseRule 

Source
pub struct CloseRule { /* private fields */ }
Expand description

Constraint 4’s close rule as a pure, line-fed state machine: stdin may be released only once a DEVFLOW_RESULT marker has appeared inside a TOP-LEVEL result event and the background-task list has drained.

An AND of two arms, neither sufficient alone:

  • Marker arm. Satisfied only by [crate::agent_result::event_is_top_level_result_marker] — a composition of the existing is_top_level predicate and the existing marker parser, never a looser text search. The CLI echoes the operator’s prompt back into the same stdout, and DevFlow’s own stage prompts discuss DEVFLOW_RESULT markers at length, so marker text alone is not evidence (T-31-01; the same echo produced the checkpoint false positive 30-05 fixed).
  • Drain arm. Satisfied when no background_tasks_changed event has ever announced anything (vacuous — the common single-plan case) or when the most recent one carried an empty list.

The drain alone is never a stop signal. 30c/30d measured the drain-to-final-result lag at 4.54–11.51s across 14 trials; closing at the drain would have truncated the final orchestrator turn in all seven 30d trials.

Never count result events. Constraint 7: the CLI coalesces completions, so a wave whose children finish together produces one result for several of them — a shape superficially indistinguishable from “one child delivered, one lost”. The drained list is the only thing separating those two. Per 30-04 the drain arm is defensive rather than load-bearing (n=2 Mode B trials delivered everything without it); that is the recorded reason to keep it cheaply, not a reason to drop it.

A line that does not parse as JSON is ignored by this rule — it can neither satisfy nor block either arm — but it is still teed verbatim to the capture file by the reader thread. A torn line therefore cannot silently decide anything, and cannot be silently lost either.

Implementations§

Source§

impl CloseRule

Source

pub fn observe(&mut self, line: &str)

Fold one raw stdout line into the rule.

Source

pub fn should_close(&self) -> bool

Whether both arms hold and the child’s stdin may be released.

Trait Implementations§

Source§

impl Default for CloseRule

Source§

fn default() -> CloseRule

Returns the “default value” for a type. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more