[Bugfix] GPT-OSS Autodrop reasoning in Response API and cleanup (#45048)

Signed-off-by: Yifan Zong <yzong@redhat.com>
Co-authored-by: Ben Browning <bbrownin@redhat.com>
This commit is contained in:
yzong-rh
2026-06-23 09:36:33 -04:00
committed by GitHub
co-authored by Ben Browning
parent 9f5117820f
commit f59db63732
5 changed files with 137 additions and 46 deletions
@@ -1429,15 +1429,23 @@ class TestServingChatWithHarmony:
input_messages_2, _ = serving_chat.online_renderer._make_request_with_harmony(
req_2
)
expected_input_messages_2 = [
{"role": "system"},
{"role": "user"},
]
if include_reasoning:
expected_input_messages_2.append(
{
"role": "assistant",
"channel": "analysis",
}
)
expected_input_messages_2.append(
{"role": "assistant", "channel": "final", "content": final_str}
)
verify_harmony_messages(
input_messages_2,
[
{"role": "system"},
{"role": "user"},
# The analysis message should be dropped on subsequent inputs because
# of the subsequent assistant message to the final channel.
{"role": "assistant", "channel": "final", "content": final_str},
],
expected_input_messages_2,
)
@pytest.mark.asyncio
@@ -1635,7 +1643,6 @@ class TestServingChatWithHarmony:
{
"role": "assistant",
"channel": "analysis",
"content": reasoning_str,
},
{
"role": "assistant",
@@ -1684,6 +1691,11 @@ class TestServingChatWithHarmony:
{"role": "system"},
{"role": "developer"},
{"role": "user"},
{
"role": "assistant",
"channel": "analysis",
"content": reasoning_str,
},
{
"role": "assistant",
"channel": "commentary",
@@ -1749,6 +1761,10 @@ class TestServingChatWithHarmony:
{"role": "system"},
{"role": "developer"},
{"role": "user"},
{
"role": "assistant",
"channel": "analysis",
},
{"role": "assistant"},
{"role": "tool"},
{
@@ -1798,8 +1814,10 @@ class TestServingChatWithHarmony:
[
{"role": "system"},
{"role": "user", "content": messages[0]["content"]},
# The reasoning that would have resulted in an analysis message is
# dropped because of a later assistant message to the final channel.
{
"role": "assistant",
"channel": "analysis",
},
{
"role": "assistant",
"channel": "final",