Fix/proxy only failure call type#24050
Fix/proxy only failure call type#240503 commits merged intoBerriAI:litellm_oss_staging_03_18_2026from
Conversation
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Alexey seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Greptile SummaryThis PR fixes a logging inconsistency in Key changes:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/utils.py | Adds normalized_call_type variable to consolidate the call-type update into both litellm_logging_obj.call_type and litellm_logging_obj.model_call_details["call_type"], fixing the divergence that caused stale route-based call types in the standard logging payload. |
| tests/proxy_unit_tests/test_proxy_utils.py | Adds a parametrized regression test for all three call types (acompletion, atext_completion, aembedding) that asserts both logging_obj.call_type and logging_obj.model_call_details["call_type"] are normalized correctly; uses mocks to avoid real network calls. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[_handle_logging_proxy_only_error called] --> B{litellm_logging_obj is None?}
B -- Yes --> C[Create new logging obj via function_setup]
B -- No --> D[Use existing logging obj]
C --> D
D --> E{Request body shape?}
E -- messages list --> F[input = messages\nnormalized_call_type = acompletion]
E -- prompt str --> G[input = prompt\nnormalized_call_type = atext_completion]
E -- input list --> H[input = input\nnormalized_call_type = aembedding]
E -- none match --> I[normalized_call_type = None]
F --> J{normalized_call_type != None?}
G --> J
H --> J
I --> J
J -- Yes --> K["litellm_logging_obj.call_type = normalized_call_type\nlitellm_logging_obj.model_call_details['call_type'] = normalized_call_type\n✅ Both fields in sync"]
J -- No --> L[Fields unchanged]
K --> M{call_type == pass_through?}
L --> M
M -- Yes --> N[return early — logged via callback loop]
M -- No --> O[pre_call → async_failure_handler → failure_handler]
Last reviewed commit: "Merge branch 'litell..."
379ed72
into
BerriAI:litellm_oss_staging_03_18_2026
Relevant issues
Fixes #24049
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/proxy_unit_tests/test_proxy_utils.pymake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
CI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🐛 Bug Fix
✅ Test
Changes
This PR fixes a proxy logging bug where proxy-only failures can emit a stale route-based
call_typesuch as:"/v1/completions""/completions""IGNORE_THIS"instead of the normalized LiteLLM call type:
acompletionatext_completionaembeddingRoot cause
ProxyLogging._handle_logging_proxy_only_error()infers the normalized call type from the request body shape:messages->acompletionprompt->atext_completioninput->aembeddingHowever, before this PR it only updated
logging_obj.call_type.standard logging payloadis later built fromlogging_obj.model_call_details, wherecall_typecould still contain the original route-based value. This creates a divergence between:logging_obj.call_typelogging_obj.model_call_details["call_type"]As a result, downstream logging callbacks / integrations can receive the wrong
call_typefor proxy-only failures.Fix
When
_handle_logging_proxy_only_error()determines a normalized call type, it now updates both:litellm_logging_obj.call_typelitellm_logging_obj.model_call_details["call_type"]This keeps the logging object and the payload source-of-truth in sync.
Test coverage
Added a focused regression test in
tests/proxy_unit_tests/test_proxy_utils.pycovering:acompletionatext_completionaembeddingThe test asserts that both:
logging_obj.call_typelogging_obj.model_call_details["call_type"]match the normalized value.
Validation performed
Targeted regression tests passed with:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONPATH=. poetry run pytest -q -p pytest_asyncio.plugin tests/proxy_unit_tests/test_proxy_utils.py -k 'post_call_failure_hook_auth_error_llm_api_route or handle_logging_proxy_only_error_syncs_normalized_call_type'Result:
Scope
This PR is intentionally narrow. It does not change how proxy-only failures are classified. It only ensures that once a normalized
call_typeis inferred, that value is propagated tomodel_call_details, which is the source used to build the standard logging payload.