You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(telegram): fenced replies become attachment references without uploading a file #3746
Reproduced on unmodified official dev at 77d98132b55594cd47dcb31334104581ac54f0fa, Python 3.12, using the real shared router and Telegram adapter with httpx.MockTransport at the Telegram HTTP boundary (no live bot).
Return a fenced txt response containing "long reply\n" * 600 through ChannelMessageRouter._finalize_response with a TelegramAdapter.
Record Telegram API calls.
The only outgoing message is (see attached: response_1.txt). There is no sendDocument call, and none of the 6,000 characters of reply content reaches the recipient.
Expected: the complete response in ordered Telegram messages, keeping code formatting where possible, or a successfully uploaded attachment before any reference to it.
Cause
The shared router unconditionally calls _extract_outbound_files, which replaces recognized fenced blocks of at least 100 characters with attachment references. TelegramAdapter.send_response only reads response.text and ignores response.files. This affects blocks much shorter than Telegram's message-length limit too.
Related long-reply checks also expose HTML entities being split across chunks, astral Unicode not being counted conservatively, and later chunks being sent after an earlier chunk failed. Existing Markdown work #2277/#2295 closes/reopens tags but does not prevent entity cuts or the router's file substitution.
Acceptance
Telegram replies remain inline and split into ordered, bounded messages with practical code formatting.
Explicit file payloads are confirmed uploaded before their references are sent, with content-preserving split-text fallback on failure.
Retries target the current chunk; confirmed chunks are not replayed, and later chunks are not sent after an unconfirmed failure.
Regression coverage includes lengths around the limit, Markdown/code, Unicode, upload failure, duplicate filenames, ordering, and retries.
Activity
fix(telegram): preserve long replies and bound chunk retries (#3747)
merge: origin/dev into feature/ent700-proactive-voice (ent#700)