From 22952e4debfaae74127be497f0dd18ed935829df Mon Sep 17 00:00:00 2001 From: aiedwardyi <41576951+aiedwardyi@users.noreply.github.com> Date: Wed, 26 Aug 2026 15:48:06 +0900 Subject: [PATCH] fix: close final A2A review gaps --- .../litellm_completion_bridge/handler.py | 1 + .../proxy/agent_endpoints/a2a_endpoints.py | 10 ++++++++++ .../test_completion_bridge_streaming.py | 20 +++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/litellm/a2a_protocol/litellm_completion_bridge/handler.py b/litellm/a2a_protocol/litellm_completion_bridge/handler.py index 3cd2e9329dc..58e4366ad80 100644 --- a/litellm/a2a_protocol/litellm_completion_bridge/handler.py +++ b/litellm/a2a_protocol/litellm_completion_bridge/handler.py @@ -37,6 +37,7 @@ _AGENT_ONLY_PARAMS: Final = frozenset( "agent_id", "agent_card_params", A2A_USER_API_KEY_HASH_PARAM, + "databricks_oauth", } ) diff --git a/litellm/proxy/agent_endpoints/a2a_endpoints.py b/litellm/proxy/agent_endpoints/a2a_endpoints.py index c2b3750bada..e113be3ce7f 100644 --- a/litellm/proxy/agent_endpoints/a2a_endpoints.py +++ b/litellm/proxy/agent_endpoints/a2a_endpoints.py @@ -858,6 +858,16 @@ async def invoke_agent_a2a( response=response, ) post_call_succeeded = True + except HTTPException as e: + try: + await proxy_logging_obj.post_call_failure_hook( + user_api_key_dict=user_api_key_dict, + original_exception=e, + request_data=data, + ) + except Exception: + pass + raise finally: _enqueue_fn: Final = getattr(logging_obj, "_enqueue_deferred_logging", None) if _enqueue_fn is not None: diff --git a/tests/test_litellm/a2a_protocol/test_completion_bridge_streaming.py b/tests/test_litellm/a2a_protocol/test_completion_bridge_streaming.py index 7fe0a6ced75..0495c0e4913 100644 --- a/tests/test_litellm/a2a_protocol/test_completion_bridge_streaming.py +++ b/tests/test_litellm/a2a_protocol/test_completion_bridge_streaming.py @@ -275,6 +275,26 @@ def test_build_completion_params_keeps_bridge_routing_fields(): assert params["stream"] is True +def test_build_completion_params_drops_proxy_only_databricks_oauth(): + from litellm.a2a_protocol.litellm_completion_bridge.handler import ( + A2ACompletionBridgeHandler, + ) + + params = A2ACompletionBridgeHandler._build_completion_params( + params={"message": {"role": "user", "parts": []}}, + litellm_params={ + "custom_llm_provider": "databricks", + "model": "agent", + "databricks_oauth": {"client_id": "id"}, + }, + api_base="https://configured.example", + agent_extra_headers=None, + stream=False, + ) + + assert "databricks_oauth" not in params + + @pytest.mark.asyncio async def test_handle_streaming_accumulates_logprobs_and_provider_metadata(): from litellm.a2a_protocol.litellm_completion_bridge.handler import (