fix(gateway/stream): no uneditable preview after a failed first send

When the stream consumer's first send failed (e.g. a Telegram timeout that
never reached the platform), _first_send disabled edits but left the
message id unset, so the next tick sent another first send: a partial
preview that could never be edited. The final reply then went out as a new
message and the truncated preview stayed on screen next to it (on every
first-send timeout, not only under load). With edits disabled, skip
non-final first sends; the final is delivered once, complete.

Found by the C12 exactly-once suite (fault_matrix[stream_timeout_first_send-
fk_tg|fk_dc]).
This commit is contained in:
teknium1
2026-09-23 06:37:38 -07:00
committed by Teknium
parent 4f24811617
commit 80aec2223e

View File

@@ -349,6 +349,10 @@ class StreamTransportMixin:
self._last_edit_overflowed = False
try:
if self._message_id is None:
if not self._edit_supported and not finalize:
# A failed send disabled edits: a preview sent now could never be updated and
# would stay on screen truncated next to the final reply. Send only the final.
return False
return await self._first_send(text, finalize=finalize)
if not self._edit_supported:
return False # edits unsupported; fallback path sends the final