From 2b4ca80f5fb0e6e7c6f64a37491c69b2a48e9223 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Wed, 16 Sep 2026 13:14:09 -0700 Subject: [PATCH] test: trim Responses blank-carrier coverage to two invariants Keep the fixture-driven test on the real failing turn shape from #103483 (no invented carrier, every reasoning item followed by its function_call, call/output pairs intact) and the control that a lone reasoning item still gets a non-empty follower. Drop the synthetic parametrized round: the fixture already covers that shape once per tool round, and the repo caps a fix at two invariant tests. Part of #103483 --- .../agent/test_responses_empty_tool_replay.py | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/tests/agent/test_responses_empty_tool_replay.py b/tests/agent/test_responses_empty_tool_replay.py index caad38b906..c0482bce89 100644 --- a/tests/agent/test_responses_empty_tool_replay.py +++ b/tests/agent/test_responses_empty_tool_replay.py @@ -1,31 +1,18 @@ """Responses replay must not invent a blank assistant turn before a tool call. -Regression investigation for #103483: synthetic Muse tool-loop A/B reproduction. -Also covers #75202: the lone-reasoning follower must be non-empty for strict -Responses-compatible providers that reject "" with 400. +Regression tests for #103483 (Muse Spark degenerate finals on the Responses +wire) and #75202 (strict Responses-compatible providers reject an empty +``content`` string with 400). """ import json from pathlib import Path -import pytest from agent.codex_responses_adapter import _chat_messages_to_responses_input -@pytest.mark.parametrize('content', ['', None]) -def test_reasoning_tool_round_has_no_invented_assistant_message(content): - messages = [{ - 'role': 'assistant', 'content': content, - 'codex_reasoning_items': [{'type': 'reasoning', 'id': 'rs_test', - 'encrypted_content': 'synthetic-encrypted-fixture', 'summary': []}], - 'tool_calls': [{'id': 'call_test', 'type': 'function', - 'function': {'name': 'record_step', 'arguments': '{"step":1}'}}], - }, {'role': 'tool', 'tool_call_id': 'call_test', 'content': '{"ok":true}'}] - items = _chat_messages_to_responses_input(messages) - assert [item.get('type', item.get('role')) for item in items] == [ - 'reasoning', 'function_call', 'function_call_output'] - assert items[1]['call_id'] == items[2]['call_id'] - def test_reasoning_without_tool_keeps_nonempty_following_item(): + """Control: a lone reasoning item still needs a follower (else + ``missing_following_item``), and it must be non-empty for strict providers.""" items = _chat_messages_to_responses_input([{ 'role': 'assistant', 'content': '', 'codex_reasoning_items': [{'type': 'reasoning', 'id': 'rs_test',