fix(cpa): 保留 Codex 和 Grok 的中途系统指令 - #633
Conversation
在 Anthropic 转换入口将 system 映射为 developer,保留消息内容和位置,并继续拒绝其他渠道的有损转换。 验证:make check;third_party/cpaembedded 中 go test -count=1 ./...。新增出站回归测试已在修复前复现拒绝,在修复后通过。 用户实测确认:Claude Code 使用 Anthropic 协议请求 Codex 账号的 GPT 模型正常。
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; 6 remain after this review. 📝 WalkthroughWalkthrough本次修改将 Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The instruction-role conversion is scoped to the intended Codex/Grok Anthropic paths and is covered for streaming, non-streaming, and token-count behavior. 🚥 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: 7e6989e09b
ℹ️ 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.
🧹 Nitpick comments (1)
internal/execution/cpa/conversion_fidelity_test.go (1)
196-198: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win验证工具结果内容。
当前测试只验证
input.9.call_id。如果转换器丢失或改写"tool result",测试仍会通过。请同时断言
input.9.output。建议修改
"input.7.call_id": "call_lookup", "input.7.name": "lookup", - "input.8.content.0.text": "DURING_TOOL", "input.9.call_id": "call_lookup", + "input.8.content.0.text": "DURING_TOOL", "input.9.call_id": "call_lookup", + "input.9.output": "tool result",
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: QUIET
Plan: Advanced
Run ID: d177453d-e8c7-436f-8b33-a490e6e22999
📒 Files selected for processing (4)
go.modinternal/execution/cpa/adapter.gointernal/execution/cpa/conversion_fidelity.gointernal/execution/cpa/conversion_fidelity_test.go
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
让 Codex/Grok 的 Anthropic 本地计数复用执行请求的指令角色映射,保持其他渠道计数行为不变。补充计数一致性回归测试和工具结果内容断言。 验证:计数回归测试先复现差异,修复后通过;make check 和 CPA embedded 全套测试通过。
|
关于 Docstring Coverage 的 80% 提示:仓库没有该比例门禁,关键转换逻辑已有必要说明,本次不按比例批量补充注释。 |
关联 Issue / Related Issue
暂无关联 Issue;修复 #631 引入的 Anthropic → Codex/Grok 兼容性回归。
变更内容 / Change Content
Claude Code 的 Anthropic 请求包含中途 system 消息时,Codex/Grok 路径会在发送前返回 422。现在在调用 CPA 前将消息中的 system 映射为 developer,保留指令内容和会话位置,允许这类请求正常转换。
验证:
make check通过。third_party/cpaembedded中go test -count=1 ./...通过。兼容性:不新增配置或数据库迁移。本次未更新公开文档或发布说明。
自查清单 / Checklist
make check,或在说明中写明无法运行的原因和未验证范围。 / I ranmake check, or documented why it could not run and what remains unverified.