fix(codex): preserve configured model metadata identity#4267
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an internal MetadataModelID field to ModelInfo to track the canonical model used for resolving client metadata and capabilities (such as context window, input modalities, and thinking) while preserving client-specific overrides (like display name and description). It updates the Codex client model builder to resolve and use this metadata ID, and ensures the field is preserved during configuration and prefixing. Comprehensive unit tests have been added to verify these behaviors. I have no feedback to provide as there are no review comments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7493a8d11f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d95a50f9e0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if template, ok := templates[metadataID]; ok { | ||
| entry := cloneCodexClientModelMap(template) | ||
| entry["slug"] = id | ||
| templateBackedIndexes[len(result)] = struct{}{} | ||
| applyCodexClientDisplayName(entry, model) |
There was a problem hiding this comment.
Apply route overrides to templated aliases
When an OpenAI-compatible route is configured with a client-facing alias but name/MetadataModelID equal to a Codex template such as gpt-5.6-sol, this branch clones the template and returns before applyCodexClientModelMetadata can merge the route-specific registry metadata. The fresh evidence is that the override merge now exists only in the non-template path, so configured input-modalities or thinking.levels are ignored and the Codex catalog can advertise template-only capabilities like image input or max/ultra reasoning for a backend that only declared a smaller set.
Useful? React with 👍 / 👎.
4122fb6 to
9aeac3b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9aeac3ba6b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| metadataID := codexClientMetadataModelID(id) | ||
|
|
||
| if template, ok := templates[id]; ok { | ||
| if template, ok := templates[metadataID]; ok { |
There was a problem hiding this comment.
Use metadata IDs for non-template aliases
Fresh evidence is that the final diff computes metadataID here but, when that canonical ID has no Codex template, the fallback still calls applyCodexClientModelMetadata(entry, id, model) and never looks up metadata for metadataID. For configured routes like name: claude-opus-4-6 with alias: router-opus, the Codex catalog therefore keeps the default template's context window instead of the static Claude 1,000,000-token metadata available under the canonical name, causing clients to under-advertise/cap the route.
Useful? React with 👍 / 👎.
Summary
models[].nameas an internal canonical metadata model ID while keeping aliases and prefixes as client-facing route IDsslugThis fixes configured routes such as
krc/gpt-5.6-solor a custom alias falling back to thegpt-5.5Codex client template. They now inherit the fullgpt-5.6-solmetadata, including the 372000 context window andcomp_hash: "3000", without changing routing slugs.Related PRs
Testing
go test -v -run TestCodexClientModelsResponse_ ./sdk/api/handlers/openaigo test -v -run TestBuildConfigModelsDisplayName ./sdk/cliproxyplus the new metadata/prefix testsgo build -o test-output ./cmd/server && rm test-outputgo test ./...passes all packages except the existinginternal/apiassertion inTestModelsWithClientVersionReturnsCodexCatalog(custom priority = 143, want 129); the same failure reproduces on a cleanupstream/devworktree at e0a0b5a.