mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
fix(proxy): clear litellm_call_id_from_client flag when no header supplied
Defensive guard: when the x-litellm-call-id header is absent, explicitly set litellm_call_id_from_client=False on the request data dict. Without this reset, a body-injected `"litellm_call_id_from_client": true` field would survive into kwargs and flip the precedence in get_spend_logs_id, causing the auto-generated UUID to be recorded as request_id instead of the provider response.id and breaking lookups by response ID. Applied to all three handler locations: - common_request_processing.py (OpenAI-compatible /chat/completions, etc.) - google_endpoints/endpoints.py:generateContent - google_endpoints/endpoints.py:streamGenerateContent Addresses Greptile P2 review feedback on PR #25952. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cde463b92d
commit
8d803ec667
2 changed files with 12 additions and 0 deletions
|
|
@ -789,6 +789,10 @@ class ProxyBaseLLMRequestProcessing:
|
|||
self.data["litellm_call_id_from_client"] = True
|
||||
else:
|
||||
self.data["litellm_call_id"] = str(uuid.uuid4())
|
||||
# Defensive: explicitly clear the flag so a body-injected
|
||||
# `litellm_call_id_from_client: true` cannot flip precedence
|
||||
# in get_spend_logs_id when no header was actually supplied.
|
||||
self.data["litellm_call_id_from_client"] = False
|
||||
DDSpanTagger.tag_call_id(self.data.get("litellm_call_id"))
|
||||
DDSpanTagger.tag_request(
|
||||
user_api_key_dict=user_api_key_dict,
|
||||
|
|
|
|||
|
|
@ -64,6 +64,10 @@ async def google_generate_content(
|
|||
data["litellm_call_id_from_client"] = True
|
||||
else:
|
||||
data["litellm_call_id"] = str(uuid.uuid4())
|
||||
# Defensive: explicitly clear the flag so a body-injected
|
||||
# `litellm_call_id_from_client: true` cannot flip precedence
|
||||
# in get_spend_logs_id when no header was actually supplied.
|
||||
data["litellm_call_id_from_client"] = False
|
||||
logging_obj, data = litellm.utils.function_setup(
|
||||
original_function="agenerate_content",
|
||||
rules_obj=litellm.utils.Rules(),
|
||||
|
|
@ -130,6 +134,10 @@ async def google_stream_generate_content(
|
|||
data["litellm_call_id_from_client"] = True
|
||||
else:
|
||||
data["litellm_call_id"] = str(uuid.uuid4())
|
||||
# Defensive: explicitly clear the flag so a body-injected
|
||||
# `litellm_call_id_from_client: true` cannot flip precedence
|
||||
# in get_spend_logs_id when no header was actually supplied.
|
||||
data["litellm_call_id_from_client"] = False
|
||||
logging_obj, data = litellm.utils.function_setup(
|
||||
original_function="agenerate_content_stream",
|
||||
rules_obj=litellm.utils.Rules(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue