fix(feishu): ignore thread_id in DM quoted replies to prevent isolated sessions - #44514
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(feishu): ignore thread_id in DM quoted replies to prevent isolated sessions#44514liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
…d sessions In Feishu/Lark DMs, quoted replies (引用回复) populate message.thread_id and message.root_id via the Lark SDK. These fields were passed through to build_session_key(), which creates an isolated session keyed by thread_id instead of the normal DM session. The agent loses all conversation context and either responds with a wrong answer or fails silently. The fix nullifies thread_id when chat_type is "p2p" (DM), since Feishu DMs do not support real threads. Group chat thread_id is preserved. Fixes NousResearch#44028
Collaborator
Contributor
Author
|
Thanks for the flag @alt-glitch. Confirmed — #36233 is the canonical fix with a more comprehensive approach (distinguishes quote replies from topic sessions across 4 files vs this narrower DM-only fix). Closing in favor of #36233. |
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 Feishu/Lark DM quoted replies (引用回复) create isolated thread sessions, causing the agent to lose all conversation context. The fix nullifies
thread_idwhenchat_typeis"p2p"(DM), since Feishu DMs do not support real threads.Related Issue
Fixes #44028
Type of Change
Changes Made
gateway/platforms/feishu.py: Add 4-line guard to setthread_id = Nonewhenchat_type == "p2p", preventing isolated session creation for DM quoted repliestests/gateway/test_feishu.py: Addtest_dm_quoted_reply_ignores_thread_id— verifies that a DM message withthread_id/root_idpopulated by the Lark SDK does NOT produce an isolated sessionHow to Test
pytest tests/gateway/test_feishu.py -k test_dm_quoted_reply_ignores_thread_id -xvspytest tests/gateway/test_feishu.py -xChecklist
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
_process_inbound_messageingateway/platforms/feishu.py(callers: Feishu webhook handler → inbound processing pipeline → session key builder)build_session_key()ingateway/session.pyusesthread_idto differentiate sessions; this fix ensures p2p messages always use the standard DM session key