fix(responses-bridge): drop Codex tool_search/local_shell tools for chat-only providers - #33783
Conversation
…hat-only providers
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Greptile SummaryThis PR fixes a bug where the Responses-API-to-chat-completion bridge forwarded Codex-specific tool types (
Confidence Score: 5/5Safe to merge — the change touches only the tool-type drop-list in the Responses-to-chat bridge and introduces no new code paths. The fix is a two-item addition to an existing allowlist tuple. The code path it affects (the else branch of the tool-type dispatch loop) is well-understood and already tested by several neighboring tests. The new test accurately mirrors the real-world Codex CLI request shape that triggered the bug, and all assertions are meaningful. No existing tests were weakened or removed. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/responses/litellm_completion_transformation/transformation.py | Adds tool_search and local_shell to the explicit drop-list of Responses-API-only tool types that have no Chat Completions equivalent; the change is minimal, clearly scoped, and logically correct. |
| tests/test_litellm/responses/litellm_completion_transformation/test_litellm_completion_responses.py | Adds a new mock-only unit test that exercises the exact Codex-CLI request shape from the issue report; assertions confirm function tools are preserved while namespace, tool_search, and local_shell are all dropped. |
Reviews (1): Last reviewed commit: "fix(responses-bridge): drop Codex tool_s..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Relevant issues
Fixes #33779
Linear ticket
Pre-Submission checklist
Screenshots / Proof of Fix
Codex CLI (latest) only speaks the Responses API wire, so a request to a chat-only provider (Nvidia NIM in the issue) goes through the
/responses-> chat completion bridge.#32258already dropped thenamespacetool there, but Codex also emits atool_searchtool (and OpenAI Responses can emitlocal_shell), which the bridge still forwarded verbatim, so the provider rejected the whole request the same way NIM did withunknown variant 'namespace', expected 'function'Reproduced end-to-end against a live proxy using a chat-only provider (Fireworks) that exercises the exact same bridge path NIM uses. Both runs at commit
6c7c577; the base run reverted only this file to its parent (6c7c577~1, i.e. the state after#32258)Request body (Codex-style tools;
namespacealready dropped by #32258, sotools[1]istool_search):{ "model": "nemotron-repro", "input": "Say hi in 3 words.", "tools": [ {"type": "function", "name": "shell", "description": "run a shell command", "parameters": {"type": "object", "properties": {}}}, {"type": "namespace", "name": "mcp__server", "description": "grouped tools", "tools": [ {"type": "function", "name": "do_thing", "description": "d", "strict": false, "parameters": {"type": "object", "properties": {}}} ]}, {"type": "tool_search", "execution": "client", "description": "search available tools", "parameters": {"type": "object", "properties": {}}} ] }BEFORE (parent of this commit,
tool_searchleaks):AFTER (this commit):
Proxy log confirms both codex-only tool types are dropped before the upstream call:
Type
🐛 Bug Fix
Changes
transform_responses_api_tools_to_chat_completion_toolskeeps an explicit drop-list of Responses-API-only tool types that have no Chat Completions equivalent, since forwarding them verbatim makes providers reject the request. Addedtool_searchandlocal_shellto that listThe match is exact, so it only affects Codex's bare
type: "tool_search"; Anthropic's versionedtool_search_tool_*_20251119tools and LiteLLM's own name-based tool-search entries (notypefield) still pass through unchangedQA runbook
Not editing tests/e2e; the added test lives under tests/test_litellm
Final Attestation
Link to Devin session: https://app.devin.ai/sessions/13a8b09a4c3446eb8a1bb7c16b6acd06