Expand description
Per-account boot-time loading task.
Probes one account once and settles it to a terminal LoadingState
(Ready or Bailed) in that single round. Spawned at
Workspace::new, one tokio task per [[accounts]] entry in
forge.toml. The boot wave and the cron spawn path wait until
AccountStateMap::all_loaded() returns true (every account in a
terminal state); the gateway’s walk only considers accounts whose
terminal state is Ready.
One probe per task, every outcome terminal:
- 200 -> snapshot stored via
set_usage,Ready, task exits. - Any probe error ->
Bailedin the same round. Auth failures record their status; a 200 whose body maps to nothing (Unmappable) records nothing; the transient classes (RateLimitedetc.) record status + the serverRetry-After, which also schedules the poller’s re-probe.
Healing is the pollers’ job: the 60 s usage poller re-probes
accounts once their Retry-After / backoff window passes and flips
Bailed -> Ready, which makes the account eligible for new
spawns without shifting running sessions. A rate-limited probe does
not mean inference is limited - the session surfaces its own error
if it is.
Re-exports§
use std::sync::Weak;🔒use forge_gateway::ProbeError;🔒use forge_primitives::usage::UsageSnapshot;🔒use forge_primitives::usage::oauth::OauthUsageError;🔒use forge_gateway::AccountKey;🔒use forge_gateway::AccountPool;🔒use forge_gateway::LoadingState;🔒use crate::workspace::Workspace;🔒
Functions§
- run_
account_ loading - Probe the account once and settle its terminal
LoadingState. - settle_
probe_ 🔒result - Apply one probe outcome to the account state map and return the
terminal
LoadingStateit settles to. Every error class is terminal in this single pass; healing is the usage poller’s schedule.