Separate four failure shapes.
EMPTY_RESPONSE is already retryable by default.
Valid output reached its request cap; fix budgeting, not classification.
A trailing unit repeats inside one model attempt; guard llm/stream.
Multiple steps or tool calls need loop-level containment.
Detection and recovery are separate decisions.
Ignore reasoning by default and never scan streamed tool-call JSON with a text heuristic.
Emit DEGENERATE_OUTPUT once; nothing follows terminal finish.
rc.8 does not retry this code by default, and direct streams remain single-attempt.
The Agent avoids committing a normal assistant message for the failed attempt, but a client must buffer, retract, or visibly mark streamed text before showing the replacement.
Primary evidence.
Evaluate the guard before making it policy.
The complete guide includes evidence fields, channel rules, threshold experiments, an explicit finite retry configuration, UI semantics, billing caveats, and fourteen acceptance gates.
Read the complete guide