fix(deepseek): 补齐原生协议字段兼容 - #638
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: QUIET Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthrough新增 DeepSeek 原生请求规范化逻辑。Completions 使用 Priority: ⬇️ Low Merge Risk: 🔵 Low · up to 强制 Web Search 请求可能因默认思考模式被 DeepSeek 拒绝。 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5810c660c
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: QUIET
Plan: Advanced
Run ID: 10b105f7-c3f1-4fb3-9403-2b05a3d15f66
📒 Files selected for processing (3)
internal/execution/bifrost/deepseek_native.gointernal/execution/bifrost/deepseek_native_test.gointernal/execution/bifrost/native_fidelity_test.go
Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.
|
关于汇总评论中的 Docstring Coverage:不采纳为达到 80% 而补充注释的建议。仓库未设置此门禁,关键兼容行为已有注释,保留当前最小改动;Web 搜索意见已在对应行内线程说明。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c35775fa3
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| case protocol.OpenAIResponses: | ||
| forced = choice.String() == "required" || | ||
| (choice.Get("type").String() == "function" && choice.Get("name").String() != "") |
There was a problem hiding this comment.
Disable thinking for required allowed-tool choices
For a DeepSeek native Responses request with tool_choice: {"type":"allowed_tools","mode":"required",...}, this condition leaves forced false, so the request is sent without reasoning.effort="none" and DeepSeek's default thinking can conflict with the required tool call. The converted-path guard in deepSeekConversionDisablesThinking already classifies ChatToolChoiceTypeAllowedTools as a forced selection; inspect the nested mode here as well so native Responses requests receive the same compatibility handling.
Useful? React with 👍 / 👎.
* fix(deepseek): 补齐原生协议字段兼容 * fix(deepseek): 兼容强制工具调用与默认思考 * fix(deepseek): 跳过空思考字段别名 (cherry picked from commit f8a04df)
关联 Issue / Related Issue
无。
变更内容 / Change Content
DeepSeek 原生接口存在角色、思考字段及默认思考与强制工具调用的兼容差异。本次在 DeepSeek 原生请求发送前做最小字段适配:
developer,Responses 将其当作普通用户消息:纯文本developer原位映射为system,保留指令内容及位置。reasoning且缺少reasoning_content时,补充后者,保留原字段及已有标准字段值。thinking.type=disabled,Responses 设置reasoning.effort=none。已指定思考开关或强度时保留原值,显式冲突仍由上游返回错误。自动工具选择保持原样。不增删、合并或重排消息,不修改亲和、路由、调度和其他渠道;保留此前 Codex/Grok 中途系统指令修复。Responses 与 Anthropic 继续原生转发思考内容,不补造缺失的思考原文。无数据迁移。
验证:
make check、Bifrost 全包测试及git --no-pager diff --check通过。自查清单 / Checklist
make check,验证范围见上。