Skip to content

fix(feishu): prevent topic replies from spawning new threads#19711

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a
May 4, 2026
Merged

fix(feishu): prevent topic replies from spawning new threads#19711
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a

Conversation

@teknium1

@teknium1 teknium1 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Salvage of #16620 by @julysir onto current main.

Summary

When replying inside a Feishu topic-enabled group chat, the agent created a new topic/thread instead of staying in the current one. The reply anchor was hard-set to the CURRENT message_id rather than the incoming reply's parent. On Feishu, with a thread_id present AND a reply_to_message_id available, use reply_to_message_id as the anchor so the agent's reply lands inside the existing thread. Also extend _process_inbound_message to fall back to root_id when computing thread_id / reply_to_message_id so Feishu's Topic Mode API shape is handled.

Conflict resolution during salvage

Main has since added ephemeral-message handling (_unwrap_ephemeral, _schedule_ephemeral_delete) at the two dispatch call sites this PR targets. Re-applied the Feishu reply-anchor fix in-place on the HEAD send calls (patching reply_to= inside the existing _r = await self._send_with_retry(...) blocks) rather than re-introducing the PR's parallel send block which would now double-send the response.

Changes

  • gateway/platforms/base.py: Feishu+thread_id → use reply_to_message_id as reply anchor at 3 send sites (+32/-4 net)
  • gateway/platforms/feishu.py: fall back to root_id for thread_id / reply_to_message_id in _process_inbound_message

Validation

scripts/run_tests.sh tests/gateway/ -k feishu -> 377 passed

Original PR: #16620

…l patch)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@teknium1 teknium1 merged commit a79b0ec into main May 4, 2026
7 of 10 checks passed
@teknium1 teknium1 deleted the hermes/hermes-8c54fd4a branch May 4, 2026 11:53
@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 labels May 4, 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 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.

2 participants