Do not classify every max-token finish.Prove consecutive repetition inside one text stream; code, tables, logs, and generated fixtures may be intentionally repetitive.

Separate four failure shapes.

Empty completion

EMPTY_RESPONSE is already retryable by default.

Token ceiling

Valid output reached its request cap; fix budgeting, not classification.

Repeated text

A trailing unit repeats inside one model attempt; guard llm/stream.

Agent loop

Multiple steps or tool calls need loop-level containment.

Detection and recovery are separate decisions.

Scopetext only

Ignore reasoning by default and never scan streamed tool-call JSON with a text heuristic.

Protocolone terminal failure

Emit DEGENERATE_OUTPUT once; nothing follows terminal finish.

Policyfinite opt-in

rc.8 does not retry this code by default, and direct streams remain single-attempt.

Live text may already be visible.

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