Repository navigation
Conversation
The codex models config sent client_version=1.0.0 to /codex/models. That endpoint gates each catalog entry by minimal_client_version, and codex CLI's own manifest already requires 0.144.0 for its newest models, so an old client_version comes back 200 with those entries silently missing instead of erroring. Bump the version, add the originator header codex requests already send everywhere else in this codebase (registry, image provider, usage tracking), and move the codex entry onto the same buildOAuthResolver pattern gemini-cli and grok-cli already use. That gives model sync the same refresh-on-401 retry those providers get (codex had none before) and surfaces a warning in the response instead of a silent empty list when the upstream call still comes back with zero models.
Owner
|
Thanks @doedja for the contribution! Reviewed and merged into master. 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Codex model sync calls
https://chatgpt.com/backend-api/codex/models?client_version=1.0.0. That endpoint filters the returned catalog byminimal_client_versionagainst whateverclient_versionthe caller sends, and codex CLI's own manifest (openai/codexcodex-rs/models-manager/models.json) already requires0.144.0for its newest models.1.0.0predates that by a wide margin, so the request can come back a clean 200 with the gated entries just missing, no error to react to.We hit this in our own implementation of the same call: a real ChatGPT Plus account got a 200 with an empty model list at
client_version=0.21.0, and the list populated once we bumped to a current release.There's also no fallback in the generic sync branch this entry runs through (
route.js~519-547): a 200 with zero models is returned to the client as-is, with no warning field, nothing to signal that something's off.Fix
client_versionto0.144.6(current stable, comfortably above the0.144.0gate) via a named constant with a comment explaining the gating, so it doesn't quietly go stale again.originator: codex_cli_rsheader. Every other codex call site in this codebase already sends it (open-sse/providers/registry/codex.js,open-sse/handlers/imageProviders/codex.js,open-sse/services/usage/codex.js), just not this one.buildOAuthResolverhelper, the same patterngemini-cliandgrok-clialready use.refreshCodexTokenwas already implemented and used elsewhere (the general provider refresh table inopen-sse/services/tokenRefresh.js), just never wired into model sync, so codex model listing never retried on an expired token the way the other OAuth providers do. This also means a genuinely empty response now comes back with awarningfield instead of a silent empty array.Scope
Kept this to the codex entry only. I looked at also wiring a static-catalog fallback for a fully-empty result (like
kimchi/grok-clido), but there's no static codex catalog inopen-sse/config/providerModels.jsto fall back to, and I didn't want to guess at a model list. Happy to follow up separately if that's wanted.Checks
bunx eslint "src/app/api/providers/[id]/models/route.js"clean.vitestisn't a declared dependency and there's notestscript inpackage.json, even thoughtests/unit/*.test.jsexists, so I couldn't run it against a fresh clone.Reference: https://raw.githubusercontent.com/openai/codex/refs/heads/main/codex-rs/models-manager/models.json