openclaw - 💡(How to fix) Fix 飞书话题群回复时无法正确识别话题,导致创建新话题而非回复到原话题 [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#53765Fetched 2026-04-08 01:23:40
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Fix Action

Fix / Workaround

src/messaging/inbound/dispatch-context.js 中,判断是否为话题消息的逻辑是:

  • src/messaging/inbound/dispatch-context.js - isThread 判断逻辑
  • src/messaging/inbound/parse.js - 已正确解析 rootId 字段
  • src/messaging/types.d.ts - 已定义 rootId 类型

Code Example

const isThread = isGroup && Boolean(ctx.threadId);

---

// 原来
const isThread = isGroup && Boolean(ctx.threadId);

// 建议改为
const isThread = isGroup && Boolean(ctx.threadId || ctx.rootId);
RAW_BUFFERClick to expand / collapse

问题描述

在飞书话题群(topic group)中,当用户在话题下发送消息时,Agent 回复会创建新话题,而不是回复到当前话题中。

问题复现

  1. 创建一个飞书话题群
  2. 创建一个话题
  3. 在话题中 @机器人 发送消息
  4. 机器人回复时创建了新话题,而非在原话题下回复

根因分析

src/messaging/inbound/dispatch-context.js 中,判断是否为话题消息的逻辑是:

const isThread = isGroup && Boolean(ctx.threadId);

但飞书话题群的消息结构中,话题内的回复消息通常通过 root_id 字段标识归属,而非 thread_id

字段格式含义
root_idom_xxx话题根消息的 ID,话题内所有回复都有此字段
thread_idomt_xxx话题的 ID,可能只在某些情况下存在

root_id 存在时,说明这条消息是话题中的回复。但当前代码只检查 threadId,导致无法正确识别话题归属。

建议修复

修改判断逻辑,同时检查 threadIdrootId

// 原来
const isThread = isGroup && Boolean(ctx.threadId);

// 建议改为
const isThread = isGroup && Boolean(ctx.threadId || ctx.rootId);

相关文件

  • src/messaging/inbound/dispatch-context.js - isThread 判断逻辑
  • src/messaging/inbound/parse.js - 已正确解析 rootId 字段
  • src/messaging/types.d.ts - 已定义 rootId 类型

环境信息

  • OpenClaw 版本:最新版
  • 飞书插件版本:openclaw-lark
  • 群类型:话题群(chat_mode=topic)

extent analysis

Fix Plan

To fix the issue, modify the isThread judgment logic in src/messaging/inbound/dispatch-context.js to check both threadId and rootId.

  • Update the isThread variable assignment:
const isThread = isGroup && Boolean(ctx.threadId || ctx.rootId);
  • Ensure that ctx.rootId is correctly parsed in src/messaging/inbound/parse.js.
  • Verify that the rootId type is defined in src/messaging/types.d.ts.

Verification

After applying the fix, test the scenario again:

  1. Create a topic group in Feishu.
  2. Create a topic.
  3. Send a message in the topic and @ the bot.
  4. Verify that the bot's response is posted in the same topic, rather than creating a new one.

Extra Tips

  • Double-check that the rootId field is correctly handled in all relevant code paths.
  • Consider adding additional logging or debugging statements to ensure that the isThread logic is working as expected.

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 飞书话题群回复时无法正确识别话题,导致创建新话题而非回复到原话题 [1 participants]