Fix: The Langfuse failure logging path was passing self.model_call_details
(which includes original_response, potentially a coroutine) instead of the
clean local kwargs copy. This aligns the failure path with the success path
behavior (litellm_logging.py:2956).
Reverted the session_id-as-trace_id approach as it causes trace collisions
in Langfuse (multiple calls in the same session would overwrite each other).
Instead, session_id is correctly used only for Langfuse session grouping via
trace_params["session_id"], while each call retains its own unique trace_id.
Added 4 tests:
- session_id correctly passed as trace session_id (not trace_id)
- session_id preserved for ERROR level (failure) logs
- explicit trace_id takes priority over session_id
- failure path kwargs excludes original_response
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This fix addresses Bug 1 where failed LiteLLM logs were using request_id instead of session_id for Langfuse trace mapping, breaking trace correlation.
Changes:
1. Fix kwargs inconsistency in failure path (litellm_logging.py:2956)
- Changed from passing self.model_call_details to passing local kwargs variable
- Matches success path behavior and excludes original_response (potentially a coroutine)
2. Prioritize session_id as trace_id fallback (langfuse.py:607-615)
- When no explicit trace_id is provided, now uses session_id from metadata
- This ensures traces with the same session_id are grouped together in Langfuse
- Maintains backward compatibility: only activates when session_id is set
Testing:
- All 28 existing Langfuse tests pass (excluding pre-existing test_langfuse_e2e_sync which fails due to missing API key)
- Specifically verified trace_id resolution tests still pass
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
* fix(ui/): add mcp input as an example for custom code guardrails
* feat(a2a/): ensure a2a guardrails works on response output
* feat(a2a/): support streaming guardrails
* fix(ui/): add mcp input as an example for custom code guardrails
The __init__ method was trying to access self.__annotations__ before
super().__init__() was called, resulting in an empty annotations dict.
Changed to use the class annotations directly: LiteLLM_JWTAuth.__annotations__
instead of self.__annotations__.
This fixes the ValueError:
"Invalid arguments provided: user_email_jwt_field, user_id_upsert,
user_allowed_email_domain. Allowed arguments are: ."
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>