docs(gateway): say the sub-floor segment-break preamble is dropped, not accumulated

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.
This commit is contained in:
kshitijk4poor
2026-09-24 19:50:47 +05:30
committed by kshitij
parent 5a7c26d5c1
commit a7c44e9ede

View File

@@ -334,10 +334,13 @@ class StreamTransportMixin:
# A segment-break finalize never carries the cursor, so gate it too or a 1-2 token # 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 # preamble lands durably at every tool boundary and resets the progress anchor
# (#99026). Turn finals are exempt: a short complete answer must be delivered. # (#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 preamble_finalize = finalize and not is_turn_final
if (self._message_id is None and len(visible_stripped) < self._MIN_NEW_MSG_CHARS 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))): 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 # A failed native/draft transport disables itself and falls through so the
# accumulated text still reaches the user via edit/send. # accumulated text still reaches the user via edit/send.