Skip to content

fix(feishu): avoid creating incorrect thread to msg referenced by user - #23758

Open
Faithful-Mind wants to merge 1 commit into
NousResearch:mainfrom
Faithful-Mind:fix/feishu-create-incorrect-thread
Open

fix(feishu): avoid creating incorrect thread to msg referenced by user#23758
Faithful-Mind wants to merge 1 commit into
NousResearch:mainfrom
Faithful-Mind:fix/feishu-create-incorrect-thread

Conversation

@Faithful-Mind

@Faithful-Mind Faithful-Mind commented May 11, 2026

Copy link
Copy Markdown

What does this PR do?

avoid creating incorrect thread to referenced msg refered by user

reply to user's message instead

避免错误创建话题在用户所引用的消息上
改为直接回复用户的消息

Related Issue

Fixes #20548

Type of Change

  • [*] 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • [*] ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • gateway/platforms/feishu.py
    removed incorrect or getattr(message, "root_id", None) fallback condition from the thread_id assignment in _process_inbound_message, so root_id no longer leaks into thread_id
  • tests/gateway/test_feishu.py — Added two tests to TestFeishuProcessInboundMessage:
    • test_root_id_not_used_as_thread_id — verifies thread_id is None when only root_id is set
    • test_thread_id_passed_when_set — verifies thread_id is passed through correctly when explicitly set

How to Test

  1. send a direct message with reference replying to another message in Feishu, not reply in a thread or create thread.
    在飞书私聊发送一条回复所引用消息的消息,不要在话题中回复或者创建话题。
  2. check replied messag by Hermes Agent.
    检查Hermes对刚才发的消息的回复。
  3. Hermes' reply should shown in chat history of main dialog, not in a new separate thread of the referenced message.
    Hermes的回复应该出现在主对话聊天记录中,而非出现在单独的新话题中。

Checklist

Code

  • [*] I've read the Contributing Guide
  • [*] My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • [*] I searched for existing PRs to make sure this isn't a duplicate
  • [*] My PR contains only changes related to this fix/feature (no unrelated commits)
  • [*] I've run pytest tests/ -q and all tests pass
  • [*] I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • [*] I've tested on my platform: Termux 0.116 beta on Android 15

Documentation & Housekeeping

  • [N/A] I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • [N/A] I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • [N/A] I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • [N/A] I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

IMG_5161

@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 May 11, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #20562 — same fix (removing root_id fallback from thread_id assignment in Feishu adapter). Also related to closed #23282 which was not merged.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused regression coverage. The underlying issue is still present on current main: plugins/platforms/feishu/adapter.py:3252 continues to use root_id as a fallback for thread_id, while lines 3253-3257 already preserve root_id separately as reply context.

Problems

  • The PR changes the former adapter path, gateway/platforms/feishu.py. Current main moved that adapter to plugins/platforms/feishu/adapter.py in 5600105478ffde29d7566b45421b100eaa29c4ef, so the production hunk needs relocation during salvage.

Suggested changes

  • Apply the one-line change at plugins/platforms/feishu/adapter.py:3252 and port the proposed tests to tests/gateway/test_feishu.py.
  • Keep the existing reply_to_message_id fallback through root_id at plugins/platforms/feishu/adapter.py:3253-3257; it is separate from session/thread routing.

Automated hermes-sweeper review.

@@ -2930,7 +2930,7 @@ async def _process_inbound_message(
if hint:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current main moved this adapter to plugins/platforms/feishu/adapter.py:3252 in 5600105478ffde29d7566b45421b100eaa29c4ef. Preserve this exact one-line behavior change when salvaging it into the relocated adapter.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
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 sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feishu] root_id fallback for thread_id causes all replies to be threaded

3 participants