Expand description
Classification of agent (Claude CLI) run failures into a small, stable taxonomy with a human-readable explanation.
classify() is a pure function: it takes the exit code, the
terminating signal, the tail of the child’s stderr, and an optional
terminal result frame, and returns an AgentFailure. It does no
IO and is exhaustively unit-tested against the real Anthropic error
phrasings, so the “why” behind a non-zero exit can be surfaced to the
user instead of a bare exit 1.
See docs/specs/SPEC_AGENT_FAILURE_DIAGNOSTICS_2026_06_11.md. This
is the P1 (capture + classify) slice; live-stream emission and UI
banners are P2/P3.
Modules§
- rules
- The rules
classifytries, in order, to name a failure. A rule answersSomefailure when the evidence is its cause,Nonewhen it is not.
Structs§
- Agent
Failure - A classified agent failure: the class, a user-facing title + detail, the raw exit evidence, the stderr tail, and whether a retry is worth attempting.
Enums§
- Failure
Class - Stable failure taxonomy. Wire format is snake_case to match the rest
of the agent event surface (
frontend/types/srv-types.d.ts).
Constants§
- ROUTE_
CREDITS_ TITLE - The title of a
UsageLimitfailure whose cause is a model route with no credits left (HTTP 402).
Functions§
- classify
- Classify an agent run failure.
- open_
in_ other_ pane_ holder - The block id in
held_elsewhere_error’s “already open in another pane (block X)” refusal, whentextis that refusal. The wording is ours, built in one place, so this reads it back.