From fa0c1a8fb38e2abdc7bda0dc0e7b2d936e64ff2c Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 22 Sep 2026 21:00:57 +0000 Subject: [PATCH] test(integration): prepend azure content-filter metadata chunk to the messages stream (Pylon #6992) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- tests/integration/streaming/test_stream_contracts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/streaming/test_stream_contracts.py b/tests/integration/streaming/test_stream_contracts.py index 29719a5820e..eb1161e4aec 100644 --- a/tests/integration/streaming/test_stream_contracts.py +++ b/tests/integration/streaming/test_stream_contracts.py @@ -109,7 +109,9 @@ def test_proxy_stream_usage_visibility_keeps_exact_persisted_charge(gateway: Gat @pytest.mark.covers("other.streaming.messages_bridge.empty_choices_usage_chunk_completes_stream") def test_messages_stream_completes_through_trailing_empty_choices_usage_chunk(gateway: Gateway) -> None: identity: Final = "messages-empty-choices-" + uuid.uuid4().hex - with wire_server(lambda request: Reply(content_type="text/event-stream", chunks=text_stream(identity))) as wire, gateway.scenario() as scenario: + metadata: Final = b"data: " + json.dumps({"id": identity, "object": "chat.completion.chunk", "created": 1, "model": "gpt-4o-mini", "choices": [], "prompt_filter_results": [{"prompt_index": 0, "content_filter_results": {}}]}, ensure_ascii=False).encode() + b"\n\n" + frames: Final = (metadata, *text_stream(identity)) + with wire_server(lambda request: Reply(content_type="text/event-stream", chunks=frames)) as wire, gateway.scenario() as scenario: model: Final = scenario.model(model="azure/gpt-4o-mini", api_base=wire.url + "/v1") with gateway.client.stream( "POST",