Skip to content

fix(feishu): add replyTarget config to control topic threading behavior#33748

Closed
guoqunabc wants to merge 1 commit intoopenclaw:mainfrom
guoqunabc:fix/feishu-reply-target-config
Closed

fix(feishu): add replyTarget config to control topic threading behavior#33748
guoqunabc wants to merge 1 commit intoopenclaw:mainfrom
guoqunabc:fix/feishu-reply-target-config

Conversation

@guoqunabc
Copy link
Copy Markdown
Contributor

Problem

PR #29968 (commit 1234cc4c3, 2026-03-02) changed the Feishu reply target from ctx.messageId to ctx.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_id to the message. After #29968, the bot reply is directed to the root_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 replyTarget config option ("message" | "root", default "message") that can be set per-group or globally in the Feishu channel config:

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: Add ReplyTargetSchema ("message" | "root") to FeishuGroupSchema and FeishuSharedConfigShape
  • extensions/feishu/src/bot.ts: Resolve replyTarget from per-group config → global feishu config → default "message", and use it to compute replyTargetMessageId
  • extensions/feishu/src/bot.test.ts: Update existing topic-root-reply test to use replyTarget: "root", add new test for the default "message" behavior
  • changelog/fragments/pr-feishu-reply-target.md: Changelog entry

Testing

  • All 49 Feishu bot tests pass
  • Verified that existing topic thread behavior is preserved when replyTarget: "root" is set
  • Verified that quote-reply in normal groups correctly replies to the triggering message with the default config

This fix addresses real user feedback where bot replies were invisible in normal group chats after #29968.

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.
@openclaw-barnacle openclaw-barnacle bot added channel: feishu Channel integration: feishu size: S labels Mar 4, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 4, 2026

Greptile Summary

This PR introduces a replyTarget config option ("message" | "root", default "message") to the Feishu channel to give operators control over where bot replies are directed — either to the triggering message (safe for normal group chats) or to the topic root (correct for Feishu topic-mode groups). The change cleanly reverts the regression introduced in #29968 for most users while preserving the topic-thread behavior via an explicit opt-in.

Key observations:

  • The resolution order (per-group → global feishu config → "message") is correct and mirrors how replyInThread is handled.
  • Schema additions in config-schema.ts are consistent with existing patterns.
  • Tests cover both the default "message" path and the explicit "root" path.
  • The changelog entry should explicitly note that groups relying on post-Feishu: reply to topic roots #29968 topic-root behavior will need to add replyTarget: "root" to their config when upgrading.

Confidence Score: 4/5

  • The implementation is correct and safe to merge with one documentation improvement — the changelog should include a breaking-change note for existing topic-mode deployments.
  • The code implementation is solid: the replyTarget config is properly resolved (per-group → global → default "message"), correctly applied in the reply logic, and tested for both paths. The schema changes are consistent with existing patterns. The only concern is incomplete changelog documentation — existing topic-mode group operators who have been running post-Feishu: reply to topic roots #29968 code need to explicitly add replyTarget: "root" when upgrading, but the changelog doesn't warn them. This is a documentation gap, not a code bug, but it could cause user confusion on upgrade.
  • changelog/fragments/pr-feishu-reply-target.md — add breaking-change note for topic-mode groups.

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.
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.

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:

Suggested change
- 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant