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>
This commit is contained in:
Mateo Wang 2026-10-14 20:55:43 -07:00 • committed by GitHub
parent 314f17986a
commit bbd58931fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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"))