fix(openai): 补齐 WS HTTP bridge 的客户端工具适配 - #5764
Merged
Merged
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
问题
当 Codex 通过 WebSocket ingress 发起 Responses 请求,而选中的 OpenAI API-key 账号需要走 HTTP bridge 时,后续轮次会重放历史工具调用。Codex 的客户端工具历史使用:
{"type":"custom_tool_call","name":"exec","input":"..."}部分 OpenAI Responses 兼容上游只接受标准
function_call.arguments。当前 bridge 直接发送 replay body,因而可能返回:同时,即使请求侧完成降级,上游返回的
function_call也必须在发送给 Codex、以及写入下一轮 replay 历史之前恢复成custom_tool_call。与现有 Issue / PR 的关系
proxyOpenAIWSHTTPBridgeTurn独立构造请求和消费 SSE,没有经过 fix(openai): restore API-key custom tool calls #5661 修改的forwardOpenAIPassthrough适配边界;本 PR 补齐这一遗漏路径。本 PR 是对 #5661 的补充,不替代其普通 HTTP passthrough 修复。
改动
测试
新增回归测试覆盖完整路径:
custom_tool_call.input被转换为function_call.arguments;function_call_output保持对齐;function_call被恢复为custom_tool_call.input;response.completed和下一轮 replay input 都保留恢复后的 custom 类型。已运行:
完整集成测试由本 PR 的 GitHub Actions 验证。