A terminal turn.failed classification from the Codex JSONL stream.
Two classes are typed. The budget class is pinned to the stable message
captured from 0.145.0. The API-rejection class reads the machine-readable
code the upstream API supplies, captured from 0.149.0; see
ApiFailure. Unknown failures remain distinguishable rather than being
forced into either class.
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
The upstream API rejected the request before generation began.
The turn produced no output and had no side effects, so a caller may
correct the request and try again. JsonLineEvent::turn_failure_api_error
carries the code that distinguishes which part of the request was
rejected.