style(guardrails): drop narrative comments from the deferred logging path

This commit is contained in:
mateo-berri 2026-08-28 16:45:45 -07:00
parent 1a5a856e3e
commit 307b471902
3 changed files with 0 additions and 17 deletions

View file

@ -367,12 +367,6 @@ class BaseAnthropicMessagesStreamingIterator:
deferred_dispatch_armed: Final = (
getattr(self.litellm_logging_obj, "_on_deferred_stream_complete", None) is not None
)
# Post-call guardrails run their end-of-stream scan AFTER this iterator
# is exhausted, so enqueueing now would build the spend log before the
# scan writes guardrail_information. Park the coroutine instead; the
# proxy fires it via _fire_deferred_stream_logging once the guardrail
# chain drains. Teardown (client disconnect) keeps enqueueing
# immediately: the scan never runs there and billing must not be lost.
if deferred_dispatch_armed and not stream_teardown:
self.litellm_logging_obj._deferred_stream_complete_args = (logging_coroutine,)
return

View file

@ -2377,11 +2377,6 @@ class ProxyBaseLLMRequestProcessing:
and route_type == "anthropic_messages"
and self._is_streaming_response(response)
):
# Native /v1/messages SSE streams bypass CSW, so the raw
# iterator parks its logging coroutine at stream end (see
# BaseAnthropicMessagesStreamingIterator._handle_streaming_logging)
# and _fire_deferred_stream_logging hands it here after the
# guardrail end-of-stream scans complete.
from litellm.litellm_core_utils.logging_worker import (
GLOBAL_LOGGING_WORKER,
)

View file

@ -3227,12 +3227,6 @@ class ProxyLogging:
),
)
# Actually iterate through the chained async generator and yield chunks.
# A guardrail block raised after upstream exhaustion (e.g.
# unified_guardrail re-raising HTTPException) must still flush any
# parked deferred logging, or the blocked stream loses its spend log.
# GeneratorExit/CancelledError stay untouched: disconnect cleanup owns
# those.
try:
async for chunk in current_response:
yield chunk