B2: a retired-model 404 reports MODEL_UNUSABLE, not CODEX_MODE: ready

The model probe matched only 400 / 'is not supported', so a retired model's
404 ('does not exist or you do not have access to it') and a custom
provider's bare 404 fell through to the inconclusive branch and reported
ready. Both now classify as MODEL_UNUSABLE with a hint naming the two causes
(retired model, or a wrong base_url) and log codex_model_retired; a
'requires a newer version of Codex' 400 points at upgrading the CLI and logs
codex_cli_outdated. Ported from #2843 onto the current probe.

Co-authored-by: Marek Cermak <marek.cermak@strv.com>
This commit is contained in:
garrytanandMarek Cermak committed 2026-10-03 21:05:23 +00:00
1 parent 0642559f60
commit ee70becad5
3 files changed
+58 -12

No files matched your search

+8 -5
View File
@@ -97,7 +97,7 @@ If the output contains `AUTH_FAILED`, stop and tell the user:
If the output contains `MODEL_UNUSABLE`, stop — the selected model (named with its
source on the `CODEX_MODEL:` line) is invalid or the account cannot use it. Relay the
probe's HINT lines and
follow the "Model not supported (HTTP 400)" recovery steps in
follow the "Model not supported (HTTP 400 or 404)" recovery steps in
`## Error Handling` below. Running the modes anyway just burns four
invocations on the same 400 (#2477).
@@ -293,11 +293,14 @@ If token count is not available, display: `Tokens: unknown`
missing or wrong. A prompt-only `codex review` defaults to uncommitted changes, so a
clean working tree reads as an empty review even when `<base>...HEAD` is large. Confirm
`--base <base>` is actually on the command line.
- **Model not supported (HTTP 400):** stderr shows
- **Model not supported (HTTP 400 or 404):** stderr shows
`The '<model>' model is not supported when using Codex with a ChatGPT account`
(a `status: 400` / `invalid_request_error` naming a model). This is a
model-entitlement problem, not an auth or network failure, and the auth probe
cannot catch it. Recovery, in order:
(a `status: 400` / `invalid_request_error` naming a model), or
`404 Not Found: The model '<model>' does not exist or you do not have access to it`
(a retired model; a bare 404 usually means a custom provider's `base_url` is wrong).
`requires a newer version of Codex` means the CLI is too old: upgrade it instead.
None of these is an auth or network failure, and the auth probe cannot catch them.
Recovery, in order:
1. Read the `CODEX_MODEL:` line: it names the model and where it came from.
2. Fix that source: name another model for this request, update
`GSTACK_CODEX_MODEL`, or change `model` (or `review_model`) in the Codex