fix(feishu): ignore thread_id in DM quoted replies to prevent isolated sessions - #44259
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(feishu): ignore thread_id in DM quoted replies to prevent isolated sessions#44259liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
…d sessions When a user sends a quoted reply (引用回复) in a Feishu DM, the Lark SDK populates message.thread_id with the parent message ID. The gateway's session key builder then appends this thread_id, creating an isolated session (e.g. `agent:main:feishu:dm:oc_xxx:om_yyy`) instead of using the normal DM session (`agent:main:feishu:dm:oc_xxx`). This causes the agent to lose all conversation context. Feishu DMs do not support real threads — quoted replies are just messages in the same conversation. Only group chats (话题/话题区) use real threads. Fix: clear thread_id when chat_type is "p2p" so the session key remains unchanged. Group thread behavior is preserved. Closes NousResearch#44028
Collaborator
Contributor
Author
|
Thanks for the flag @alt-glitch. Confirmed — #36233 covers the same root cause with a more comprehensive approach (+342/-13 across 4 files vs this PR's +55). Closing in favor of #36233. |
This was referenced Jun 11, 2026
This was referenced Aug 3, 2026
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.
What does this PR do?
Fixes a bug where quoted replies (引用回复) in Feishu DMs create isolated sessions, causing the agent to lose all conversation context. The Lark SDK populates
thread_idfor DM quoted replies, but Feishu DMs don't support real threads — the field is erroneously used to build a different session key.Related Issue
Fixes #44028
Type of Change
Changes Made
gateway/platforms/feishu.py: Clearthread_idwhenchat_type == "p2p"so DM quoted replies stay in the normal DM session. Group thread behavior is preserved.tests/gateway/test_feishu.py: Added two regression tests — DM quoted reply strips thread_id, group reply preserves it.How to Test
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
FeishuAdapter._process_inbound_message()(callers: Lark SDK event handler, flows: 1)thread_idfor group threads; DMs should not use it