Skip to main content

CoderSessionEntry

Struct CoderSessionEntry 

Source
pub struct CoderSessionEntry {
Show 17 fields pub session: Arc<Mutex<CoderSession>>, pub events: Arc<Mutex<CoderEventBuffer>>, pub cancel: CancelFlag, pub preparation: RwLock<()>, pub session_wall_secs: AtomicU64, pub sink: Arc<EventSink>, pub infra: SharedInfra, pub generator: Arc<dyn TurnGenerator>, pub routing_exclusions: Vec<String>, pub memory: RepairMemory, pub mcp_endpoint: Option<String>, pub mcp_config_dir: Option<PathBuf>, pub user_input: Arc<UserInputGate>, pub attention: Arc<AttentionState>, pub next_seq: Arc<AtomicU64>, pub task: Mutex<Option<JoinHandle<()>>>, pub fleet: Mutex<Option<Arc<FleetPool>>>,
}
Expand description

One live session in the daemon’s registry.

Fields§

§session: Arc<Mutex<CoderSession>>§events: Arc<Mutex<CoderEventBuffer>>

Replay buffer for coder.subscribe { from_seq } after reconnects.

§cancel: CancelFlag§preparation: RwLock<()>

Planning/baseline operations hold read guards. Cancellation drains them before declaring a pre-execution workspace safe to recover.

§session_wall_secs: AtomicU64

Effective wall ceiling for this live session. Zero means unbounded. Set once when the confirmed run creates its shared SessionDeadline; the liveness watchdog reads it without restarting or duplicating that clock.

§sink: Arc<EventSink>§infra: SharedInfra

State, audit log, and runtime policies inherited from the client session that started this coder run. Foreman’s delivery gate consumes these exact handles; replacing them with fresh infra would silently discard policy.register rules and write verdicts outside the session journal.

§generator: Arc<dyn TurnGenerator>

The model seam the loops run on (production: the shared InferenceEngine; tests: a script).

§routing_exclusions: Vec<String>

Models the adaptive native loop must not use. Empty for ordinary coder sessions; self-heal fills it with canonical review-panel model names.

§memory: RepairMemory

Durable repair learning for the native loop. Cloned from the embedder’s shared_memgine; a no-op store when the daemon runs standalone.

§mcp_endpoint: Option<String>

The daemon’s MCP URL (e.g. "http://127.0.0.1:9102/mcp"), captured at session start from ServerState::mcp_url. Threaded into the external and foreman delegation engines so the CLI’s CAR-namespace tool calls (memory_*, verify, skill_*) route back through the daemon’s policy

  • memgine — gated and audited. None when the daemon has no MCP listener (--mcp-bind disabled); delegation degrades to ungoverned CAR-namespace calls (the CLI’s own built-in tools are ungoverned either way — the residual upstream stage-4b limitation).
§mcp_config_dir: Option<PathBuf>

Where the claude-code adapter writes its short-lived MCP config file (car#1534). None keeps the adapter’s original behaviour, a bare tempfile() under $TMPDIR.

The daemon sets it to <coder state dir>/mcp so the one file every normal external session writes stops depending on an environment variable the daemon inherited and never checked: a daemon launched with an installer-sandbox TMPDIR could not create it, and the session silently ran the native engine instead (the drill trigger behind car#1534; car#1518 fixed only the CarHost launch path).

§user_input: Arc<UserInputGate>

Mid-session user-input rendezvous: the native loop parks a oneshot here when it asks a question (via the ask_user tool); coder.respond fulfills it. Cancellation clears it so a waiting question unblocks.

§attention: Arc<AttentionState>

Operator-attention signals folded from the event stream (outstanding sign-in, budget cut). Shared with the drain task, which is the single funnel every event passes through.

§next_seq: Arc<AtomicU64>

The sequence after the newest event the drain has appended — the coder.subscribe resume cursor, readable WITHOUT taking the buffer lock.

That matters: the drain holds the buffer lock across an untimed WS send, so one SIGSTOPped subscriber parks it indefinitely. A summary that read events.lock().await.len() would block behind that subscriber, and (before this was split out) it did so while coder.list held the global coder_sessions registry — wedging every other coder.* call daemon-wide. Bumped by the drain immediately AFTER the push, so it is never AHEAD of the buffer: a cursor that lags replays an event, a cursor that leads drops one.

§task: Mutex<Option<JoinHandle<()>>>

The running loop task, present from confirm until terminal.

§fleet: Mutex<Option<Arc<FleetPool>>>

The distributed run’s worker pool, present from the moment run_session_loop builds one until whoever drains it takes it.

Here rather than only on the loop’s stack because coder.cancel aborts the task at its next await — so the loop never reaches the block that folds pool.placements() onto the session, the Arc drops, and the answer to “which machines was this farmed to?” is gone. That is exactly the run an operator wants a receipt for: they cancelled it because it looked wrong (car#1346).

Option and taken, not held, so the ordinary paths return the pool at the moment they always did — the loop’s fold and coder.cancel each take it. Not every path: the two early returns above the foreman rung and a panic inside the loop task leave the slot populated, and the entry carries it until prune_finished_sessions collects the session. That is bounded for the early returns (both reach a terminal state, so the prune does collect) and unbounded on panic — where the entry and its replay buffer already leaked. A RemoteWorktreeAgent is names, a repo fingerprint and an Arc<PeerIdentity>; it holds no socket and no task, which is what makes that acceptable rather than merely tolerated.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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