fix(discord): split-and-deliver oversized edits instead of silent truncation - #23703
Closed
AhmetArif0 wants to merge 1 commit into
Closed
fix(discord): split-and-deliver oversized edits instead of silent truncation#23703AhmetArif0 wants to merge 1 commit into
AhmetArif0 wants to merge 1 commit into
Conversation
…ncation Discord's edit_message silently truncated messages exceeding 2000 chars with "..." and returned success=True, causing stream_consumer to believe the full content had been delivered. Replace the truncation with _edit_overflow_split(): edits the original message with the first chunk, then sends remaining chunks as threaded replies so the user sees a contiguous block. Returns continuation_message_ids so stream_consumer can keep editing the most recent visible message — the same contract Telegram's overflow split established in the base SendResult.
19 tasks
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DiscordAdapter.edit_messagesilently truncated messages that exceededthe 2000-character limit:
stream_consumerreceivedsuccess=Trueand assumed the full contentwas on screen. Any streaming response that grew past 2000 chars had its
tail permanently dropped with no error surfaced to the user or the
gateway.
Fix
Replace the truncation with
_edit_overflow_split(), mirroring thesame contract Telegram's overflow split established in PR #23576:
in-thread and doesn't flash as "deleted + new").
chunk, so the user sees a contiguous threaded block.
SendResult(success=True, message_id=<last-chunk-id>, continuation_message_ids=(...)).stream_consumeralready handlescontinuation_message_ids(line 1172) — it updates
_message_idto the last continuation sosubsequent edits target the most recent visible message.
Behavior
"..."❌success=Falsesuccess=False✅Checklist
List,Anyalready imported fromtyping)truncate_messageinherited fromBasePlatformAdapter(same assend_messageuses)to_reference(fail_if_not_exists=False)— same pattern assend_message's reply threadingstream_consumeralready consumescontinuation_message_ids— no consumer changes needed