From cee2c79a979941a61225778db9c90a65bac340e9 Mon Sep 17 00:00:00 2001 From: yucheng Date: Mon, 2 Nov 2026 15:05:03 -0800 Subject: [PATCH] fix(proxy): annotate the guardrail headers kept across upstream failure logging --- .../proxy/pass_through_endpoints/pass_through_endpoints.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py index 7b28b25ffc6..451d2ae22af 100644 --- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py @@ -1446,8 +1446,8 @@ async def _log_passthrough_upstream_failure_keeping_guardrail_headers( """Log an upstream error like ``_log_passthrough_upstream_failure`` and return the guardrail response headers, read before the failure hooks rebuild ``kwargs``' metadata without the guardrail fields. A successful response has no failure hooks to read around, so it returns none.""" - guardrail_headers: Final = ( - _guardrail_response_headers(parsed_body, kwargs) if response.status_code >= 400 else MappingProxyType({}) + guardrail_headers: Final[Mapping[str, str]] = ( + _guardrail_response_headers(parsed_body, kwargs) if response.status_code >= 400 else {} ) await _log_passthrough_upstream_failure( response=response,