openclaw - 💡(How to fix) Fix Feishu: mentionTargets auto-applied to all replies including error fallbacks, causes unintended cascade [3 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#70065Fetched 2026-04-23 07:29:40
View on GitHub
Comments
3
Participants
1
Timeline
16
Reactions
0
Author
Participants
Timeline (top)
mentioned ×7subscribed ×6commented ×3

Error Message

When a Feishu group message @mentions multiple users (e.g. "@Alice @Bob @Carol"), the mentionTargets array is captured from the incoming message and unconditionally attached to every reply sent by the agent — including error fallback messages. 2. Agent's model run fails (e.g. API error, rate limit) 3. Error fallback text is generated (e.g. "⚠️ Missing API key...") 4. Reply is sent with @A @B @C automatically appended → all three users are notified of an error that doesn't concern them In extensions/feishu/src/reply-dispatcher.ts, the mentionTargets captured from the incoming message are passed into the deliver function and unconditionally applied as mentions: isFirst ? mentionTargets : undefined on every first text chunk — including error fallbacks. 3. Alternatively, only apply mentionTargets to non-error replies (requires distinguishing error fallbacks from intentional replies at the deliver layer).

Root Cause

In extensions/feishu/src/reply-dispatcher.ts, the mentionTargets captured from the incoming message are passed into the deliver function and unconditionally applied as mentions: isFirst ? mentionTargets : undefined on every first text chunk — including error fallbacks.

The mentionTargets are also added as a System hint to the agent's input:

Fix Action

Workaround

None — this is baked into the reply pipeline. Agents in groups with multiple @mentions will always trigger cascade notifications on errors.

RAW_BUFFERClick to expand / collapse

Problem

When a Feishu group message @mentions multiple users (e.g. "@Alice @Bob @Carol"), the mentionTargets array is captured from the incoming message and unconditionally attached to every reply sent by the agent — including error fallback messages.

This means:

  1. User @mentions A, B, C in a group message
  2. Agent's model run fails (e.g. API error, rate limit)
  3. Error fallback text is generated (e.g. "⚠️ Missing API key...")
  4. Reply is sent with @A @B @C automatically appended → all three users are notified of an error that doesn't concern them

This also affects Ack messages: if an agent receives an @ to multiple bots, the Ack reply will @mention all of them unnecessarily.

Root Cause

In extensions/feishu/src/reply-dispatcher.ts, the mentionTargets captured from the incoming message are passed into the deliver function and unconditionally applied as mentions: isFirst ? mentionTargets : undefined on every first text chunk — including error fallbacks.

The mentionTargets are also added as a System hint to the agent's input:

Expected Behavior

Mentions should be agent's decision, not system-automated. The mentionTargets should only serve as context information (i.e. "these users were mentioned in the incoming message") — the agent should decide whether to include them in its reply.

Suggested Fix

  1. reply-dispatcher.ts: Stop passing mentionTargets to sendMessageFeishu/sendStructuredCardFeishu. The agent can explicitly include @mentions in reply text if needed.

  2. bot.ts: Remove or soften the System hint that says "Your reply will automatically @mention..." — instead indicate that mentionTargets are context-only and the agent should decide.

  3. Alternatively, only apply mentionTargets to non-error replies (requires distinguishing error fallbacks from intentional replies at the deliver layer).

Workaround

None — this is baked into the reply pipeline. Agents in groups with multiple @mentions will always trigger cascade notifications on errors.

extent analysis

TL;DR

Modify the reply-dispatcher.ts to stop passing mentionTargets to sendMessageFeishu/sendStructuredCardFeishu to prevent automatic @mentions in error fallback messages.

Guidance

  • Review the reply-dispatcher.ts file to understand how mentionTargets are being passed to the deliver function and applied to every reply.
  • Consider implementing a check to distinguish error fallbacks from intentional replies, and only apply mentionTargets to non-error replies.
  • Update the System hint in bot.ts to indicate that mentionTargets are context-only and the agent should decide whether to include them in its reply.
  • Test the changes to ensure that @mentions are no longer automatically appended to error fallback messages.

Example

// reply-dispatcher.ts
// ...
const isFirst = /* ... */;
const mentionTargets = /* ... */;
const reply = /* ... */;

// Only apply mentionTargets to non-error replies
if (!isErrorFallback(reply)) {
  deliver({ text: reply, mentions: isFirst ? mentionTargets : undefined });
} else {
  deliver({ text: reply });
}

Notes

The suggested fix requires modifying the reply-dispatcher.ts file and potentially updating the bot.ts file. The changes may have unintended consequences, such as breaking existing functionality or introducing new bugs.

Recommendation

Apply workaround by modifying the reply-dispatcher.ts file to stop passing mentionTargets to sendMessageFeishu/sendStructuredCardFeishu, as this is the most straightforward solution to prevent automatic @mentions in error fallback messages.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Feishu: mentionTargets auto-applied to all replies including error fallbacks, causes unintended cascade [3 comments, 1 participants]