Repository navigation
fix(model-stub): GET /v1/models also answers Codex's models shape - #35756
Conversation
Codex 0.164 decodes GET {base_url}/models as {"models": [ModelInfo]}
and logs "failed to decode models response" on the stub's answer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-6e72a055cc3484a9f258
Codex decodes GET {base_url}/models as {"models": [ModelInfo]}. The
stub's answer had only "data", so every Codex run on the stub logged
"failed to refresh available models: failed to decode models response".
The answer now also carries "models": [], which Codex decodes; it then
keeps its fallback model metadata. Anthropic and OpenAI clients still
read "data".
python3 tests/fixtures/model-stub/test_model_stub.py: red on the
previous commit (KeyError: 'models'), 17 tests pass here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-6e72a055cc3484a9f258
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Shipped in:
The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/41888017760 at dba5f44 failed: cmux-next checks (god files, concurrency, crash safety, l10n). |
|
Found 1 test failure on Blacksmith runners: Failure
|
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Leo asked: "Is there a way we can do a 99% true test incl. an account without needing an actual Claude or codex or whomever login?" The shared model stub is that test for Claude Code. #35496 found two gaps that keep Codex turns on it from passing. This PR fixes the first one.
What changes
Codex 0.164 decodes
GET {base_url}/modelsas{"models": [ModelInfo]}(ModelsResponsein codex-rsprotocol/src/openai_models.rs). The stub only answered"data", so on every Codex run it loggedfailed to refresh available models: ... failed to decode models response. The answer now also carries"models": []. Codex decodes that and keeps its fallback model metadata. Anthropic and OpenAI clients still read"data".The decode error was noise, not why Codex turns failed. The real cause is that Codex's default catalog model runs in "code mode": it sends its tools as an
additional_toolsinput item with one JavaScriptexectool, and the stub doesn't speak that. A journey that names its own model (model = "stub-model") gets the plainexec_commandtool and a full tool round trip. That fix, together with keeping the fake sign-in off chatgpt.com, goes in the journey's Codex config in a separate PR.Test
python3 tests/fixtures/model-stub/test_model_stub.pyKeyError: 'models', 1 error out of 17 tests.Observed / Not run
codex exec(codex-cli 0.164.0) against this exactmodel_stub.py, on a Linux host with a scratchCODEX_HOME, a made-up ChatGPT sign-in and the journey's provider config. Before: 2-3failed to decode models responseerrors per run. After: 0.--agent codex --model stub. That needs the config PR as well.Changelog
none
Part of manaflow-ai/cmuxterm-hq#7067.
Agent session: agent session
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Fixes the model stub's
GET /v1/modelsresponse so Codex 0.164 can decode it without loggingfailed to decode models responseon every run.{"models": [...]}shape; the stub now returns an emptymodelslist alongside the existingdatalist, so Codex keeps its fallback model metadata and Anthropic/OpenAI clients are unaffected.models.Written for commit 93c80de. Summary will update on new commits.