From 37d7a88301a7616b4392d9ec4b7660454bf45f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Cabrero-Holgueras?= Date: Thu, 16 Apr 2026 12:04:15 +0200 Subject: [PATCH] fix: accept reasoning-only output in responses web_search test openai/gpt-oss-20b with vLLM v0.19.0 may return only reasoning items without a separate message item for web search queries. --- tests/e2e/test_responses.py | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/tests/e2e/test_responses.py b/tests/e2e/test_responses.py index 79679d7c..f21f5c21 100644 --- a/tests/e2e/test_responses.py +++ b/tests/e2e/test_responses.py @@ -699,22 +699,32 @@ def test_web_search(client, model, high_web_search_rate_limit): message_items = [ item for item in response.output if getattr(item, "type", None) == "message" ] - assert len(message_items) > 0, ( - f"Response should contain message items. Found types: {output_types}" + reasoning_items = [ + item for item in response.output if getattr(item, "type", None) == "reasoning" + ] + assert len(message_items) > 0 or len(reasoning_items) > 0, ( + f"Response should contain message or reasoning items. Found types: {output_types}" ) - message = message_items[0] - assert hasattr(message, "content") and len(message.content) > 0, ( - "Message should have content" - ) + content = "" + if message_items: + message = message_items[0] + assert hasattr(message, "content") and len(message.content) > 0, ( + "Message should have content" + ) - text_item = next( - (c for c in message.content if getattr(c, "type", None) == "output_text"), None - ) - assert text_item is not None, "Message content should contain an output_text item" + text_item = next( + (c for c in message.content if getattr(c, "type", None) == "output_text"), + None, + ) + assert text_item is not None, ( + "Message content should contain an output_text item" + ) + content = getattr(text_item, "text", "") - content = getattr(text_item, "text", "") - assert content, "Response should contain content" + assert content or reasoning_items, ( + "Response should contain text content or reasoning" + ) sources = getattr(response, "sources", None) assert sources is not None, "Sources field should not be None"