From 7a373a3ae0c6fa0212e4f9141497a1bc9ec3db05 Mon Sep 17 00:00:00 2001 From: Acacian Date: Thu, 17 Sep 2026 10:12:00 +0900 Subject: [PATCH] refactor(streaming): drop explanatory comment from MidStreamFallbackError header copy --- litellm/exceptions.py | 3 --- tests/unit/litellm_core_utils/test_streaming_handler.py | 6 +----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/litellm/exceptions.py b/litellm/exceptions.py index e13aaa6c304..a95aa54e964 100644 --- a/litellm/exceptions.py +++ b/litellm/exceptions.py @@ -1184,9 +1184,6 @@ class MidStreamFallbackError(ServiceUnavailableError): self.message = _saved_message self.args = (_saved_message,) - # Keep the provider headers (retry-after, x-request-id, ...) that exception_type() - # attached to the wrapped exception, so retry backoff, logging and the proxy error - # response still see them once the failure is wrapped for fallback original_headers: Final = getattr(original_exception, "litellm_response_headers", None) if original_headers is not None: self.litellm_response_headers = original_headers diff --git a/tests/unit/litellm_core_utils/test_streaming_handler.py b/tests/unit/litellm_core_utils/test_streaming_handler.py index 62a6fb78e69..5cb00d8ce18 100644 --- a/tests/unit/litellm_core_utils/test_streaming_handler.py +++ b/tests/unit/litellm_core_utils/test_streaming_handler.py @@ -853,11 +853,7 @@ def test_sync_streaming_rate_limit_triggers_midstream_fallback(logging_obj: Logg async def test_streaming_rate_limit_midstream_fallback_keeps_provider_headers( logging_obj: Logging, ): - """MidStreamFallbackError keeps the provider headers the non-streaming RateLimitError carries. - - retry-after and x-request-id are what retry backoff, logging and the proxy error - response read, so wrapping a 429 for fallback must not drop them. - """ + """MidStreamFallbackError keeps the provider headers the non-streaming RateLimitError carries.""" from litellm.exceptions import MidStreamFallbackError from litellm.llms.vertex_ai.common_utils import VertexAIError