test(responses bridge): restore a test the conflict resolution had emptied

`check_test_quality.py` flagged TQ001 on this file. The cause was this branch,
not the new tests: resolving the rebase conflict by unioning both sides had
truncated `test_convert_chat_completion_messages_to_responses_api_keeps_prompt_cache_breakpoint_on_unknown_block`
to its docstring, and appended the body of the new
`test_convert_response_output_keeps_every_reasoning_item_before_a_message` to
the end of an unrelated test further down the file. The new tests were intact;
the damage was to an existing one.

The file is rebuilt from `upstream/main` with only the three added tests
appended, so the diff is now exactly the intended additions and nothing else.
This commit is contained in:
JingHao-Leon 2026-10-11 09:00:48 +08:00
parent 35718878e4
commit 0c97c0cee1

View file

@ -5043,14 +5043,6 @@ def test_transform_request_keeps_the_preceding_part_breakpoint_over_the_dropped_
def test_convert_chat_completion_messages_to_responses_api_keeps_prompt_cache_breakpoint_on_unknown_block():
"""The hook marks the last block of its target message, so a message ending in a block the bridge
cannot map reaches the stringify path and has to keep the marker there."""
def test_convert_response_output_keeps_every_reasoning_item_before_a_message():
"""Regression for issue #43620 (stream=False): the Responses API can emit several
reasoning items before the assistant message, and the bridge used to overwrite
its pending reasoning item per item, so only the last one reached
message.reasoning_items. Every item must survive the flush."""
from openai.types.responses import ResponseOutputMessage, ResponseOutputText, ResponseReasoningItem
from litellm.completion_extras.litellm_responses_transformation.transformation import (
LiteLLMResponsesTransformationHandler,
)
@ -5149,6 +5141,16 @@ def test_transform_request_drop_params_in_litellm_params_gates_the_prompt_cache_
assert "prompt_cache_breakpoint" not in result["input"][0]["content"][0]
def test_convert_response_output_keeps_every_reasoning_item_before_a_message():
"""Regression for issue #43620 (stream=False): the Responses API can emit several
reasoning items before the assistant message, and the bridge used to overwrite
its pending reasoning item per item, so only the last one reached
message.reasoning_items. Every item must survive the flush."""
from openai.types.responses import ResponseOutputMessage, ResponseOutputText, ResponseReasoningItem
from litellm.completion_extras.litellm_responses_transformation.transformation import (
LiteLLMResponsesTransformationHandler,
)
rs_1 = ResponseReasoningItem(type="reasoning", id="rs_1", summary=[], encrypted_content="enc1")
rs_2 = ResponseReasoningItem(type="reasoning", id="rs_2", summary=[], encrypted_content="enc2")
message = ResponseOutputMessage(