Skip to content

fix(codex): expose native model ids in catalog#2012

Merged
diegosouzapw merged 2 commits intodiegosouzapw:release/v3.8.0from
Tr0sT:fix-codex-native-model-catalog
May 7, 2026
Merged

fix(codex): expose native model ids in catalog#2012
diegosouzapw merged 2 commits intodiegosouzapw:release/v3.8.0from
Tr0sT:fix-codex-native-model-catalog

Conversation

@Tr0sT
Copy link
Copy Markdown
Contributor

@Tr0sT Tr0sT commented May 6, 2026

Summary

  • expose Codex native GPT model ids in the models catalog so Codex
    auto-review can resolve them
  • route Codex-native Responses requests for gpt-5.5 to the codex
    provider instead of OpenAI
  • keep generic OpenAI Responses gpt-5.5 resolution unchanged

Validation

  • node --import tsx/esm --test tests/unit/chat-helpers.test.ts
  • node --import tsx/esm --test tests/unit/plan3-p0.test.ts
  • node --import tsx/esm --test tests/unit/models-catalog- route.test.ts
  • git diff --check
  • pre-push npm run test:unit: 4145 passed, 0 failed
  • local /api/v1/responses/compact smoke no longer fails with No credentials for provider: openai; logs show gpt-5.5 -> codex/gpt- 5.5

@Tr0sT Tr0sT requested a review from diegosouzapw as a code owner May 6, 2026 18:52
Copy link
Copy Markdown
Contributor

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

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 native routing for Codex models, specifically adding support for 'codex-auto-review' and routing 'gpt-5.5' requests from Codex-native clients to the 'codex' provider. It also updates the models catalog to include bare and prefixed IDs for these models. Feedback includes a critical fix for a ReferenceError caused by an undefined contextLength variable and a suggestion to consolidate redundant logic in the model registration loop.

Comment thread src/app/api/v1/models/catalog.ts Outdated
Comment on lines +392 to +393
...(contextLength ? { context_length: contextLength } : {}),
...(visionFields || {}),
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.

critical

The variable contextLength is not defined in this scope, which will cause a ReferenceError at runtime when this block is executed. Since the preceding model registration blocks in this loop do not include context length metadata, this line should be removed.

Suggested change
...(contextLength ? { context_length: contextLength } : {}),
...(visionFields || {}),
...(visionFields || {}),

Comment thread src/app/api/v1/models/catalog.ts Outdated
Comment on lines +379 to +395
if (
canonicalProviderId === "codex" &&
CODEX_NATIVE_UNPREFIXED_MODELS.has(model.id) &&
!models.some((existingModel) => existingModel.id === model.id)
) {
models.push({
id: model.id,
object: "model",
created: timestamp,
owned_by: canonicalProviderId,
permission: [],
root: model.id,
parent: `${canonicalProviderId}/${model.id}`,
...(contextLength ? { context_length: contextLength } : {}),
...(visionFields || {}),
});
}
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.

medium

This block is redundant with the loop starting at line 399, which also handles adding unprefixed versions of models in CODEX_NATIVE_UNPREFIXED_MODELS. The loop at line 399 is more comprehensive as it ensures all three ID variants (alias-prefixed, provider-prefixed, and bare) are registered correctly. Consider consolidating this logic to avoid duplication and potential inconsistencies.

@Tr0sT
Copy link
Copy Markdown
Contributor Author

Tr0sT commented May 6, 2026

Addressed both review comments in a separate commit: 05f514f0.

I removed the redundant Codex bare-model insertion block from src/ app/api/v1/models/catalog.ts. The later
CODEX_NATIVE_UNPREFIXED_MODELS loop now remains the single source
for registering cx/..., codex/..., and bare native Codex model
IDs, which also removes the invalid contextLength reference.

@diegosouzapw diegosouzapw changed the base branch from main to release/v3.8.0 May 7, 2026 11:24
@diegosouzapw
Copy link
Copy Markdown
Owner

Thank you @Tr0sT for your contribution! This has been reviewed and is now merged into release/v3.8.0 for the upcoming release. Amazing work!

@diegosouzapw diegosouzapw merged commit d96f0c2 into diegosouzapw:release/v3.8.0 May 7, 2026
66 of 67 checks passed
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.

2 participants