The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: read model_extra reasoning in the auxiliary stream accumulator
teknium1c9e506f77b1f
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.pyindex 4d2b7d6e836..b08d8ed1428 100644--- a/agent/auxiliary_client.py+++ b/agent/auxiliary_client.py@@ -6965,6 +6965,8 @@ class _ChatStreamAccumulator:self.content_parts.append(piece)made_progress = Truereasoning_piece = getattr(delta, "reasoning", None) or getattr(delta, "reasoning_content", None)+ if reasoning_piece is None and isinstance(getattr(delta, "model_extra", None), dict):+ reasoning_piece = delta.model_extra.get("reasoning") or delta.model_extra.get("reasoning_content")reasoning_piece = flatten_message_text(reasoning_piece, sep="")if reasoning_piece:self.reasoning_parts.append(reasoning_piece)diff --git a/tests/agent/test_aux_progress_streaming.py b/tests/agent/test_aux_progress_streaming.pyindex 9979d0fc3f3..93c58ef22ec 100644--- a/tests/agent/test_aux_progress_streaming.py+++ b/tests/agent/test_aux_progress_streaming.py@@ -149,6 +149,18 @@ class TestCreateWithProgress:# signal — see _create_with_progress) + 1 per substantive chunk.assert ticks == [1, 1, 1, 1]+ def test_reasoning_only_in_model_extra_is_captured_and_counts_as_progress(self):+ # Non-SDK delta objects (proxies, relays) may carry reasoning only in ``model_extra``;+ # the accumulator must read it like the main streaming path does (#56516).+ chunk = _chunk(finish_reason="stop")+ chunk.choices[0].delta.model_extra = {"reasoning_content": "thinking..."}+ client = _FakeClient(stream_chunks=[chunk])+ ticks = []+ with aux_progress_hook(lambda: ticks.append(1)):+ result = _create_with_progress(client, {"model": "m1", "messages": [], "timeout": 30})+ assert result.choices[0].message.reasoning == "thinking..."+ assert ticks == [1, 1] # dispatch tick + the reasoning chunk+def test_completed_response_ticks_only_terminal_signals(self):calls = []