Skip to main content

CoderConfig

Struct CoderConfig 

Source
pub struct CoderConfig {
    pub engine_preference: Vec<String>,
    pub keep_workspace_on_failure: bool,
    pub default_max_iterations: u32,
    pub model: Option<String>,
    pub approval_patch_bytes: usize,
    pub max_replay_events: usize,
    pub max_session_wall_secs: u64,
    pub max_agent_build_wall_secs: u64,
    pub max_check_timeout_secs: u64,
    pub max_sessions: usize,
    pub max_session_age_days: u64,
}
Expand description

Resolved coder operator config. Every field is populated (defaults applied), so callers never deal with Option.

Fields§

§engine_preference: Vec<String>

External/foreman delegation order: the first ready CLI in this list wins. Defaults to DEFAULT_PREFERENCE.

§keep_workspace_on_failure: bool

Keep the throwaway worktree when a session ends Failed, so the operator can inspect it for a postmortem. Defaults to false (drop it).

§default_max_iterations: u32

Default loop iteration cap when coder.start omits max_iterations. Defaults to DEFAULT_MAX_ITERATIONS.

§model: Option<String>

Pin the native loop’s inference model (e.g. "parslee/reasoning" for gpt-5.5 via the Parslee gateway). None = adaptive routing (TaskHint::Code). The seam that lets a paired A/B run the native arm on the same backbone as the external CLI arm.

The pin applies to WHICHEVER engine runs the session: the native loop reasons on it, and an external:<agent_id> session forwards it to the CLI (codex -m, claude --model). It reached only the native loop once, which left a paired A/B’s “both arms on one backbone” an unverified assumption. Foreman is the exception — its farmed workers run their own configured backbones and take no pin at all.

Because the external rung hands this string to a third-party CLI’s own namespace, a value here is NOT required to be a name car models list knows. Nothing validates it, deliberately.

§approval_patch_bytes: usize

Byte budget for the patch shown at merge approval. Defaults to DEFAULT_APPROVAL_PATCH_BYTES.

This was a hardcoded 32 KB tail, which made the review surface shrink exactly as the risk grew: the gap between what a contract verifies and what a change actually does widens with session length, so the human backstop weakened precisely where the automated one did (car#706). The --stat is always shown in full regardless of this value.

§max_replay_events: usize

Maximum events retained in memory for reconnect replay by one live session. Defaults to DEFAULT_MAX_REPLAY_EVENTS; 0 means unlimited. The event sequence remains monotonic when the oldest retained event is dropped, and coder.subscribe.events_skipped reports a stale cursor.

§max_session_wall_secs: u64

Wall-clock ceiling for a whole session, across every rung of the engine fallback ladder. 0 means unlimited — for callers that impose their own bound and want the daemon out of the way. Defaults to car_budget::DEFAULT_SESSION_WALL_SECS.

§max_agent_build_wall_secs: u64

Wall-clock ceiling for an Agent project’s complete build: spec generation, repair attempts, and scenario runs. A confirmed contract may lower a positive ceiling, but cannot remove or raise it. 0 is the operator’s explicit choice to keep the contract’s value: a positive timeout is used, while a missing or zero timeout is unlimited. Defaults to 600 seconds, also shown on the synthesized agent_scenarios_pass contract.

§max_check_timeout_secs: u64

Wall-clock ceiling for ONE outcome-contract check command. Defaults to MAX_SHELL_TIMEOUT_SECS.

A repository whose real verification gate takes longer than ten minutes could not express that gate as a contract check at all: the check was killed at the shell ceiling however much session budget remained, and no value of max_session_wall_secs moved it (car#1065). Raising this is an operator decision about their own test gate — it does NOT raise the ceiling on the shell tool the model calls, which stays at the 600s the tool description advertises.

Unlike max_session_wall_secs, 0 is not “unlimited” here — it would floor every check at one second — so it is treated as unset.

§max_sessions: usize

How many terminal session snapshots to keep in the coder state dir. Defaults to DEFAULT_MAX_SESSIONS; 0 means unlimited.

Only collectable sessions are counted and evicted — see gc_sessions for what is exempt. So this bounds what retention manages, not the size of the directory.

0 disables the cap, matching config.toml’s [runs]. The two used to disagree — crate::run_store::RetentionConfig read 0 literally, so max_per_agent = 0 made completed_rank >= 0 always true and max_age_days = 0 put the cutoff at now, either one deleting every collectable run trace. Two similarly-named retention knobs in one daemon whose zero values inverted was a hazard whose failure mode was silent data loss; car#1338 settled it in this direction. Note this is not a blanket rule — max_check_timeout_secs two fields down reads 0 as UNSET, because zero there would floor every check at one second rather than lift a ceiling.

§max_session_age_days: u64

Age ceiling for a retained terminal session snapshot, in days. Defaults to DEFAULT_MAX_SESSION_AGE_DAYS; 0 means unlimited — see the note on Self::max_sessions.

Implementations§

Source§

impl CoderConfig

Source

pub fn session_retention(&self) -> SessionRetention

The retention policy gc_sessions wants.

Source§

impl CoderConfig

Source

pub fn preference_refs(&self) -> Vec<&str>

Resolve engine_preference to the &str slice resolve_engine wants.

Source

pub fn parse_toml(text: &str) -> Self

Parse a TOML string. Tolerant: a malformed document yields defaults rather than an error.

Source

pub fn load_from(path: &Path) -> Self

Load from path. A missing file → defaults; an unreadable or malformed file → defaults (logged). Never panics.

Source

pub fn load() -> Self

Load from the resolved config path (config_path).

Trait Implementations§

Source§

impl Clone for CoderConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CoderConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CoderConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for CoderConfig

Source§

impl PartialEq for CoderConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CoderConfig

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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