litellm/tests/test_litellm/proxy/guardrails
michelligabriele 283375f4d6
fix(proxy): eliminate race condition in streaming guardrail_information logging (#24592)
asyncio.create_task in CSW.__anext__ scheduled the deferred logging
callback as an independent task that raced with unified_guardrail's
end-of-stream block. For short-stream providers (Vertex AI, Azure,
Anthropic), the logging fired before guardrail_information was written,
causing post_call guardrail entries to be missing from
StandardLoggingPayload.

Move the deferred callback trigger from CSW.__anext__ to
ProxyLogging.async_post_call_streaming_iterator_hook (after the full
streaming pipeline completes). CSW now stores the assembled response
args; the outer consumer fires the callback after all guardrail
end-of-stream blocks finish. Also skip apply_guardrail guardrails in
_run_deferred_stream_guardrails to eliminate duplicate API calls.
2026-04-01 08:06:56 -07:00
..
guardrail_hooks fix(test): add request_data param to test mock + black formatting 2026-03-23 15:43:05 +01:00
test_deferred_guardrail_logging.py fix(proxy): eliminate race condition in streaming guardrail_information logging (#24592) 2026-04-01 08:06:56 -07:00
test_guardrail_endpoints.py Agent Tracing - support context_id based trace id propogation + nested llm calls (#22626) 2026-03-03 18:19:12 -08:00
test_guardrail_registry.py Add Noma guardrails v2 based on custom guardrails (#21400) 2026-02-23 05:05:27 -08:00
test_init_guardrails.py Litellm fix GitHub action testing (#11163) 2025-05-26 14:41:42 -07:00
test_mcp_jwt_signer.py [Staging] - Ishaan March 17th (#23903) 2026-03-18 15:09:01 -07:00
test_pillar_guardrails.py fix: properly reload litellm in setup_and_teardown fixture 2026-02-17 21:29:13 -03:00
test_prompt_security_guardrails.py fixing prompt-security's guardrail implementation (#19374) 2026-01-21 20:09:40 -08:00