From a7c44e9ededd7c445897be4afa48de209bd5c7cd Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Thu, 24 Sep 2026 19:50:47 +0530 Subject: [PATCH] docs(gateway): say the sub-floor segment-break preamble is dropped, not accumulated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The #99026 guard returns True at a tool-boundary finalize, so _end_segment treats the segment as delivered and resets it: a 1-3 char preamble ("Ok") is discarded on non-cumulative transports. Carrying it into the next segment is not done here: the authoritative finish(final_text) adoption replaces the carried buffer wholesale, and coalesced 'Ok'×N crosses the floor and lands as its own message anyway. Record the tradeoff. --- gateway/stream_consumer_transport.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gateway/stream_consumer_transport.py b/gateway/stream_consumer_transport.py index c111d322f5..773099436b 100644 --- a/gateway/stream_consumer_transport.py +++ b/gateway/stream_consumer_transport.py @@ -334,10 +334,13 @@ class StreamTransportMixin: # A segment-break finalize never carries the cursor, so gate it too or a 1-2 token # preamble lands durably at every tool boundary and resets the progress anchor # (#99026). Turn finals are exempt: a short complete answer must be delivered. + # Tradeoff: on non-cumulative transports the held preamble is DROPPED, not + # carried — _end_segment sees update_visible=True and resets the segment. preamble_finalize = finalize and not is_turn_final if (self._message_id is None and len(visible_stripped) < self._MIN_NEW_MSG_CHARS and (preamble_finalize or (self.cfg.cursor and self.cfg.cursor in text))): - return True # too short for a standalone message — accumulate more + # Mid-stream: accumulate more. Segment-break finalize: dropped (see above). + return True # A failed native/draft transport disables itself and falls through so the # accumulated text still reaches the user via edit/send.