openclaw - 💡(How to fix) Fix [Bug]: Feishu @ mention tags are escaped by MarkdownIt, breaking message delivery

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…

Root Cause

In dist/send-B3SJ2DWf.js (compiled from the Feishu channel plugin), the message text is processed through MarkdownIt before being sent to the Feishu API. MarkdownIt treats the <at> tags as HTML and escapes them according to Markdown safety rules.

Current code location: ~/.npm-global/lib/node_modules/openclaw/dist/send-B3SJ2DWf.js

let rawText = text ?? "";
// The text here contains <at user_id="...">name</at>
// After MarkdownIt processing, it becomes &lt;at user_id="..."&gt;name&lt;/at&gt;

Fix Action

Fix / Workaround

This issue affects all crew members on our ship who need to @ mention each other in group chats. The current workaround requires manual patching of compiled OpenClaw code, which needs to be re-applied after every update.

Code Example

let rawText = text ?? "";
// The text here contains <at user_id="...">name</at>
// After MarkdownIt processing, it becomes &lt;at user_id="..."&gt;name&lt;/at&gt;

---

// Temporary fix: reverse-escape Feishu <at> tags to fix MarkdownIt escaping issue
rawText = rawText.replace(/&lt;at\s+/g, "<at ")
                 .replace(/&lt;\/at&gt;/g, "</at>")
                 .replace(/&gt;([^<]*)$/g, ">$1")
                 .replace(/&quot;/g, '"');
RAW_BUFFERClick to expand / collapse

Bug Description

When sending messages to Feishu (Lark) with @ mentions using the XML format <at user_id="...">name</at>, the MarkdownIt renderer in OpenClaw escapes the < and > characters to &lt; and &gt;. This causes the Feishu API to receive malformed mention tags that it cannot parse, resulting in:

  1. The mention not being rendered as an actual @ mention in Feishu
  2. The mentioned user not receiving a notification/push
  3. The raw &lt;at user_id="..."&gt; text being displayed instead

Root Cause

In dist/send-B3SJ2DWf.js (compiled from the Feishu channel plugin), the message text is processed through MarkdownIt before being sent to the Feishu API. MarkdownIt treats the <at> tags as HTML and escapes them according to Markdown safety rules.

Current code location: ~/.npm-global/lib/node_modules/openclaw/dist/send-B3SJ2DWf.js

let rawText = text ?? "";
// The text here contains <at user_id="...">name</at>
// After MarkdownIt processing, it becomes &lt;at user_id="..."&gt;name&lt;/at&gt;

Temporary Fix Applied

We applied a temporary fix by adding reverse-escape regex replacements before the MarkdownIt processing:

// Temporary fix: reverse-escape Feishu <at> tags to fix MarkdownIt escaping issue
rawText = rawText.replace(/&lt;at\s+/g, "<at ")
                 .replace(/&lt;\/at&gt;/g, "</at>")
                 .replace(/&gt;([^<]*)$/g, ">$1")
                 .replace(/&quot;/g, '"');

This fix is fragile and may break with future OpenClaw updates.

Expected Behavior

The <at user_id="...">name</at> tags should be preserved as-is when sending to Feishu, without being escaped by MarkdownIt.

Suggested Fix

  1. Option A: Exclude <at> tags from MarkdownIt escaping by pre-processing them before Markdown rendering, similar to how code blocks are protected.

  2. Option B: Use a Feishu-specific post-processing step that unescapes <at> tags after Markdown rendering but before API submission.

  3. Option C: Use Feishu's native mention API (buildMentionedMessage) instead of inline XML tags, though this may require changes to how OpenClaw handles mentions across channels.

Environment

  • OpenClaw version: 2026.5.12
  • Channel: Feishu (Lark)
  • File affected: dist/send-B3SJ2DWf.js (Feishu send handler)

Additional Context

This issue affects all crew members on our ship who need to @ mention each other in group chats. The current workaround requires manual patching of compiled OpenClaw code, which needs to be re-applied after every update.


Thank you for maintaining OpenClaw! Let me know if you need more details or reproduction steps.

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 [Bug]: Feishu @ mention tags are escaped by MarkdownIt, breaking message delivery