fix(feishu): add replyTarget config to control topic threading behavior#33748
fix(feishu): add replyTarget config to control topic threading behavior#33748guoqunabc wants to merge 1 commit intoopenclaw:mainfrom
Conversation
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.
Greptile SummaryThis PR introduces a Key observations:
Confidence Score: 4/5
Last reviewed commit: d787a96 |
| @@ -0,0 +1 @@ | |||
| - Feishu/reply target: add `replyTarget` config (`"message"` | `"root"`, default `"message"`) to control whether bot replies target the triggering message or the topic root. Fixes #29968 regression where bot replies in normal group chats silently entered topic threads when users quote-replied. | |||
There was a problem hiding this comment.
This changelog entry describes the feature correctly, but should include a breaking-change warning for existing topic-mode group deployments that have been running post-#29968 code. Those deployments will experience a behavior change when they upgrade (replies will no longer go to topic root by default) unless they explicitly add replyTarget: "root" to their per-group config.
Consider expanding the entry to include:
| - Feishu/reply target: add `replyTarget` config (`"message"` | `"root"`, default `"message"`) to control whether bot replies target the triggering message or the topic root. Fixes #29968 regression where bot replies in normal group chats silently entered topic threads when users quote-replied. | |
| - Feishu/reply target: add `replyTarget` config (`"message"` | `"root"`, default `"message"`) to control whether bot replies target the triggering message or the topic root. Fixes #29968 regression where bot replies in normal group chats silently entered topic threads when users quote-replied. **Breaking for topic-mode groups**: if you rely on replies staying inside Feishu topic threads after the #29968 change, add `replyTarget: "root"` to each affected group's config to preserve that behavior. |
Prompt To Fix With AI
This is a comment left during a code review.
Path: changelog/fragments/pr-feishu-reply-target.md
Line: 1
Comment:
This changelog entry describes the feature correctly, but should include a breaking-change warning for existing topic-mode group deployments that have been running post-#29968 code. Those deployments will experience a behavior change when they upgrade (replies will no longer go to topic root by default) unless they explicitly add `replyTarget: "root"` to their per-group config.
Consider expanding the entry to include:
```suggestion
- Feishu/reply target: add `replyTarget` config (`"message"` | `"root"`, default `"message"`) to control whether bot replies target the triggering message or the topic root. Fixes #29968 regression where bot replies in normal group chats silently entered topic threads when users quote-replied. **Breaking for topic-mode groups**: if you rely on replies staying inside Feishu topic threads after the #29968 change, add `replyTarget: "root"` to each affected group's config to preserve that behavior.
```
How can I resolve this? If you propose a fix, please make it concise.
Problem
PR #29968 (commit
1234cc4c3, 2026-03-02) changed the Feishu reply target fromctx.messageIdtoctx.rootId ?? ctx.messageId. The intention was to keep replies within topic threads for groups using topic mode.However, this introduced a regression in normal group chats (without topic mode): when a user quote-replies to @bot, Feishu attaches a
root_idto the message. After #29968, the bot reply is directed to theroot_id(the quoted message), causing it to silently enter a topic thread that is invisible in the main chat view.From the user's perspective, the bot appears to not respond at all.
Solution
Add a new
replyTargetconfig option ("message" | "root", default"message") that can be set per-group or globally in the Feishu channel config:"message"(default): Reply to the triggering message itself — the pre-Feishu: reply to topic roots #29968 behavior. Best for normal group chats."root": Reply to the topic root message (ctx.rootId ?? ctx.messageId) — the post-Feishu: reply to topic roots #29968 behavior. Best for groups with topic mode enabled.The default is
"message"to restore the previous behavior, which is more appropriate for the majority of group chats.Configuration example
{ "channels": { "feishu": { "replyTarget": "message", "groups": { "oc_topic_group_id": { "replyTarget": "root" } } } } }Changes
extensions/feishu/src/config-schema.ts: AddReplyTargetSchema("message" | "root") toFeishuGroupSchemaandFeishuSharedConfigShapeextensions/feishu/src/bot.ts: ResolvereplyTargetfrom per-group config → global feishu config → default"message", and use it to computereplyTargetMessageIdextensions/feishu/src/bot.test.ts: Update existing topic-root-reply test to usereplyTarget: "root", add new test for the default"message"behaviorchangelog/fragments/pr-feishu-reply-target.md: Changelog entryTesting
replyTarget: "root"is setThis fix addresses real user feedback where bot replies were invisible in normal group chats after #29968.