From 801614a5c46ec47d1a8b23943ce7df1014cdb502 Mon Sep 17 00:00:00 2001 From: serxa Date: Tue, 7 Jul 2026 20:51:15 +0000 Subject: [PATCH] Stop truncating long Telegram replies in format_response format_response() truncated any text over MAX_MSG_LEN and appended a "... (truncated)" marker. But send() already splits outgoing text into MAX_MSG_LEN-sized chunks delivered as sequential messages, so truncating first permanently dropped the tail of long replies. Return the text unchanged and let send() handle chunking. --- nerve/channels/telegram.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nerve/channels/telegram.py b/nerve/channels/telegram.py index cd4dde3..4463c86 100644 --- a/nerve/channels/telegram.py +++ b/nerve/channels/telegram.py @@ -563,9 +563,13 @@ async def send(self, message: OutboundMessage) -> None: self._cache_message(sent.message_id, chat_id, chunk) def format_response(self, text: str) -> str: - """Truncate for Telegram if needed.""" - if len(text) > MAX_MSG_LEN: - return text[:MAX_MSG_LEN - 20] + "\n\n... (truncated)" + """Return text unchanged. + + Long messages must NOT be truncated here: send() already splits text into + MAX_MSG_LEN-sized chunks and delivers them as sequential messages. Truncating + first (the old behaviour) defeated that chunking and dropped the tail of long + replies with a "... (truncated)" marker. + """ return text # ------------------------------------------------------------------ #