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.
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/gotypes.d.ts).
Functions§
- build 🔒
- classify
- Classify an agent run failure.
- frame_
error_ 🔒text - Best-effort error text from a terminal stream-json
resultframe:error.message, else a stringerror/result, else thesubtype. - is_
error_ 🔒result_ frame - True if a terminal
resultframe represents a failure. - mentions_
http_ 🔒status - True if
haymentions HTTP statuscodein a status-like context (e.g. “http 429”, “status 429”, “error 429”, “[429]”). Anchoring on a context word avoids the false positives a bare substring would hit — an ISO date like2026-04-29contains “429”. (reagent P2 on #1353.) - tail_
lines 🔒 - Last
max_linesnon-empty lines ofs, further capped to the lastmax_charscharacters (char-safe — never slices mid-codepoint).