pub struct AccountState {Show 13 fields
pub provider: Provider,
pub models: Vec<String>,
pub model_aliases: HashMap<String, Vec<String>>,
pub model_slugs: HashMap<String, String>,
pub env: HashMap<String, String>,
pub usage: Option<UsageSnapshot>,
pub limit_reading: Option<UsageSnapshot>,
pub last_error: Option<UsageFetchStatus>,
pub next_probe_at: Option<Instant>,
pub consecutive_failures: u32,
pub override_armed: bool,
pub loading: LoadingState,
pub retired: bool,
}Fields§
§provider: ProviderDeclared backend from [[accounts]] provider. Decides which
endpoint the usage probe hits and which credential it carries.
models: Vec<String>The canonical model names the account serves. Selection and
the route’s model gate match through account_serves.
model_aliases: HashMap<String, Vec<String>>Canonical name -> the other names a request may arrive under for
that model. Keys are always members of Self::models.
model_slugs: HashMap<String, String>Canonical name -> upstream slug, only where the spellings differ. The forward splices the slug into the request body.
env: HashMap<String, String>Per-account environment: provider-behaviour extras plus the
derived credential and base-url variable stamps. Stamped onto
the account’s claude subprocess at spawn, and read by the
usage probe for the ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN
a base-url provider authenticates with.
usage: Option<UsageSnapshot>Latest usage snapshot fetched by the workspace’s background
poller. None until the first successful fetch. Drives the
selection walk’s order and the cooldown’s reset; a view reads
Self::limit_reading with it, in that order.
limit_reading: Option<UsageSnapshot>The windows a rate-limited probe carried, kept for the view beside
usage rather than in it: they never heal the account, and
selection and cooldowns must keep reading the successful probe.
last_error: Option<UsageFetchStatus>Latest poll-attempt outcome when the fetch failed. Cleared
(set to None) on the next successful fetch. unusable_reason
reads this to classify a probe-blocked account, and the write
schedules the next probe’s backoff (next_probe_at).
next_probe_at: Option<Instant>Earliest wall-clock time we’re allowed to probe this account
again. The poller skips accounts whose next_probe_at is in
the future. Used for per-account exponential backoff when
Anthropic’s /api/oauth/usage endpoint keeps returning 429
(without backoff every poll cycle re-trips the per-IP rate
limit and we never accumulate usage data). None means
“probe on the next tick” (default).
consecutive_failures: u32Consecutive probe failures since the last success. Drives the backoff schedule: each consecutive failure doubles the next-probe delay (capped at a sensible ceiling). Reset to 0 on success.
override_armed: boolOne-shot arming flag for the has_just_cleared_cap_window
scheduler hook. Without it, a stale-reset snapshot paired with
sustained probe failure would re-trigger the override every
poll cycle, defeating the exponential backoff schedule -
forge would hammer Anthropic’s /api/oauth/usage endpoint once
per minute through a multi-hour outage instead of backing off.
set_usage arms it (a fresh snapshot earns one override
attempt once its resets_at passes); disarm_override clears
it after the scheduler fires an override. False until the
first successful probe lands a snapshot. Distinct from
LoadingState - rate-limit concern, not auth-recovery.
loading: LoadingStateWhere this account sits in the boot-time loading state
machine. The boot wave and the cron spawn path gate on this
across every account; the selection walk only considers
accounts whose state is Ready (or a saturated Ready).
retired: boolA config reload removed this account from the file. It is not in the selection walk any more, but a session already bound to it keeps working until the session ends.