Skip to content

fix(codex): preserve configured model metadata identity#4267

Closed
Shrimpwr wants to merge 3 commits into
router-for-me:devfrom
Shrimpwr:fix/codex-model-metadata
Closed

fix(codex): preserve configured model metadata identity#4267
Shrimpwr wants to merge 3 commits into
router-for-me:devfrom
Shrimpwr:fix/codex-model-metadata

Conversation

@Shrimpwr

Copy link
Copy Markdown

Summary

  • preserve configured models[].name as an internal canonical metadata model ID while keeping aliases and prefixes as client-facing route IDs
  • resolve Codex client catalog templates and static capabilities through the canonical ID, then restore the client-facing ID as the emitted slug
  • keep the internal metadata identity out of ordinary OpenAI model-list maps
  • cover alias, prefix, prefix + alias, static capability fallback, and legacy ID lookup behavior

This fixes configured routes such as krc/gpt-5.6-sol or a custom alias falling back to the gpt-5.5 Codex client template. They now inherit the full gpt-5.6-sol metadata, including the 372000 context window and comp_hash: "3000", without changing routing slugs.

Related PRs

Testing

  • go test -v -run TestCodexClientModelsResponse_ ./sdk/api/handlers/openai
  • go test -v -run TestBuildConfigModelsDisplayName ./sdk/cliproxy plus the new metadata/prefix tests
  • go build -o test-output ./cmd/server && rm test-output
  • go test ./... passes all packages except the existing internal/api assertion in TestModelsWithClientVersionReturnsCodexCatalog (custom priority = 143, want 129); the same failure reproduces on a clean upstream/dev worktree at e0a0b5a.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread sdk/api/handlers/openai/codex_client_models.go
Comment thread sdk/api/handlers/openai/codex_client_models.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment on lines +58 to 62
if template, ok := templates[metadataID]; ok {
entry := cloneCodexClientModelMap(template)
entry["slug"] = id
templateBackedIndexes[len(result)] = struct{}{}
applyCodexClientDisplayName(entry, model)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@Shrimpwr
Shrimpwr force-pushed the fix/codex-model-metadata branch from 4122fb6 to 9aeac3b Compare July 13, 2026 10:49

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@Shrimpwr Shrimpwr closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant