Skip to content

feat(codex): extend GPT-5.6 reasoning and fallback support - #1657

Open
AaronZ345 wants to merge 4 commits into
chenhg5:mainfrom
AaronZ345:agent/codex-gpt56-reasoning-efforts-20260809
Open

feat(codex): extend GPT-5.6 reasoning and fallback support#1657
AaronZ345 wants to merge 4 commits into
chenhg5:mainfrom
AaronZ345:agent/codex-gpt56-reasoning-efforts-20260809

Conversation

@AaronZ345

Copy link
Copy Markdown
Contributor

Supersedes #1519. This is the same patch on a fresh branch after the 30-day maintenance gate; the prior PR had no requested changes or unresolved review threads.

Summary

  • accept none, minimal, max, and ultra as Codex reasoning efforts
  • build /reasoning and /effort usage text from the active agent instead of hardcoding four levels
  • add current GPT-5.x models to the hardcoded fallback used only when catalog, cache, and API discovery return nothing
  • document the eight canonical Codex reasoning levels in config.example.toml

Relation to #1547

#1547 already fixed GPT-5.x discovery from /v1/models by replacing the stale allowlist with isCodexChatModel. This PR leaves that filter unchanged.

The remaining model change here is limited to defaultCodexModels(), the final offline fallback. The duplicate GPT-5.6 API test has also been removed; the upstream codex_model_test.go suite now owns API-filter coverage.

The reasoning changes are separate from model discovery. Codex CLI 0.144 accepts the newer levels, but cc-connect previously normalized values beyond xhigh to an empty string and showed a stale four-level usage message.

Validation

  • go test ./agent/codex -count=1
  • go test ./core -run "TestCmdReasoning_UsageListsAgentEfforts|TestCmdReasoning_SwitchesEffortAndResetsSession" -count=1
  • go test -tags no_web ./cmd/cc-connect ./core ./agent/codex -count=1
  • git diff --check

@chenhg5 chenhg5 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

结论: Approve

总体判断: 一个 Codex feature 扩展——把 reasoning effort 从 4 个 level(low/medium/high/xhigh)扩到 8 个(none/minimal/low/medium/high/xhigh/max/ultra),与 Codex CLI 0.144+ 对齐。同时更新 GPT-5.x fallback 模型列表(仅在 catalog / cache / API discovery 全部失败时使用)。修复了「Codex 0.144+ 用户切 reasoning 但 cc-connect 显示 stale four-level usage」的体验问题。建议合入。

Review 范围:

  • 看了 agent/codex/codex.gonormalizeReasoningEffort(加 none/minimal/max/ultra + alias)+ AvailableReasoningEfforts 返回 8 项 + defaultCodexModels 加 GPT-5.x fallback。
  • 看了 core/engine.go 中新增 reasoningUsage(efforts []string) helper + 两个 call site 替换。
  • 看了 core/i18n.go 中 5 个语言版本的 MsgReasoningUsage 改为 %s 占位符。
  • CI: 2 次 run 都全绿(首次 push + rebase 后)。

✅ 做得好的地方:

  • 与 upstream Codex 0.144+ 对齐:作者明确指出 cc-connect previously normalized values beyond xhigh to an empty string,这条 fix 让 cc-connect 不再「无理由拒绝」Codex CLI 已经支持的值。这是「adopt upstream capability」的最小改动。
  • normalizeReasoningEffort 加 aliasoff/disabled/disable 都映射到 noneminminimalextra-high/extra_high/very-highxhighmaximummax。这种 alias 容错让 user 输入有弹性。
  • reasoningUsage helper 抽出来避免重复/reasoning chat command + renderReasoningCard 共用同一个 helper,避免「改了 chat command 但忘了 card 渲染」的 drift。
  • i18n 完整同步:5 个语言版本(English / 简体中文 / 繁體中文 / 日本語 / Español)都更新成 %s 占位符——这与既有 MsgModeUsage 模式一致("%s" 占位 + runtime fill)。
  • defaultCodexModels 的 fallback 策略:只在 AvailableModels 三个 source(catalog / cache / API discovery)都失败时使用 hardcoded fallback——这条优先级与 PR body 描述一致。

🟠 建议改进(不阻塞):

  • GPT-5.6 sol/terra/luna 模型名核实:这些名字 (gpt-5.6-sol / gpt-5.6-terra / gpt-5.6-luna / gpt-5.6) 看起来像内部 / codename,不是 Codex CLI 已发布的官方模型名。如果 fallback 在 catalog 全部失败时被显示,会误导用户。建议作者在 PR body 或 commit message 注释这些名字的来源(上游 Codex 0.144+ 已确认 / 推测未来模型 / 内部代号),便于 reviewer 判断可信度。
  • defaultCodexModels 应该附 LastVerified 时间戳:hardcoded fallback 容易 stale。建议加一行注释 # Last verified: YYYY-MM-DD against Codex CLI X.Y.Z 让 future maintainer 知道何时该刷新。
  • reasoningUsage 输出格式:当前直接 strings.Join(efforts, "|") — 如果 efforts 是 8 个,输出会很长。考虑 truncated 展示(none|minimal|low|medium|high|xhigh|max|ultra 共 44 字符)。i18n 字符串 "%s" 直接拼,建议加一个隐式分隔或者 prefix low|medium|...(已有顺序)已合理。

🔵 可选优化:

  • 无。

Testing / Risk:

  • 已看到的验证: CI 2 次 run 全绿;go test -tags no_web ./cmd/cc-connect ./core ./agent/codex -count=1 通过;git diff --check 通过。
  • 未覆盖风险: real Codex CLI 0.144+ 用 none/minimal/max/ultra 切 reasoning 的真实场景——但这是 upstream 能力测试,不需要 cc-connect 重复覆盖。
  • Blast radius: 仅 agent/codex/core/engine.go/reasoning 命令渲染路径;对其他 agent / platform 无影响。

Next step:

  • 建议 owner 直接 merge。Reasonable feature extension,scope 小,i18n 同步完整。可以现在合。
  • post-merge 验证: 用真实 Codex CLI 0.144+ 跑 /reasoning max/reasoning ultra,确认 Codex 接受且 cc-connect 显示 usage 时列出 8 个 level。

@AaronZ345
AaronZ345 force-pushed the agent/codex-gpt56-reasoning-efforts-20260809 branch from a2052c9 to 110ce76 Compare August 13, 2026 14:44
@AaronZ345
AaronZ345 force-pushed the agent/codex-gpt56-reasoning-efforts-20260809 branch from 110ce76 to 5e453d5 Compare August 14, 2026 14:43
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