Skip to content

fix(model-stub): GET /v1/models also answers Codex's models shape - #35756

Merged
teamleaderleo merged 2 commits into
feat-cmux-nextfrom
lane/model-stub-codex-models
Nov 4, 2026
Merged

teamleaderleo merged 2 commits into
feat-cmux-nextfrom
lane/model-stub-codex-models

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

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}/models as {"models": [ModelInfo]} (ModelsResponse in codex-rs protocol/src/openai_models.rs). The stub only answered "data", so on every Codex run it logged failed 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_tools input item with one JavaScript exec tool, and the stub doesn't speak that. A journey that names its own model (model = "stub-model") gets the plain exec_command tool 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.py

  • On f89c0a7 (the regression commit alone): KeyError: 'models', 1 error out of 17 tests.
  • On this head: all 17 tests pass.

Observed / Not run

  • Observed: the stdlib test run above. Real codex exec (codex-cli 0.164.0) against this exact model_stub.py, on a Linux host with a scratch CODEX_HOME, a made-up ChatGPT sign-in and the journey's provider config. Before: 2-3 failed to decode models response errors per run. After: 0.
  • Not run: the Cloud journey with --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


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the model stub's GET /v1/models response so Codex 0.164 can decode it without logging failed to decode models response on every run.

  • Codex expects a {"models": [...]} shape; the stub now returns an empty models list alongside the existing data list, so Codex keeps its fallback model metadata and Anthropic/OpenAI clients are unaffected.
  • Adds a test assertion that the response carries models.

Written for commit 93c80de. Summary will update on new commits.

View guided diff Turn on auto-fix

teamleaderleo and others added 2 commits November 4, 2026 18:03
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
@teamleaderleo teamleaderleo added the risk:low Risk tier (docs/ci/risk-tiers.md) label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 93c80de: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr35756 -f ref=lane/model-stub-codex-models -f platform=macos -f backend_mode=local

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).
Those jobs last passed at 2955a17. This pull request is one of 5 merged since: #35756, #35717, #35759, #35521, #35641.
If the failure is in your change, fix forward on feat-cmux-next. Pull requests run only the tiers their paths reach (docs/ci/cmux-next-tiers.md); label a batch PR full-ci to run them all before merging.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex, router-review): SHIP at 93c80de

Reviewer: codex gpt-6.1-sol xhigh, fast tier.

SHIP at 93c80de
Visual verdict: unchanged by this diff

Focused model-stub tests pass: 17/17.

Follow-ups: none

@cmux-bot cmux-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmux-bot approves 93c80de: an independent review passed this exact head (router-review receipt by teamleaderleo). A push needs a new review; a later BLOCK at this head dismisses this approval.

@blacksmith-sh

blacksmith-sh Bot commented Nov 4, 2026

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
test_every_listed_hook_is_one_glaeda_released_with_the_check (main.SigningHooksInSt
epWithGlaedaTests.test_every_listed_hook_is_one_glaeda_released_with_the_check)/
test_every_listed_hook_is_one_glaeda_released_with_the_check (main.SigningHooksInSt
epWithGlaedaTests.test_every_listed_hook_is_one_glaeda_released_with_the_check)
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 93c80de1 Deployed Nov 4, 2026 by teamleaderleo via wait for same-key tree publisher #112630
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant