From 0c97c0cee1a0fbb803e5a90cef8c105bc25bf3ad Mon Sep 17 00:00:00 2001 From: JingHao-Leon <102573344+JingHao-Leon@users.noreply.github.com> Date: Sun, 11 Oct 2026 09:00:48 +0800 Subject: [PATCH] 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. --- ..._responses_transformation_transformation.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/unit/completion_extras/litellm_responses_transformation/test_completion_extras_litellm_responses_transformation_transformation.py b/tests/unit/completion_extras/litellm_responses_transformation/test_completion_extras_litellm_responses_transformation_transformation.py index f82caac97c7..256adb4f4bb 100644 --- a/tests/unit/completion_extras/litellm_responses_transformation/test_completion_extras_litellm_responses_transformation_transformation.py +++ b/tests/unit/completion_extras/litellm_responses_transformation/test_completion_extras_litellm_responses_transformation_transformation.py @@ -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(