Skip to content

fix(feifix(feishu): prevent isolated thread sessions in DMs (#44028) - #44058

Closed
iborazzi wants to merge 1 commit into
NousResearch:mainfrom
iborazzi:fix/feishu-dm-threads
Closed

fix(feifix(feishu): prevent isolated thread sessions in DMs (#44028)#44058
iborazzi wants to merge 1 commit into
NousResearch:mainfrom
iborazzi:fix/feishu-dm-threads

Conversation

@iborazzi

Copy link
Copy Markdown
Contributor

Description

Fixes an issue where a user sending a quoted reply (引用回复) in a Feishu/Lark DM conversation is routed to an isolated session instead of the normal DM session, causing the agent to lose conversation context.

Root Cause

When a user quotes/replies to a message in a Feishu DM, the Lark SDK populates message.thread_id (or message.root_id). While this is correct for group threads, Feishu DMs do not support real threads. This causes build_session_key() to generate an isolated session key (e.g., agent:main:feishu:dm:oc_xxx:om_yyy) instead of the main DM session key.

Changes Made

  • Added a check for chat_type == "p2p" in _process_inbound_message to clear the thread_id when the message is from a direct message conversation.
  • This ensures quoted replies in DMs stay within the same session and maintain proper context.

Fixes #44028

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/feishu Feishu / Lark adapter duplicate This issue or pull request already exists labels Jun 11, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #36233 — same fix: stop a Feishu DM quoted reply (引用回复) from being routed into an isolated thread-keyed session by ignoring thread_id/root_id for p2p chats. #36233 is the earlier open PR.

@iborazzi

Copy link
Copy Markdown
Contributor Author

Ah, I didn't catch that #36233 was already open for this. Thanks for letting me know, @alt-glitch! Glad to see the issue is being tracked and the fix is identical. Closing this one out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu DM: quoted reply (引用回复) creates isolated thread session, breaks conversation context

2 participants