pub struct ControllerEnvironment {
pub background: Option<Arc<RecoveryGate>>,
}Expand description
The production environment: the controller as it is on disk right now.
It is reloaded per call rather than held, because a review is rare and the answer must reflect the config as it stands when the review starts – the daemon reloads config.toml every 500 ms for the same reason.
Fields§
§background: Option<Arc<RecoveryGate>>The daemon’s gate for recovery copies and worker upgrades, which a review waits behind instead of racing for the session’s lease.
Trait Implementations§
Source§impl Default for ControllerEnvironment
impl Default for ControllerEnvironment
Source§impl ReviewEnvironment for ControllerEnvironment
impl ReviewEnvironment for ControllerEnvironment
Source§fn check(&self, session_id: &str, profile: &str) -> Result<(), String>
fn check(&self, session_id: &str, profile: &str) -> Result<(), String>
Refuses, with a sentence for a person, when this session cannot be
reviewed under
profile.Source§fn is_subagent(&self, session_id: &str) -> bool
fn is_subagent(&self, session_id: &str) -> bool
Whether this session is a Mjolnir-managed sub-agent. Its changes are
reviewed through the parent’s turn, so it is never reviewed on its
own. Blocking: it reads the controller’s database.
fn resolve<'a>( &'a self, handle: ManagedSessionHandle, config: ReviewConfig, cancelled: Arc<AtomicBool>, ) -> BoxFuture<'a, Result<ResolvedReviewSettings, String>>
Source§fn stage(
&self,
session_id: &str,
profile: &str,
generation: u64,
mcp_servers: &[ReviewMcpServer],
dispatch_tool: bool,
) -> Result<ReviewerLaunchConfig, String>
fn stage( &self, session_id: &str, profile: &str, generation: u64, mcp_servers: &[ReviewMcpServer], dispatch_tool: bool, ) -> Result<ReviewerLaunchConfig, String>
Stages the reviewer profile for one role and describes how to launch
it. Blocking: it copies a profile onto the session’s target.
Source§fn load_state(&self, session_id: &str) -> Result<TurnReviewState, String>
fn load_state(&self, session_id: &str) -> Result<TurnReviewState, String>
How far this session has been reviewed. Blocking: it reads the
controller’s database.
Source§fn save_state(
&self,
session_id: &str,
state: &TurnReviewState,
) -> Result<(), String>
fn save_state( &self, session_id: &str, state: &TurnReviewState, ) -> Result<(), String>
Records how far this session has been reviewed. Blocking: the host
routes it through its ordered persistence lane rather than calling it
on the Tokio task that owns review state.
Source§fn clear_interrupted(&self) -> Result<Vec<String>, String>
fn clear_interrupted(&self) -> Result<Vec<String>, String>
Clears the in-flight flag of every review a restart interrupted, and
reports whose they were. Baselines are deliberately left alone: the
interrupted review never advanced one, so the next review covers the
same change and nothing is lost.
Source§fn background_work_settled<'a>(
&'a self,
session_id: &'a str,
deadline: Instant,
) -> BoxFuture<'a, ()>
fn background_work_settled<'a>( &'a self, session_id: &'a str, deadline: Instant, ) -> BoxFuture<'a, ()>
Waits until no background work holds this session, or until
deadline. The automatic recovery copy a finished turn starts takes
the session’s lease, and a lease cancels reviewer actions in flight
(R4-9). An environment with no background work returns at once.Auto Trait Implementations§
impl !RefUnwindSafe for ControllerEnvironment
impl !UnwindSafe for ControllerEnvironment
impl Freeze for ControllerEnvironment
impl Send for ControllerEnvironment
impl Sync for ControllerEnvironment
impl Unpin for ControllerEnvironment
impl UnsafeUnpin for ControllerEnvironment
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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 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> ⓘ
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 moreSource§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.