makecindy / makecindy/cindy

飞书群组 @ 机器人后创建话题并在线程内回复

Open
#2,025 1 comment 0 reactions 0 assignees View on GitHub
feature
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

**提交人**: daiyuanyang
**客户端版本**: 0.1.35

---

## 使用场景
用户将 Cindy 飞书机器人加入群组,希望在群内 @ 机器人发起任务:
- 被 @ 的消息不在话题中时,以该消息创建话题并在新话题回复;
- 消息已经在话题中时,直接在当前话题回复。

机器人已经加入群组,用户也正确 @ 了机器人,但没有回复或创建群组会话。本机日志显示群消息已到达 Cindy,却被接收层主动丢弃:

```text
[2026-08-07T14:50:05.725+08:00] [INFO ] [im:feishu] [feishu/wsClient] drop non-p2p chat_type=group
```

复现场景:连接飞书机器人并加入群组,在主消息流发送 `@机器人 测试一下你的回复功能是否正确`,机器人无响应,日志出现上述记录。测试群中只有用户和两个飞书机器人。

## 诉求
1. 支持接收 `chat_type=group`;
2. 默认只处理明确 @ 当前机器人的群消息;
3. 主群被 @ 时创建话题并在线程内回复;
4. 话题内被 @ 时直接回复原话题;
5. 群组或话题使用稳定会话路由,保留 `chat_id`、`message_id`、`root_id`、`parent_id`;
6. 保持 owner 授权边界,或提供群组/成员白名单;
7. 忽略机器人自身消息,防止多个机器人互相触发;
8. 群组会话与私聊会话隔离,避免上下文串线。

## 建议方案
- 飞书接收层不再一律丢弃 `chat_type=group`,先判断 mention 是否指向当前机器人;
- 使用 `root_id` / `parent_id` 判断消息是否已处于话题;
- 主群消息通过飞书回复/话题 API 创建线程,线程消息沿用原 `root_id` 回复;
- 会话键至少包含 `chat_id + root_id`,主群新请求可按原消息 ID 建立线程上下文;
- 在进入 Agent 前执行 owner/白名单校验和 bot-sender 过滤;
- 日志区分未 @、未授权、已路由、话题创建失败和回复失败。

验收覆盖:主群 @、话题内 @、未 @、非白名单成员、机器人消息、两个机器人同群,以及现有私聊行为不回归。
---
**版本区域**: CN
**OS**: win32 x64 (10.0.26200)
**界面语言**: zh-CN

Contributor guide

Open the contributing guide

Research direction

Start at the Feishu receiving layer identified by the wsClient log, where group messages are currently dropped. Trace mention filtering, root_id/parent_id thread routing, session keys, authorization, and bot-message handling before the Agent. Done means the listed group, thread, authorization, bot, multi-bot, and private-chat regression cases pass with distinct failure logging.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.