Skip to main content

Runner

Struct Runner 

Source
pub struct Runner {
    pub state: RunState,
    /* private fields */
}
Expand description

Drives one run.

Fields§

§state: RunState

Run state; public so the CLI can report on it.

Implementations§

Source§

impl Runner

Source

pub async fn start( repo: &Path, instruction: String, config: Config, ) -> Result<Self>

Start a fresh run against repo.

Source

pub async fn review(repo: &Path, branch: &str, config: Config) -> Result<Self>

Open a review-only run against work that already exists on branch.

The expensive half of the graph is the implement wave — measured at 111 and 134 internal tool-loop turns on this repository, against a handful for a judge or a reviewer. The cheap half is worth running on hand-written work too, and there was no way to reach it.

No new state and no schema change are needed: a run with one viable candidate and a tally already decided degrades execute to exactly review → gate → merge, because judge skips a single-candidate field, deliberate has fewer than two first choices to reconcile, vote returns early, tally is already present and fold_losers has no losers. Resuming such a run therefore does the right thing as well.

Source

pub fn resume(id: &str) -> Result<Self>

Reopen an existing run.

Source

pub async fn execute(&mut self) -> Result<()>

Walk the graph to a terminal state, skipping nodes already recorded.

Source

pub fn on_pause(&mut self, pause: Pause)

Hand the runner the pause magi serve’s own shutdown watches.

Source

pub fn watch_interrupt(&mut self, pause: Pause)

Hand the runner a second, independent pause: magi serve’s interrupt scheduler asking this one run - and no other - to park so a task marked crate::queue::Task::interrupt can run alone. See Pause’s own doc for why this is never Runner::on_pause’s handle.

Source

pub async fn fix_selected( &mut self, ids: &[String], reason: &str, allow_stale: bool, ) -> Result<()>

Route specific, already-recorded review findings to a fixer for a targeted, out-of-band fix on the winning branch — magi fix’s own entry point.

Distinct from review_loop’s own fix step in three ways: it never runs a reviewer wave, it never spends review-round budget, and what happened is recorded as an OperatorFixRequest appended to RunState::operator_fixes, never folded into a ReviewRound — see run::SCHEMA’s doc for schema 9 on why a reviewer’s own severity and vote must never be rewritten to look like a manufactured blocking verdict.

Only meaningful once review has actually concluded: Ready (handed off with findings still open, or simply concluded clean while minor findings sat unaddressed) or Blocked (round budget spent, or the gate failed). Everything else is refused: a run still in progress should simply be resumed, and a Merged run’s branch has already landed — reopening this run’s own record cannot change that, so the answer there is a fresh magi review <branch>.

A real commit here re-verifies through a fresh, ordinary review-only run on the same branch (Self::review) rather than reopening this run’s own review_loop: once any round in this run’s history went clean, review_conclusion treats that as permanent by design (the same purity gate/merge rely on for safe reentry), so there is no way to force one more genuine reviewer wave out of this run without either rewriting history or weakening that guarantee for every other caller. A review-only run costs nothing extra — no implementation, no judging, no vote — and exercises the exact same review → verify → gate → (human) merge path, unmodified.

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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