The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor: fold simplify-code review findings into #96667 salvage
kshitijk4poor7eee066c30ed
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.pyindex 3f8d71480a7..65a709cb42b 100644--- a/agent/auxiliary_client.py+++ b/agent/auxiliary_client.py@@ -508,7 +508,7 @@ def _anthropic_event_has_content(event: Any) -> bool:delta = _event_field(event, "delta")return any(bool(_event_field(delta, field))- for field in ("text", "thinking", "partial_json")+ for field in ("text", "thinking", "partial_json", "signature", "citation"))if event_type == "content_block_start":block = _event_field(event, "content_block")@@ -2329,10 +2329,12 @@ class _AnthropicCompletionsAdapter:response = create_anthropic_message(self._client,anthropic_kwargs,- # Tick the aux forward-progress hook per streamed event so hosts- # watching liveness (gateway session hygiene) don't kill a- # slow-but-generating summary model. No-op when no hook is- # installed (None keeps the fast get_final_message path).+ # Per streamed event: record provider-response timing always, but+ # tick the forward-progress hook (hosts watching liveness —+ # gateway session hygiene / the compression commit fence) only+ # for substantive payloads, so keepalive pings cannot hold a+ # stalled summary open. No-op when no hook is installed (None+ # keeps the fast get_final_message path).on_stream_event=((lambda event: (diff --git a/tests/agent/test_aux_progress_streaming.py b/tests/agent/test_aux_progress_streaming.pyindex 6e5e3f55247..5f43768ffe3 100644--- a/tests/agent/test_aux_progress_streaming.py+++ b/tests/agent/test_aux_progress_streaming.py@@ -147,7 +147,7 @@ class TestCreateWithProgress:# signal — see _create_with_progress) + 1 per substantive chunk.assert ticks == [1, 1, 1, 1]- def test_completed_response_without_stream_payload_does_not_tick(self):+ def test_completed_response_ticks_only_terminal_signals(self):calls = []def _create(**kwargs):@@ -285,6 +285,11 @@ class TestContentBearingProgress:(SimpleNamespace(type="thinking_delta", text=None, thinking="thought"), True),(SimpleNamespace(type="input_json_delta", partial_json=""), False),(SimpleNamespace(type="input_json_delta", partial_json='{"x"'), True),+ # Signed-thinking / citation payloads the transport emits+ # (relay_llm.py signature_delta + citations_delta).+ (SimpleNamespace(type="signature_delta", signature="sig-1"), True),+ (SimpleNamespace(type="signature_delta", signature=""), False),+ (SimpleNamespace(type="citations_delta", citation={"cited": 1}), True),],)def test_anthropic_requires_nonempty_delta_payload(self, delta, expected):