Skip to main content

Module agent_api_retry

Module agent_api_retry 

Source
Expand description

A Claude CLI request that is being retried, from the CLI’s own frames.

When a request to the API fails in a way the CLI treats as transient (no connection, a 5xx), it waits and tries again, up to its own limit, and writes one system/api_retry frame per attempt: {attempt, max_retries, retry_delay_ms, error_status, error}. With the network down that is minutes of a busy-looking pane with nothing else on stdout, so the pane shows the retry, with Stop.

Published as the per-pane agent-api-retry event, and answered for a pane that opens mid-retry by agentapiretry. Cleared by the next frame that is neither system nor user (a reply arrived, or the turn’s result), and when the stdout reader ends, however it ends (ApiRetryReader).

The wait goes out as time remaining, computed when srv sends it, never as a deadline: srv’s clock and the renderer’s need not agree. So the event is not persisted (a replay would carry a stale remainder); srv keeps the current retry here instead. Every change carries a rising revision, and the pane applies only a newer one than it has: events and the agentapiretry answer can arrive out of order.

Structs§

ApiRetryEvent
The agent-api-retry event’s payload (mps_events::AgentApiRetry), and agentapiretry’s answer: the retry in progress, or null when none is.
ApiRetryReader
One stdout reader’s part in its pane’s retry state. Dropping it clears a retry it set, so a reader that ends any way, including aborted mid-read (process_waiter.rs settle_reader_tasks), never leaves one behind.
ApiRetryState
One retry the CLI is waiting on, as the pane gets it.
CommandAgentApiRetryData
agentapiretry’s request: the pane asking.

Functions§

current_api_retry
agentapiretry: the pane’s retry as of now.