fix(codex): surface gpt-5.x in /model chooser (drop stale allowlist)#1546
Merged
Conversation
The API-fetch fallback in `fetchModelsFromAPI` filtered `GET /v1/models`
through `openaiChatModels`, a hard-coded 11-entry map added on
2026-03-02 and never updated. Every `gpt-5*` variant returned by
providers using `codex-cli >= 0.143` (including `gpt-5.6-sol`,
`gpt-5.6-terra`, `gpt-5.6-luna`) was silently dropped, so upgrading the
Codex CLI did not make GPT-5.6 selectable in cc-connect's /model chooser.
Users hitting the other three code paths — `readCodexModelCatalog`
(explicit `model_catalog_json` in `~/.codex/config.toml`),
`configuredModels` (explicit `models = [...]` in the provider config),
or `readCodexCachedModels` (last-resort read of
`~/.codex/models_cache.json`) — were unaffected.
Fix: replace the static map with `isCodexChatModel`, which uses pattern
rules so future frontier models (gpt-5.x, gpt-6, o5-*, codex-*) are
picked up automatically.
Accept gpt-* / chatgpt-* / codex-* / o1-* / o3-* / o4-* / o5-*
plus bare o1, o3, o4, o5.
Reject any ID containing embedding, whisper, tts, dall-e,
audio-preview, realtime, transcribe, moderation, image, or
search-preview (so /v1/models cannot leak embedding, audio,
image, or moderation models into a chat chooser).
45 unit tests cover the legacy chat families, GPT-5.0–5.6 (incl. Bedrock
variants), case-insensitivity, and every non-chat modality currently
served by /v1/models.
Reported by external user on WeChat: "5.6 的模型选不到,已经更新几次
cli 到 144 版本".
Co-authored-by: Cursor <cursoragent@cursor.com>
JayGarland
pushed a commit
to JayGarland/cc-connect
that referenced
this pull request
Jul 14, 2026
…henhg5#1546) The API-fetch fallback in `fetchModelsFromAPI` filtered `GET /v1/models` through `openaiChatModels`, a hard-coded 11-entry map added on 2026-03-02 and never updated. Every `gpt-5*` variant returned by providers using `codex-cli >= 0.143` (including `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`) was silently dropped, so upgrading the Codex CLI did not make GPT-5.6 selectable in cc-connect's /model chooser. Users hitting the other three code paths — `readCodexModelCatalog` (explicit `model_catalog_json` in `~/.codex/config.toml`), `configuredModels` (explicit `models = [...]` in the provider config), or `readCodexCachedModels` (last-resort read of `~/.codex/models_cache.json`) — were unaffected. Fix: replace the static map with `isCodexChatModel`, which uses pattern rules so future frontier models (gpt-5.x, gpt-6, o5-*, codex-*) are picked up automatically. Accept gpt-* / chatgpt-* / codex-* / o1-* / o3-* / o4-* / o5-* plus bare o1, o3, o4, o5. Reject any ID containing embedding, whisper, tts, dall-e, audio-preview, realtime, transcribe, moderation, image, or search-preview (so /v1/models cannot leak embedding, audio, image, or moderation models into a chat chooser). 45 unit tests cover the legacy chat families, GPT-5.0–5.6 (incl. Bedrock variants), case-insensitivity, and every non-chat modality currently served by /v1/models. Reported by external user on WeChat: "5.6 的模型选不到,已经更新几次 cli 到 144 版本". Co-authored-by: dev-claudecode <dev-claudecode@cc-connect.local> Co-authored-by: Cursor <cursoragent@cursor.com>
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.
背景
外部用户 (微信群 Shawn) 反馈:5.6 的模型选不到,已经更新几次 cli 到 144 版本。已经升级
codex-cli到>= 0.143(Sol/Terra/Luna 系列开始随发布),但在 cc-connect 的/model选择器里依然看不到任何gpt-5.x模型。根因
agent/codex/codex.go里的fetchModelsFromAPI通过openaiChatModelsmap (2026-03-02 添加后 4 个多月未更新) 过滤GET /v1/models响应:fetchModelsFromAPI的用户 (没配model_catalog_json也没配provider.models = [...]) 就算 CLI 升级了也只能看到这 11 个老模型/v1/models里返回的gpt-5-*/gpt-5.3-codex/gpt-5.4/gpt-5.5/gpt-5.6/gpt-5.6-sol/gpt-5.6-terra/gpt-5.6-luna全部被静默丢弃AvailableModels4 层 fallback 顺序readCodexModelCatalog— 显式配置model_catalog_jsonin~/.codex/config.tomlconfiguredModels— cc-connect provider config 里models = [...]fetchModelsFromAPI—GET /v1/models+ 白名单过滤readCodexCachedModels—~/.codex/models_cache.json方案
用模式匹配替换静态 map, future-proof:
gpt-*/chatgpt-*/codex-*/o1-*/o3-*/o4-*/o5-*+ 裸o1/o3/o4/o5embedding,whisper,tts,dall-e,audio-preview,realtime,transcribe,moderation,image,search-preview—— 防止 embedding / audio / image / moderation 模型污染 chat 选择器gpt-5.6,gpt-6,o5-mini,codex-*等未来模型自动兼容,无需再修代码测试
45 个 test case (
TestIsCodexChatModel) 覆盖:gpt-4o,gpt-4.1,chatgpt-4o-latest,o1,o1-mini,o1-preview,o3,o3-mini,o4-mini,codex-mini-latestgpt-5,gpt-5-mini,gpt-5.3,gpt-5.3-codex,gpt-5.4,gpt-5.5,gpt-5.6,gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-lunaGPT-5.6,Codex-Mini-Latesttext-embedding-*,whisper-1,tts-1,gpt-4o-realtime-preview,gpt-4o-audio-preview,gpt-4o-transcribe,gpt-4o-search-preview,dall-e-3,gpt-image-1,text-moderation-latest,omni-moderation-latestbabbage-002,davinci-002,claude-3-5-sonnet,gemini-1.5-pro影响面 / 风险
fetchModelsFromAPI路径, 也就是没显式配model_catalog_json/provider.models的默认 codex 用户model_catalog_json的高级用户 (走优先级 1) 完全不受影响/model里多列出用户 provider 支持的 GPT-5 系列Workaround (供用户在合并前使用)
如果用户想立刻用 gpt-5.6, 两个 workaround (等价于绕过第 3 层去命中第 1/2 层):
models = ["gpt-5.6"](触发configuredModels)~/.codex/config.toml加model_catalog_json = "~/.codex/models_cache.json"(触发readCodexModelCatalog, 需要 CLI >= 0.143)Reporter
外部用户微信反馈 (Shawn), 由 QA 定位并修复。
Made with Cursor