fix(proxy): promote additional_tools input items for openai-response upstreams - #308
Open
jlu-lujing wants to merge 1 commit into
Open
fix(proxy): promote additional_tools input items for openai-response upstreams#308jlu-lujing wants to merge 1 commit into
jlu-lujing wants to merge 1 commit into
Conversation
…upstreams Codex CLI 0.150 sends its code-mode exec tools as a Responses API `additional_tools` input item. Third-party Responses upstreams (sglang, vLLM, ...) validate input types against a strict allowlist and reject the item with 400 "Unsupported Responses API input item type: 'additional_tools'". Reuse the xAI promotion path for the openai-response provider: move declared tools into the root tools array (skipping duplicates by name) and drop the input item. Native OpenAI keeps pass-through since its Responses API accepts the item. Closes mxyhi#307
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
问题
Closes #307
Codex CLI 0.150.x 将内置 code-mode
exec工具以 Responses API 的additional_toolsinput item 混在input中发送(首次请求即包含,且无配置可关闭)。sglang / vLLM 等第三方 Responses 上游对 input 类型做严格白名单校验,直接返回:{"error":{"code":"invalid_request_error","message":"Unsupported Responses API input item type: 'additional_tools' None"}}导致 Codex 完全无法经由 openai-response 上游使用。
方案
xAI 上游已有相同的处理(
promote_xai_additional_tools):把additional_tools里的工具声明提升到根tools数组,再删除该 input item。本 PR 将其泛化为promote_additional_tools并同样应用到openai-responseprovider 的/v1/responses:openaiprovider 保持透传不变(官方 Responses API 接受该 item,且 Responses Lite 依赖 input 内声明)filter_limit_bytes体量上限,与其余改写一致测试
cargo test -p token_proxy_runtime640 passed,新增 3 个用例:openai_response_promotes_additional_tools_into_root_toolsopenai_response_promotion_skips_duplicate_tool_namesnative_openai_keeps_additional_tools_input_items(守护原生透传)本地实测 Codex CLI 0.150.1 → token_proxy → sglang 上游,修复后请求正常返回。