Feishu: reply to topic roots#29968
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 932d0289c9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...mediaPayload, | ||
| }); | ||
|
|
||
| const replyTargetMessageId = ctx.rootId ?? ctx.messageId; |
There was a problem hiding this comment.
Restrict root-id reply targeting to thread mode
handleFeishuMessage now always prefers ctx.rootId for replyToMessageId, but sendMessageFeishu only sets reply_in_thread when replyInThread is enabled. In groups where replyInThread is disabled, any inbound event carrying root_id will therefore be replied to as a normal inline reply against the topic root (older message) instead of the triggering message, which changes reply anchoring behavior outside the intended thread-mode fix.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR fixes a Feishu bot bug where replies inside existing topic groups were creating new standalone topics instead of staying within the original thread. The fix changes the reply target from always using the child Key Changes:
Impact:
Confidence Score: 5/5
Last reviewed commit: 932d028 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d501f8ba6d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...mediaPayload, | ||
| }); | ||
|
|
||
| const replyTargetMessageId = ctx.rootId ?? ctx.messageId; |
There was a problem hiding this comment.
Gate root-id reply targeting behind thread mode
replyTargetMessageId now always prefers ctx.rootId, but sendMessageFeishu only adds reply_in_thread when replyInThread is enabled; when thread mode is disabled and an inbound group message still carries root_id, replies are sent as normal inline replies to the topic root instead of the triggering message, which changes anchoring behavior outside the intended thread-mode fix.
Useful? React with 👍 / 👎.
d501f8b to
67dac11
Compare
|
Merged via autoland after rebase conflict resolution with #29788 semantics preserved. Verification run:
Changelog:
Merge commit: 1234cc4 |
* Feishu: reply to topic roots * Changelog: note Feishu topic-root reply targeting --------- Co-authored-by: bmendonca3 <208517100+bmendonca3@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Add a new `replyTarget` config option (`"message"" | "root"`, default `"message"`) for Feishu group chats to control whether bot replies target the triggering message or the topic root message. PR openclaw#29968 changed the reply target from `ctx.messageId` to `ctx.rootId ?? ctx.messageId`. While this works well for groups with topic mode enabled, it causes a regression in normal group chats: when a user quote-replies to @bot, Feishu attaches a `root_id` to the message, causing the bot's reply to silently enter a topic thread instead of appearing in the main chat view. This adds a configurable option so users can choose the appropriate behavior for their group type: - "message" (default): reply to the triggering message (pre-openclaw#29968) - "root": reply to the topic root (post-openclaw#29968 behavior) The config can be set per-group or globally in the feishu channel config.
* Feishu: reply to topic roots * Changelog: note Feishu topic-root reply targeting --------- Co-authored-by: bmendonca3 <208517100+bmendonca3@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
* Feishu: reply to topic roots * Changelog: note Feishu topic-root reply targeting --------- Co-authored-by: bmendonca3 <208517100+bmendonca3@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Summary
Describe the problem and fix in 2–5 bullets:
message_idinto the reply dispatcher instead of the topicroot_id.ctx.rootId ?? ctx.messageId, and the bot test suite now covers existing-topic replies explicitly.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Feishu bot replies in existing topic-group threads now stay under the original topic instead of opening a new standalone topic.
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
channels.feishu.groups.oc-group.replyInThread: "enabled"Steps
replyInThread: "enabled".message_idandroot_id.createFeishuReplyDispatcher(...)call fromhandleFeishuMessage(...).Expected
Actual
upstream/main, the dispatcher receives the childmessage_id, which causes Feishu to create a new topic instead of replying under the existing one.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
replyToMessageId: "om_root_topic", then confirmed the same case passes after the fix.ctx.messageId, and topic session routing remains unchanged.Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
extensions/feishu/src/bot.ts,extensions/feishu/src/bot.test.tsRisks and Mitigations
root_idwhenever Feishu supplies one.root_idfor topic-thread messages, and the code still falls back tomessage_idfor every non-topic path.Verification Commands
pnpm checkstill fails on currentupstream/mainbecause of unrelated baseline typecheck errors inextensions/diagnostics-otel/src/service.ts,src/discord/voice/manager.ts,src/gateway/server-cron.ts, andsrc/shared/net/ip.ts.