From bbd58931fea5b7b896a40417882d8dc5a9c62fb0 Mon Sep 17 00:00:00 2001 From: Mateo Wang <277851410+mateo-berri@users.noreply.github.com> Date: Wed, 14 Oct 2026 20:55:43 -0700 Subject: [PATCH] test(integration): follow #46101 in the breakpoint cache mark census expectation (#46509) * test(integration): follow #44788 and #46101 in the openrouter translation and cache mark census expectations Expect prompt_cache_breakpoint for opted-in OpenAI and omit assistant tool-call marks from the capped census Match OpenRouter refusal, logprobs, and system fingerprint nulls Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): follow #46341 blank env and guardrail param handling in keepalive and scope expectations Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(router): read the first stream chunk through the stream's iterator so MCP streams keep working Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): follow #46493 retry and fallback semantics for streams that fail before content Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): drop the openrouter expectations #46510 already landed on main Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): restore blank lines lost in the main merge Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- ...test_cache_control_tool_call_marks_wire.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/integration/providers/test_cache_control_tool_call_marks_wire.py b/tests/integration/providers/test_cache_control_tool_call_marks_wire.py index 8c698817ccf..47d28860018 100644 --- a/tests/integration/providers/test_cache_control_tool_call_marks_wire.py +++ b/tests/integration/providers/test_cache_control_tool_call_marks_wire.py @@ -467,14 +467,25 @@ def _openai_message_marks(message: dict[str, JsonValue]) -> list[str]: @pytest.mark.parametrize( - "options", + "options, expected_marks", ( - pytest.param({"prompt_cache_options": {"mode": "explicit"}}, id="breakpoint-dialect"), - pytest.param({}, id="plain"), + pytest.param( + {"prompt_cache_options": {"mode": "explicit"}}, + [f"prompt_cache_breakpoint@user:text:{ASK}"], + id="breakpoint-dialect", + ), + pytest.param( + {}, + [ + f"cache_control@user:text:{ASK}", + *(f"cache_control@tool_call:{call_id(city)}" for city in CITIES), + ], + id="plain", + ), ), ) def test_openai_points_skip_injection_when_client_marks_fill_the_cap( - gateway: Gateway, options: dict[str, JsonValue] + gateway: Gateway, options: dict[str, JsonValue], expected_marks: list[str] ) -> None: marker: Final = new_marker() with wire_server(lambda request: Reply(body=_OPENAI_REPLY)) as wire, gateway.scenario() as scenario: @@ -488,7 +499,7 @@ def test_openai_points_skip_injection_when_client_marks_fill_the_cap( status, _, text = post_chat(gateway, chat_body(model, conversation(marker, marked_calls()))) assert status == 200, text marks: Final = _openai_marks(_only_request(wire)) - assert marks == [f"cache_control@user:text:{ASK}", *(f"cache_control@tool_call:{call_id(city)}" for city in CITIES)] + assert marks == expected_marks @pytest.mark.parametrize("stream", (False, True), ids=("json", "stream"))