Skip to content

fix(feishu): resolve thread root message_id for topic reply - #61380

Closed
LigHt3r2 wants to merge 1 commit into
NousResearch:mainfrom
LigHt3r2:fix/feishu-topic-reply
Closed

fix(feishu): resolve thread root message_id for topic reply#61380
LigHt3r2 wants to merge 1 commit into
NousResearch:mainfrom
LigHt3r2:fix/feishu-topic-reply

Conversation

@LigHt3r2

@LigHt3r2 LigHt3r2 commented Jul 9, 2026

Copy link
Copy Markdown

Summary

Fix the Feishu bot reply behavior in topic/thread group chats.
Currently bot replies appear as standalone messages instead of threaded replies.

Problem

When _send_raw_message() receives a message with thread_id metadata
in Feishu topic groups, the existing code treats thread_id (format
omt_xxx) as receive_id for CreateMessage, which creates a new
standalone message instead of a reply in the thread.

Solution

  1. Add _get_thread_root_message_id() method: uses Feishu SDK's
    ListMessageRequest API (container_id_type="thread") to list messages
    in the thread, identifies the root message (where root_id is absent
    or equals its own message_id).
  2. Modify the thread branch in _send_raw_message(): first resolve the
    root message ID, then call the Reply API with reply_in_thread=true,
    so the response correctly appears as a threaded reply.
  3. Returns explicit SendResult error on resolution failure, no silent
    fallback.

Changes

  • plugins/platforms/feishu/adapter.py: +50 / -8 lines
    • New: _get_thread_root_message_id() method
    • Modified: _send_raw_message() thread_id branch

Testing

  • Bot responds as threaded reply in Feishu topic groups
  • No regression in regular group chats and DMs
  • Resolution failure returns clear error without affecting other sends

- Add _get_thread_root_message_id() to resolve thread root via SDK list API
- Modify _send_raw_message() to use reply API with reply_in_thread=true
- Fixes topic group messages falling back to create API instead of reply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant