fix(feishu): reply inside thread for P2P direct messages#64
Open
BingqingLyu wants to merge 1 commit intomainfrom
Open
fix(feishu): reply inside thread for P2P direct messages#64BingqingLyu wants to merge 1 commit intomainfrom
BingqingLyu wants to merge 1 commit intomainfrom
Conversation
When a user sends a message inside a Feishu thread (话题) in a P2P chat, the bot's reply was incorrectly sent outside the thread as a standalone message. This was caused by PR openclaw#33789 which fixed group reply targeting (openclaw#32980) but inadvertently broke P2P thread replies by gating all thread-aware logic behind isGroup checks. The fix distinguishes between two P2P scenarios based on the Feishu API contract (thread_id present = thread message, root_id only = quote reply): - P2P thread messages (thread_id present): reply to root_id with reply_in_thread=true so the response stays in the thread. - P2P plain replies (root_id only, no thread_id): reply to the triggering message as before. Group chat behavior is completely unchanged — the new condition (directThreadMessage) requires isDirect=true, which is always false for groups. Changes: - replyInThread: true for P2P thread messages (enables reply_in_thread API flag) - replyTargetMessageId: use root_id for P2P thread messages - threadReply: true for P2P thread messages (drives effectiveReplyInThread in dispatcher) - skipReplyToInMessages: false for P2P thread messages (so send layer uses im.message.reply instead of im.message.create) Co-Authored-By: Claude Opus 4.6 (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.
Summary
thread_idpresent) and plain quote replies (root_idonly) per the Feishu API contractisDirect=trueFixes openclaw#38806
Changes
Four targeted changes in
extensions/feishu/src/bot.ts, all gated bydirectThreadMessage = isDirect && Boolean(ctx.threadId):replyInThreadfalsetruefalse(unchanged)replyTargetMessageIdctx.messageIdctx.rootIdctx.messageId(unchanged)threadReplyfalsetruefalse(unchanged)skipReplyToInMessagestruefalsetrue(unchanged)Test plan
replyInThread=truereplyInThread=false