Expand description
When an agent’s usage limit lifts: AgentFailure::resets_at_ms and
limit_window, filled in when a UsageLimit failure is stored
(docs/specs/SPEC_UNRESPONSIVE_AGENTS_2026_10_23.md §3.4).
The sources, in order:
- Claude’s
rate_limit_event, whosestatusis exactly"rejected": Claude Code sends one with every request, and a rejected one comes just before the limit error, carrying the exhausted window’sresetsAt(unix seconds) andrateLimitType. The persistent stdout reader hands every frame toobserve_frame, which keeps the latest per block.overageStatusis often"rejected"whilestatusis"allowed"; it is never read. - The error text,
resets Oct 26, 7pm (America/Los_Angeles)orresets 3:10am (UTC)orresets 7pm, read in the zone it names (any IANA name orUTC, from thechrono-tzdata) or, with none, in this machine’s own; a zone that is not a name is left unknown. Codex words it... or try again at 9:44 PM.(the machine’s own zone, with the date and year when it is not today:Nov 3rd, 2025 9:44 PM);codex_failure_textpicks that text out of Codex’serrorandturn.failedframes.
A reset outside (now, now + 8 days] is dropped: an unknown reset still
leaves the agent limited, just with no time shown.
Structs§
- Rate
Limit Info - A
rate_limit_event’srate_limit_info, the fields this reads.
Functions§
- assistant_
error_ evidence - What a synthetic assistant message says failed, for the result frame that ends its turn: Claude Code writes
the cause there (
"error": "rate_limit"with “You’ve hit your 5-hour limit · resets 8:10pm”,authentication_failed) and its result frame carries only a generic error. A login failure keeps its fixed word; any other message with anerrorfield gives that field and its text; an ordinary assistant message gives nothing. - codex_
failure_ text - The message of a Codex
errororturn.failedframe, orNonefor any other frame and for theReconnecting...retry notices, which are not failures. - fill_
reset with_reset’s rule, with its inputs passed in.- forget
- Forget
block_id’s rate-limit info: its pane closed (blockcontroller::release_block_processes). - inband_
error_ text - What
classifyshould read from a frame the stdout reader kept as the run’s in-band error: a Claude synthetic assistant message, or a Codex failure. - is_
login_ failure_ frame - Whether
frameis the synthetic assistant message Claude Code writes when the login failed ("error": "authentication_failed"). The result frame that ends the turn carries only prose (“Failed to authenticate: OAuth session expired and could not be refreshed”), so this is what tells an expired login from any other failure whatever the wording. - observe_
frame - Keep
frameasblock_id’s latest rate-limit info if it is arate_limit_event; any other frame is ignored. - reset_
from_ text - The reset a limit message names (
resets Oct 26, 7pm (America/Los_Angeles),resets 7:30pm,resets 3:10am (UTC)), in unix ms, orNone. A named zone is read as that zone’s clock (local_zoneis this machine’s, read as local); with none named the time is local (the CLI writes it in the machine’s zone). A time with no date is its next occurrence afternow; a date with no year, likewise. - with_
reset failurewith its reset filled in from what is known forblock_id, at this machine’s clock and time zone. Unchanged unless it is aUsageLimitwith no reset yet.