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: boolKeep 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: u32Default 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: usizeByte 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: usizeMaximum 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: u64Wall-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: u64Wall-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: u64Wall-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: usizeHow 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: u64Age 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
impl CoderConfig
Sourcepub fn session_retention(&self) -> SessionRetention
pub fn session_retention(&self) -> SessionRetention
The retention policy gc_sessions wants.
Source§impl CoderConfig
impl CoderConfig
Sourcepub fn preference_refs(&self) -> Vec<&str>
pub fn preference_refs(&self) -> Vec<&str>
Resolve engine_preference to the &str slice resolve_engine wants.
Sourcepub fn parse_toml(text: &str) -> Self
pub fn parse_toml(text: &str) -> Self
Parse a TOML string. Tolerant: a malformed document yields defaults rather than an error.
Sourcepub fn load_from(path: &Path) -> Self
pub fn load_from(path: &Path) -> Self
Load from path. A missing file → defaults; an unreadable or malformed
file → defaults (logged). Never panics.
Sourcepub fn load() -> Self
pub fn load() -> Self
Load from the resolved config path (config_path).
Trait Implementations§
Source§impl Clone for CoderConfig
impl Clone for CoderConfig
Source§impl Debug for CoderConfig
impl Debug for CoderConfig
Source§impl Default for CoderConfig
impl Default for CoderConfig
impl Eq for CoderConfig
Source§impl PartialEq for CoderConfig
impl PartialEq for CoderConfig
impl StructuralPartialEq for CoderConfig
Auto Trait Implementations§
impl Freeze for CoderConfig
impl RefUnwindSafe for CoderConfig
impl Send for CoderConfig
impl Sync for CoderConfig
impl Unpin for CoderConfig
impl UnsafeUnpin for CoderConfig
impl UnwindSafe for CoderConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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> ⓘ
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> ⓘ
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