From b6505f0232de4a53eb0d67744c5d6d66a7d67a3c Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sat, 15 Aug 2026 01:48:33 +1000 Subject: [PATCH] docs(telegram): note the live-edit timestamp trade-off on liveReply The finished reply is delivered by editing the message created at the first streamed frame, and editMessageText does not change a message's date, so a long tool-using turn's answer keeps its turn-start timestamp and can sort before conversation that produced it. Delete-and-resend would fix the ordering but reintroduce the flicker/reorder streaming exists to avoid, so this documents the accepted trade-off rather than changing behavior. --- internal/channels/telegram/live.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/channels/telegram/live.go b/internal/channels/telegram/live.go index 52425801f..703bc8071 100644 --- a/internal/channels/telegram/live.go +++ b/internal/channels/telegram/live.go @@ -59,6 +59,15 @@ const ( // finalize writes when the turn completes -- if every live update failed, // the user simply sees the finished message appear the way it did before // streaming existed. +// +// A known, accepted trade-off of editing rather than sending: Telegram does +// not change a message's date on edit, so the finished reply carries the +// timestamp of the first streamed frame, not of finalize. A turn with a long +// tool phase can therefore produce an answer timestamped before a user +// message sent later, during that phase, and sort before the conversation +// that produced it. Delete-and-resend on finalize would fix the ordering but +// reintroduce the flicker/reorder streaming was built to avoid, so this is +// left as-is rather than "fixed." type liveReply struct { g *Gateway b *bot.Bot