openclaw - 💡(How to fix) Fix [Bug] 飞书 post 模式下 @ 提及渲染为纯文本(双重根因)

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…

Code Example

// 新增 splitAtElements 辅助函数
function splitAtElements(messageText) {
    const elements = [];
    const atRegex = /<at user_id="([^"]+)">([^<]*)<\/at>/g;
    // ... 拆分逻辑
}
// post 构建改为
content: [splitAtElements(messageText)]
RAW_BUFFERClick to expand / collapse

环境

  • OpenClaw: 2026.5.22
  • 飞书群聊 topic/thread 模式

问题

Agent 通过 OpenClaw 飞书插件发送 post 模式消息时,<at user_id="xxx">name</at> 标签被飞书客户端渲染为纯文本,无法触发 @ 提及。

根因 1:post md 元素不解析 <at> 标签

sendMessageFeishu 将整条消息(含 <at> 标签)塞入单个 {tag:"md",text:"..."} 元素。飞书 post 的 md 元素不解析 <at> 标签。正确做法是将 @ 以独立的 {tag:"at",user_id:"xxx",user_name:"name"} 元素发送。

根因 2:bot cache 用 app_id 作 openId 导致名称查找冲突

CHAT_BOTS_SPEC.parseItemim/v1/chats/{id}/members/bots 返回的 bot_idcli_xxx 格式的 app_id)直接作为 openId 写入 user-name cache。而 resolveBotName 通过 bot/v3/bots/basic_batch 获取的是正确的 ou_xxx。两处写入了同一个 bot 名称 → lookupByName 命中两条冲突记录 → ambiguous → 不替换 → 原始标签原样输出。

修复建议

渲染层

sendMessageFeishu 的 post content 构建改为将 <at> 标签拆分为独立元素:

// 新增 splitAtElements 辅助函数
function splitAtElements(messageText) {
    const elements = [];
    const atRegex = /<at user_id="([^"]+)">([^<]*)<\/at>/g;
    // ... 拆分逻辑
}
// post 构建改为
content: [splitAtElements(messageText)]

数据层

CHAT_BOTS_SPEC.record 不再将 prefetched bot 写入 user-name cache,bot 名称交给 resolveBotNamebot/v3/bots/basic_batch)按需加载,确保 openId 正确。

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] 飞书 post 模式下 @ 提及渲染为纯文本(双重根因)