Summary
In a Feishu/Lark thread (topic) chat, the tail of a long threaded reply leaks out of the thread into the main chat.
Root cause
lark_channel/channel/outbound/sender.py — OutboundSender._send_text splits a message longer than text_chunk_limit into multiple bodies, but applies reply_to only to the first chunk:
# Only apply `reply_to` to the first chunk; subsequent chunks are
# fresh messages so they all render in the original chat.
effective_reply_to = reply_to if idx == 0 else None
For a normal reply, "fresh messages render in the original chat" holds. But in a thread/topic chat, a message sent without a reply parent does not render in the thread — it drops into the main chat. So with reply_in_thread=True, every chunk after the first leaks out of the thread.
Reproduction
- In a topic-mode group, send a markdown message longer than
text_chunk_limit (default 3500) with SendOpts(reply_to=<root_message_id>, reply_in_thread=True).
- Observed: the first chunk is a threaded reply under the root; the remaining chunks appear as top-level messages in the main group.
- Expected: all chunks stay in the thread.
Suggested fix
Keep reply_to on every chunk when threading:
effective_reply_to = reply_to if (idx == 0 or reply_in_thread) else None
Replying each chunk to the same root with reply_in_thread=True keeps all pieces in the thread; non-thread replies keep the current first-chunk-only behavior.
Observed on 1.1.0 and current main (lines ~388–390). A PR with this change is opened separately.
Summary
In a Feishu/Lark thread (topic) chat, the tail of a long threaded reply leaks out of the thread into the main chat.
Root cause
lark_channel/channel/outbound/sender.py—OutboundSender._send_textsplits a message longer thantext_chunk_limitinto multiple bodies, but appliesreply_toonly to the first chunk:For a normal reply, "fresh messages render in the original chat" holds. But in a thread/topic chat, a message sent without a reply parent does not render in the thread — it drops into the main chat. So with
reply_in_thread=True, every chunk after the first leaks out of the thread.Reproduction
text_chunk_limit(default 3500) withSendOpts(reply_to=<root_message_id>, reply_in_thread=True).Suggested fix
Keep
reply_toon every chunk when threading:Replying each chunk to the same root with
reply_in_thread=Truekeeps all pieces in the thread; non-thread replies keep the current first-chunk-only behavior.Observed on
1.1.0and currentmain(lines ~388–390). A PR with this change is opened separately.