Skip to content

fix(telegram): truncate streaming overflow instead of splitting (#48648) - #48718

Closed
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-48648
Closed

fix(telegram): truncate streaming overflow instead of splitting (#48648)#48718
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-48648

Conversation

@kyssta-exe

Copy link
Copy Markdown
Contributor

Fixes #48648. During streamed response delivery on Telegram, if the message content grows past the 4096-character limit, the gateway enters an infinite nested reply loop. The overflow split creates continuation messages and the stream consumer uses the new message ID for the next edit, but the content is still over the limit, causing another split indefinitely. Fix: during streaming (finalize=False), truncate content to fit within the limit instead of splitting. The full content is still properly split on finalize (finalize=True).

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter duplicate This issue or pull request already exists labels Jun 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #48663 — both fix #48648 with the same mechanism: at the edit_message pre-flight overflow check, add a if not finalize: branch that truncates the streamed content instead of calling _edit_overflow_split, deferring the real split to finalize=True. #48663 (by @liuhao1024) is the earlier open PR. This PR additionally guards the catch-block overflow path, but the core fix is identical.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Truncates streaming overflow in Telegram instead of splitting the message. 1-file fix. Clean and targeted.


Reviewed by Hermes Agent

@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by #51736 (merged to main in 73a20a6ad), which fixed #48648 by gating the overflow split on finalize. Your fix targeted gateway/platforms/telegram.py, which no longer exists — the Telegram adapter was relocated to plugins/platforms/telegram/adapter.py in a bundled-plugin refactor, so the change landed there instead. The salvaged PR (#50408 by @Tranquil-Flow) hit the current path. Thanks for the fix and the report — credited in the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(telegram): Infinite streamed message duplication loop during 4096-char overflow

4 participants