Repository navigation
fix(responses): normalize function-call ids and strip Gemini thought signatures on cross-provider replay - #38337
Open
csarushan1729 wants to merge 4 commits into
Conversation
Contributor
Greptile SummaryThis PR normalizes replayed function-call identifiers before the Responses chat-completions bridge forwards them upstream
Confidence Score: 4/5The PR appears safe to merge after addressing the non-blocking provider-boundary, typing, and input-mutation concerns The normalization behavior has focused coverage, and no concrete runtime regression remains established, but the implementation bypasses provider adapters and mutates loosely typed caller input Files Needing Attention: litellm/responses/utils.py
|
| Filename | Overview |
|---|---|
| litellm/responses/main.py | Invokes function-call identifier normalization immediately before the chat-completions bridge |
| litellm/responses/utils.py | Adds identifier normalization, but places provider-specific translation in shared code and mutates an Any-typed request |
| tests/test_litellm/responses/test_function_call_id_normalization.py | Adds focused coverage for thought-signature removal, prefix conversion, and matching call/output identifiers |
Reviews (1): Last reviewed commit: "fix(responses): normalize function-call ..." | Re-trigger Greptile
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
csarushan1729
force-pushed
the
fix/responses-api-function-call-id-normalization
branch
3 times, most recently
from
August 26, 2026 12:16
5f80d49 to
3f3140d
Compare
…signatures on cross-provider replay
csarushan1729
force-pushed
the
fix/responses-api-function-call-id-normalization
branch
from
August 26, 2026 12:32
3f3140d to
f56bfdb
Compare
Contributor
7 tasks done
…on-call-id-normalization
devin-ai-integration
Bot
changed the base branch from
litellm_internal_staging
to
main
September 23, 2026 14:54
…sponses-api-function-call-id-normalization # Conflicts: # tests/unit/responses/test_function_call_id_normalization.py
5 of 7 tasks
1 task done
1 task done
This branch has not been deployed
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.
TLDR
Problem this solves:
/v1/responsesforwards foreign-provider tool-call IDs to other providers unchangedHow it solves it:
__thought__signatures fromcall_idwhen the target isn't Geminicall_,tooluse_,toolu_vrtx_) to OpenAI'sfc_formatfunction_call/function_call_outputitems before the chat-completions bridge forwards them upstreamUser Flow
Before: a developer building a cross-provider agentic loop via
/v1/responsesgets invalid function-call IDs when replaying a Gemini tool call to an OpenAI model, causing the tool result to not match.POST /v1/responseswithmodel: gemini-3.5-flashand aget_weathertool; Gemini responds with afunction_callitem whosecall_idiscall_23299...__thought__AY89a1...(acall_prefix with an embedded thought signature)POST /v1/responseswithmodel: gpt-4.1, passing back the Geminifunction_callitem and afunction_call_outputwith the samecall_id; the proxy forwards the rawcall_...__thought__...ID to OpenAI without stripping the signature or converting itcall_prefix and an embedded__thought__signature instead of the expectedfc_-prefixed ID, causing ID-mismatch errors or rejected requestsAfter: the same cross-provider replay works because the proxy normalizes function-call IDs before forwarding.
POST /v1/responseswithmodel: gemini-3.5-flashand get the samefunction_callitem withcall_id = call_23299...__thought__AY89a1...POST /v1/responseswithmodel: gpt-4.1; the proxy strips the__thought__signature from thecall_idand rewrites thecall_prefix tofc_before forwarding to OpenAIfc_-prefixed ID, the tool result matches, and the conversation continues normallyRelevant issues
Fixes #38270
Linear ticket
Pre-Submission checklist
pytest tests/test_litellm/responses/test_function_call_id_normalization.py -vType
🐛 Bug Fix
Caveats (if any)
Low
tooluse_), and Bedrock (toolu_vrtx_) ID prefixes; other providers' custom tool-call ID formats aren't rewritten