fix(outbound): keep reply_to on every chunk when threading#6
Open
Ydz0616 wants to merge 1 commit into
Open
Conversation
A message longer than text_chunk_limit is split into multiple bodies, but reply_to is applied only to the first chunk (reply_to if idx == 0 else None), so later chunks are sent as fresh create_message calls. For a normal reply that is fine, but in a THREAD/topic chat a message without a reply parent renders in the main chat instead of the thread — so the tail of a long threaded reply leaks out of the topic. Keep reply_to on every chunk when reply_in_thread is set. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
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
In a Lark thread/topic chat, the tail of a long threaded reply leaks out of the thread into the main chat.
OutboundSender._send_textsplits a message overtext_chunk_limitinto multiple bodies but appliesreply_toonly to the first chunk (reply_to if idx == 0 else None). The comment assumes "fresh messages render in the original chat" — true for a normal reply, but in a thread/topic chat a message sent without a reply parent renders in the main chat, not the thread. So chunks after the first leak out of the topic.Fix
Keep
reply_toon every chunk whenreply_in_threadis set:Each chunk replies to the same root with
reply_in_thread=True, so all pieces stay in the thread. Non-thread replies are unchanged (still first-chunk-only quote).Reproduction
Topic-mode group, send a >3500-char markdown message with
SendOpts(reply_to=<root>, reply_in_thread=True):Closes #5.