Skip to content

Feishu 话题群流式回复创建新话题问题 #28273

@paceyw

Description

@paceyw

Feishu 话题群流式回复创建新话题问题

问题描述

在飞书话题群中,当 Agent 使用流式卡片(streaming card)回复消息时,会创建一个新的话题,而不是在原话题下回复。

问题复现

  1. 在飞书话题群创建一个话题(Topic A)
  2. 在 Topic A 中 @机器人 发送消息
  3. Agent 回复:
    • ✅ 第一条普通消息在 Topic A 下(正确)
    • ❌ 第二条流式卡片消息创建新话题(错误)

问题根因

代码链路

bot.ts (有 rootId)
  ↓ 未传递
reply-dispatcher.ts (缺少 rootId 参数)
  ↓ 未传递
streaming-card.ts (创建消息时无 root_id)
  ↓
飞书 API (创建新话题)

关键代码

streaming-card.ts - 创建消息时缺少 root_id

const sendRes = await this.client.im.message.create({
  params: { receive_id_type: receiveIdType },
  data: {
    receive_id: receiveId,
    msg_type: "interactive",
    content: JSON.stringify({ type: "card", data: { card_id: cardId } }),
    // ❌ 缺少 root_id 参数
  },
});

飞书消息结构

飞书话题群的消息结构:

话题根消息: root_id = null
└── 话题回复: root_id = <根消息ID>  ← 必须传递!

日志证据

10:23:41 话题隔离启用: topic session isolation enabled
10:25:33 发送 2 条回复
10:25:36 流式卡片创建(messageId=om_x100b55...)
         ↑ 没有关联到原话题的 root_id

影响范围

  • ✅ 不影响普通消息回复(已正确使用 replyToMessageId
  • ✅ 只影响流式卡片回复
  • ✅ 不影响 topicSessionMode 配置(已正常工作)

解决方案

已创建修复 PR: #XXX

修改 3 个文件,添加 rootId 参数传递:

  1. streaming-card.ts - 在 start() 方法添加 rootId 参数
  2. reply-dispatcher.ts - 在 CreateFeishuReplyDispatcherParams 类型添加 rootId
  3. bot.ts - 传递 ctx.rootIdcreateFeishuReplyDispatcher()

临时解决方案

在修复合并前,可以禁用流式回复:

{
  "channels": {
    "feishu": {
      "streaming": false
    }
  }
}

环境信息

  • OpenClaw 版本:2026.2.25
  • 飞书群类型:话题群
  • 配置:topicSessionMode: "enabled"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions