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
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user