From 967c4f336743c6e641e599774e08f4e5ab05621e Mon Sep 17 00:00:00 2001 From: yucheng Date: Wed, 28 Oct 2026 11:10:58 -0700 Subject: [PATCH] test(guardrails): pin the deferred-log flag through rate-limit fallback and an A2A step that allows --- .../observability/test_guardrail_pipeline_applied_header.py | 1 + tests/unit/proxy/test_common_request_processing.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/tests/integration/observability/test_guardrail_pipeline_applied_header.py b/tests/integration/observability/test_guardrail_pipeline_applied_header.py index 6e408d24e9a..55f6f0764c3 100644 --- a/tests/integration/observability/test_guardrail_pipeline_applied_header.py +++ b/tests/integration/observability/test_guardrail_pipeline_applied_header.py @@ -756,6 +756,7 @@ def agent(rig: _Rig) -> Iterator[str]: pytest.param( _RESPONSE_MOVES_PAST_FIRST, [_RESPONSE_BLOCKER, _RESPONSE_SECOND], id="first-step-flags-and-moves-on" ), + pytest.param(_RESPONSE_STOPS_AFTER_FIRST, [_RESPONSE_FIRST], id="first-step-allows"), ], ) def test_an_agent_message_names_every_response_step_that_ran_in_the_spend_log_and_the_trace( diff --git a/tests/unit/proxy/test_common_request_processing.py b/tests/unit/proxy/test_common_request_processing.py index 7a2fe623032..7d091327613 100644 --- a/tests/unit/proxy/test_common_request_processing.py +++ b/tests/unit/proxy/test_common_request_processing.py @@ -7542,10 +7542,12 @@ class TestPreCallWithFallbacksOnLocalRateLimit: processor = ProxyBaseLLMRequestProcessing(data={"model": primary_model}) call_count = 0 + deferred_per_call = [] async def mock_pre_call_logic(**kwargs): nonlocal call_count call_count += 1 + deferred_per_call.append(kwargs["defer_async_logging"]) model_in_data = processor.data.get("model") if model_in_data == primary_model: raise ProxyRateLimitError( @@ -7578,10 +7580,12 @@ class TestPreCallWithFallbacksOnLocalRateLimit: model=primary_model, route_type="acompletion", llm_router=mock_router, + defer_async_logging=True, ) assert processor.data["model"] == fallback_model assert call_count == 2 + assert deferred_per_call == [True, True] @pytest.mark.asyncio async def test_raises_when_no_fallbacks_configured(self):