fix(proxy): add None guard to guardrail branch of streaming iterator hook

Apply the same None guard to the apply_guardrail branch for consistency,
as flagged in PR review. All three callback dispatch branches now guard
against None returns to prevent streaming chain breakage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
tombii 2026-03-03 22:24:16 +01:00
parent 7ea99461dd
commit ba8459fda0

View file

@ -2122,13 +2122,15 @@ class ProxyLogging:
current_response = _new_response
elif "apply_guardrail" in type(_callback).__dict__:
request_data["guardrail_to_apply"] = callback
current_response = (
_new_response = (
unified_guardrail.async_post_call_streaming_iterator_hook(
user_api_key_dict=user_api_key_dict,
request_data=request_data,
response=current_response,
)
)
if _new_response is not None:
current_response = _new_response
else:
_new_response = (
_callback.async_post_call_streaming_iterator_hook(