openclaw - 💡(How to fix) Fix 飞书话题群(Topic Group)被识别为p2p导致消息路由错误 [2 comments, 3 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#52238Fetched 2026-04-08 01:13:52
View on GitHub
Comments
2
Participants
3
Timeline
2
Reactions
0
Author
Timeline (top)
commented ×2

Fix Action

Fix / Workaround

feishu[main]: received message from ou_... in oc_ceaacf99d602be4842fe4505a77a4e70 (p2p)
feishu[main]: dispatching to agent (session=agent:main:main)

Code Example

feishu[main]: received message from ou_... in oc_ceaacf99d602be4842fe4505a77a4e70 (p2p)
feishu[main]: dispatching to agent (session=agent:main:main)

---

const isGroup = ctx.chatType === "group";

---

function normalizeFeishuChatType(value: unknown): FeishuChatType | undefined {
  return value === "group" || value === "private" || value === "p2p" ? value : undefined;
}

---

FeishuChatType = "p2p" | "group" | "private"

---

const isGroup = ctx.chatType === "group" 
     || !!event.message.thread_id 
     || !!event.message.root_id;
RAW_BUFFERClick to expand / collapse

问题描述

飞书话题群中的消息被 OpenClaw 识别为 p2p(单聊)而非 group(群聊),导致消息被错误路由到网页端主会话而非飞书群。

复现步骤

  1. 将机器人加入飞书话题群
  2. 在话题群中向机器人发送消息
  3. 观察:消息没有在话题群中回复,而是出现在了网页端

日志证据

feishu[main]: received message from ou_... in oc_ceaacf99d602be4842fe4505a77a4e70 (p2p)
feishu[main]: dispatching to agent (session=agent:main:main)

可以看到消息被识别为 p2p 而非 group

根本原因

1. isGroup 判断过于依赖 chat_type

bot.ts L904:

const isGroup = ctx.chatType === "group";

飞书话题群的 chat_type 不是 "group"(可能是 "p2p" 或其他值),导致 isGroup = false

2. normalizeFeishuChatType 兼容性不足

monitor.account.ts L138-139:

function normalizeFeishuChatType(value: unknown): FeishuChatType | undefined {
  return value === "group" || value === "private" || value === "p2p" ? value : undefined;
}

仅接受三种值,缺乏对话题群类型的支持。

3. FeishuChatType 类型定义不完整

types.ts L46/L63:

FeishuChatType = "p2p" | "group" | "private"

不包含话题群相关类型。

建议修复方案

方案:扩展 chat_type 兼容性 + 用 thread_id 作为补充判断

  1. 扩展 normalizeFeishuChatType:添加对话题群相关类型的支持

  2. thread_id/root_id 作为补充判断

    const isGroup = ctx.chatType === "group" 
      || !!event.message.thread_id 
      || !!event.message.root_id;
  3. 更新 FeishuChatType 类型定义

环境信息

  • OpenClaw 版本:(开源最新)
  • 飞书插件版本:(开源最新)
  • 复现环境:WSL2 + Ubuntu 22.04

extent analysis

Fix Plan

To fix the issue, follow these steps:

  1. Extend normalizeFeishuChatType function: Update the normalizeFeishuChatType function in monitor.account.ts to support topic group types:

function normalizeFeishuChatType(value: unknown): FeishuChatType | undefined { if (typeof value === 'string') { return ["group", "private", "p2p", "topic"].includes(value) ? value : undefined; } return undefined; }


2. **Update `isGroup` judgment**:
   Modify the `isGroup` judgment in `bot.ts` to use `thread_id` or `root_id` as a supplement:
   ```typescript
const isGroup = ctx.chatType === "group" 
  || !!event.message.thread_id 
  || !!event.message.root_id;
  1. Update FeishuChatType type definition: Add the topic group type to the FeishuChatType type definition in types.ts:

type FeishuChatType = "p2p" | "group" | "private" | "topic";


### Verification
To verify that the fix worked:

1. Restart the OpenClaw service.
2. Send a message to the topic group.
3. Check the logs to ensure the message is correctly identified as a group message.
4. Verify that the message is routed to the correct conversation in the web interface.

### Extra Tips
* Make sure to update the `FeishuChatType` type definition in all relevant files.
* Consider adding additional logging to help diagnose any future issues with message routing.
* If you encounter any issues with the updated code, try debugging the `normalizeFeishuChatType` function and the `isGroup` judgment to ensure they are 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 飞书话题群(Topic Group)被识别为p2p导致消息路由错误 [2 comments, 3 participants]