fix(a2a): replace bare assert with descriptive RuntimeError on retry exhaustion

If both retry attempts in asend_message absorb A2ALocalhostURLError silently,
the bare assert would fire as AssertionError with no context. Replace with a
RuntimeError that includes the request_id for easier debugging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Julio Quinteros 2026-03-05 06:38:54 -03:00
parent 9a13c76e2f
commit 0d689e9711

View file

@ -314,8 +314,11 @@ async def asend_message(
verbose_logger.info(f"A2A send_message completed, request_id={request.id}")
# a2a_response is guaranteed to be set if we reach here (loop breaks on success or raises)
assert a2a_response is not None
if a2a_response is None:
raise RuntimeError(
"A2A send_message failed: no response received after retry attempts. "
f"request_id={request.id}"
)
# Wrap in LiteLLM response type for _hidden_params support
response = LiteLLMSendMessageResponse.from_a2a_response(a2a_response)