Bug Description
Telegram edit-overflow continuations can lose the originating topic/thread routing metadata.
When an edited Telegram message grows past the 4096 UTF-16 code-unit limit, TelegramAdapter.edit_message() falls into _edit_overflow_split(): it edits the original message with chunk 1 and sends the remaining chunks as fresh continuation messages. Those continuation sends currently call bot.send_message() directly with reply_to_message_id, but without the original message_thread_id / metadata routing hints.
In forum/topic chats this can make the continuation bubble appear in the main chat/general lane instead of the topic where the original agent/tool message was being edited.
Steps to Reproduce
- Use Telegram gateway inside a forum topic/thread.
- Produce a streamed/progress/edit-based message that exceeds Telegram's single-message limit.
- Let the adapter split the oversized edit into continuation messages.
Expected Behavior
Continuation messages created by the edit-overflow split stay in the same Telegram topic/thread as the original message.
Actual Behavior
The continuation messages are sent without topic metadata, so Telegram may place them outside the originating topic.
Notes
Related but distinct from #26207 / #26242, which roll over tool-progress bubbles before hitting the message limit. Even with rollover, the adapter-level overflow fallback should be topic-safe for streamed responses and defensive fallback paths.
Live gateway logs showed the adapter overflow path being hit:
Overflow split: first-chunk edit failed: Flood control exceeded ...
Progress edits disabled due to flood control
Environment
- Platform: Telegram gateway
- Component:
gateway/platforms/telegram.py, gateway/run.py, gateway/stream_consumer.py
Bug Description
Telegram edit-overflow continuations can lose the originating topic/thread routing metadata.
When an edited Telegram message grows past the 4096 UTF-16 code-unit limit,
TelegramAdapter.edit_message()falls into_edit_overflow_split(): it edits the original message with chunk 1 and sends the remaining chunks as fresh continuation messages. Those continuation sends currently callbot.send_message()directly withreply_to_message_id, but without the originalmessage_thread_id/ metadata routing hints.In forum/topic chats this can make the continuation bubble appear in the main chat/general lane instead of the topic where the original agent/tool message was being edited.
Steps to Reproduce
Expected Behavior
Continuation messages created by the edit-overflow split stay in the same Telegram topic/thread as the original message.
Actual Behavior
The continuation messages are sent without topic metadata, so Telegram may place them outside the originating topic.
Notes
Related but distinct from #26207 / #26242, which roll over tool-progress bubbles before hitting the message limit. Even with rollover, the adapter-level overflow fallback should be topic-safe for streamed responses and defensive fallback paths.
Live gateway logs showed the adapter overflow path being hit:
Environment
gateway/platforms/telegram.py,gateway/run.py,gateway/stream_consumer.py