Expand description
Whether each service AgentMux depends on can be reached (docs/specs/SPEC_OFFLINE_RESILIENCE_2026_10_20.md §4.1).
Inputs. Code that already makes requests reports what happened
(report, report_http, report_ws_connect,
observe_claude_frame): any HTTP response means the service is
reachable, whatever its status; a transport failure (DNS, connect, reset,
TLS, timeout) means it isn’t. While a service is believed down, and only
then, probe checks it on its own with capped backoff, so recovery
shows even when nothing else is calling.
States (tracker): offline after [tracker::OFFLINE_AFTER]
transport failures in a row or a failed probe; degraded while some
fail and some answer; online on an answer. The internet counts as
offline only when two services are and none answers.
Outputs. The connectivity:changed event on every change and
connectivity.status for a window that opens later; both carry a rising
revision, since they can arrive out of order.
Modules§
- endpoint
- A model API address as the status names it: the same address written two ways is one service, and a service’s id and label never carry a credential or a query.
- netchange
- The OS’s network-change notifications, so a switch of Wi-Fi, a VPN coming up or a cable pulled shows at once, not at the next probe of a service already believed down (up to a minute) or at the next failed request.
- probe
- The active probe: while a service is believed down, check it on a capped
backoff (
tracker::PROBE_FIRST_MSdoubling totracker::PROBE_MAX_MS), so its recovery shows even when nothing else is calling. An online service is never probed on a timer, only once when the OS reports a network change (netchange). - tracker
- The reachability state machine and the probe schedule, with no I/O and no
clock of its own: every call takes
now_ms, so tests drive time.
Structs§
- Connectivity
Status connectivity:changed’s payload andconnectivity.status’s answer.- Model
Api - A model vendor’s API: where to probe it, and its name in the status bar.
- Service
Status - One service’s reachability.
Enums§
- Outcome
- What one request, or probe, found.
- Reachability
- Whether a service can be reached.
- Service
- A service AgentMux depends on.
Constants§
- EVENT_
CONNECTIVITY_ CHANGED - The WebSocket event carrying a changed
ConnectivityStatus.
Statics§
- ANTHROPIC
- The API Claude Code calls. Only the persistent controller, which only Claude uses, reports today; another provider adds its own.
- The API Gemini CLI calls.
- OPENAI
- The API Codex calls.
- TRACKED_
MODEL_ APIS - The model APIs whose state srv tracks from startup: each is listed as
Reachability::Unknownand probed at once, so a window can tell “not checked yet” from “answers” before any agent has made a request.
Functions§
- claude_
frame_ outcome - What a Claude CLI stdout frame says about the API, if anything: an
api_retrywith no HTTP status is a failed connection, one with a status was answered, and so was a reply from a model; a turn’s errorresultthe failure classifier callsNetworkis a failed connection. A<synthetic>message is the CLI’s own (its “API Error” text), not the API’s. - endpoint_
meta - What a pane keeps in its block meta (
agent:api_endpoint) when its model API is not at srv’s own address: its service id, so the pane reads its own state, and the address. - http_
outcome - The outcome a reqwest
send()result says, orNonefor a request that was never sent (it couldn’t be built). - install
- Where changes go, and the start of the probe driver. Call once at startup; reports before it are kept, just not sent.
- model_
api_ of - The model API a provider’s CLI calls, from its first vendor, if srv tracks it.
- observe_
claude_ frame - Reads one Claude CLI stdout frame (
persistent::stdout_reader). - observe_
provider_ turn - What a finished turn of
providersays about its model API: a clean turn, or a failure the API itself returned (limit, auth, overload), reached it; a network failure did not. Any other failure says nothing. - report
- What a request to
servicefound. - report_
http - Reports a reqwest
send()result. - report_
ws_ connect - Reports a WebSocket connect:
Nonewhen it succeeded. - service_
for - The service a pane’s calls to
apigo to, given the address its CLI was started with (None, empty or unreadable: the CLI’s default). The same address srv itself would call is justapi. - service_
for_ env service_forwith the address read from the environment a pane’s CLI was started with. A pane with a proxy of its own has no address of its own in the status: the probe goes out the way srv does, which may not be the way that CLI does, so it could call a working address offline.- status
- The current state, for
connectivity.status. - track
- Starts tracking
servicenow: listed as not checked yet and probed at once, as theTRACKED_MODEL_APISare at startup. For a pane’s own address, when its CLI starts. - ws_
connect_ outcome - The outcome of a WebSocket connect: an HTTP answer to the handshake, even a refusal, means the server was reached.