From 416dc3ecde339e49565d9d7ca260866178fc6b63 Mon Sep 17 00:00:00 2001 From: hemin-i Date: Wed, 28 Oct 2026 14:15:55 +0900 Subject: [PATCH] fix(gateway): deliver interim commentary when the consumer gets no deltas When the agent streams to an execution observer instead of the adapter, already_streamed is true while the GatewayStreamConsumer never accepted a delta. on_segment_break() only queues a segment marker and carries no text, so the commentary was dropped and the platform never saw it (reproducible with streaming.enabled: false, where stream_deltas_enabled is false). Deduplicate against deltas this consumer actually accepted, and otherwise hand the text to on_commentary(). --- gateway/run_turn_runner.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gateway/run_turn_runner.py b/gateway/run_turn_runner.py index f480d22fb9..54ddc7dd3b 100644 --- a/gateway/run_turn_runner.py +++ b/gateway/run_turn_runner.py @@ -377,7 +377,14 @@ class TurnRunner(GatewayTurnProgressMixin, GatewaySessionAgentMixin): if unseen: return if stream_consumer is not None: - stream_consumer.on_segment_break() if already_streamed else stream_consumer.on_commentary(text) + # The agent's own streaming may be feeding an execution observer rather than this + # adapter, so ``already_streamed`` alone does not mean the consumer saw the deltas. + # Deduplicate only against deltas this consumer actually accepted; otherwise the + # commentary would be dropped (``on_segment_break`` carries no text). + if already_streamed and stream_consumer.stream_deltas_enabled: + stream_consumer.on_segment_break() + else: + stream_consumer.on_commentary(text) elif not already_streamed and ctx._status_adapter and str(text or "").strip(): self._send_status_text(text, ctx._status_thread_metadata, "interim_assistant_callback scheduling error")