Skip to content

fix(relay): codex rm Temperature - #4798

Closed
void-mian wants to merge 1 commit into
QuantumNous:mainfrom
void-mian:fix/codex
Closed

fix(relay): codex rm Temperature#4798
void-mian wants to merge 1 commit into
QuantumNous:mainfrom
void-mian:fix/codex

Conversation

@void-mian

@void-mian void-mian commented May 12, 2026

Copy link
Copy Markdown

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

修复codex后端不支持top_p导致的报错:Unsupported parameter: top_p

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
image

Summary by CodeRabbit

  • Bug Fixes
    • Improved parameter handling for specific upstream models during API requests. Temperature and other decoding parameters are now conditionally adjusted based on the model type for better compatibility.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The PR modifies Codex request conversion to conditionally suppress decoding parameters based on upstream model name: Temperature is cleared for models starting with "o", and both Temperature and TopP are cleared for models starting with "gpt-5", fixing "Unsupported parameter" errors when using gpt-5 with the Codex backend.

Changes

Codex model-specific parameter suppression

Layer / File(s) Summary
Conditional parameter suppression by model prefix
relay/channel/codex/adaptor.go
ConvertOpenAIResponsesRequest now uses model name prefix matching to determine which decoding parameters to suppress: Temperature for o-prefixed models and both Temperature and TopP for gpt-5-prefixed models, resolving unsupported parameter errors.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • QuantumNous/new-api#2229: Both PRs modify model-specific request rewriting for the gpt-5 family—clearing/neutralizing decoding parameters like temperature and TopP.
  • QuantumNous/new-api#2684: Both PRs modify parameter handling in relay/channel/codex/adaptor.go's ConvertOpenAIResponsesRequest (both clear Temperature and adjust other request fields).

Suggested reviewers

  • seefs001

Poem

🐰 A hop and a fix for the models so grand,
Where gpt-5 now dances without TopP's command,
Temperature and friends find their place in the flow,
No more "unsupported" to make budgets glow! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix(relay): codex rm Temperature' is vague and incomplete; 'rm Temperature' is unclear shorthand that does not clearly convey the actual fix (conditionally clearing Temperature and TopP parameters for specific upstream models). Revise title to clearly describe the fix, e.g., 'fix(relay): conditionally clear Temperature and TopP for Codex gpt-5 models' or 'fix(relay): handle unsupported TopP parameter in Codex backend'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR addresses issue #4792 by conditionally clearing TopP (and Temperature) parameters for gpt-5 models in the Codex adaptor, which directly fixes the 'Unsupported parameter: top_p' error reported in the linked issue.
Out of Scope Changes check ✅ Passed All changes in relay/channel/codex/adaptor.go are directly related to fixing the Codex backend's handling of Temperature and TopP parameters for specific upstream models, which is in scope with the linked issue #4792.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
relay/channel/codex/adaptor.go (1)

111-111: 💤 Low value

Consider using English for code comments.

The comment is in Chinese. For better maintainability and international collaboration, consider translating to English: // gpt-5 series models: clear parameters that are no longer supported

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@relay/channel/codex/adaptor.go` at line 111, Replace the Chinese inline
comment "// gpt-5系列模型适配 归零不再支持的参数" in adaptor.go with an English equivalent to
improve readability for international collaborators; for example use "// gpt-5
series models: clear parameters that are no longer supported" and ensure the
wording appears next to the same code block handling GPT-5 parameter
compatibility.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@relay/channel/codex/adaptor.go`:
- Line 111: Replace the Chinese inline comment "// gpt-5系列模型适配 归零不再支持的参数" in
adaptor.go with an English equivalent to improve readability for international
collaborators; for example use "// gpt-5 series models: clear parameters that
are no longer supported" and ensure the wording appears next to the same code
block handling GPT-5 parameter compatibility.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c8df3b38-10c0-411e-b943-25e3a60b142d

📥 Commits

Reviewing files that changed from the base of the PR and between 19fc384 and 346f166.

📒 Files selected for processing (1)
  • relay/channel/codex/adaptor.go

@seefs001 seefs001 closed this May 12, 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.

Unsupported parameter top_p in codex

2 participants