fix(lark): 修复话题群多机器人让路#383
Merged
Merged
Conversation
该用例(shared follow-up + topic 模式 + @另一个bot 应让路)此前未设 mockGetChatInfo,
默认桩返回 {userCount:1,botCount:1},而 beforeEach 不 reset 它;整套跑时靠继承前序用例
遗留的多bot群状态才通过,单独跑会落回 1对1 免@放行 → bot 反而响应、断言失败。
显式 mock {userCount:3,botCount:2}(即真实的多bot群场景)使其确定性通过,
且在修复前代码上仍会 fail,保持有效回归。
tanjiancheng
pushed a commit
to tanjiancheng/botmux
that referenced
this pull request
Jul 8, 2026
* fix(lark): 修复话题群多机器人让路
* test(lark): 话题让路用例显式 mock 多bot群,消除测试顺序依赖
该用例(shared follow-up + topic 模式 + @另一个bot 应让路)此前未设 mockGetChatInfo,
默认桩返回 {userCount:1,botCount:1},而 beforeEach 不 reset 它;整套跑时靠继承前序用例
遗留的多bot群状态才通过,单独跑会落回 1对1 免@放行 → bot 反而响应、断言失败。
显式 mock {userCount:3,botCount:2}(即真实的多bot群场景)使其确定性通过,
且在修复前代码上仍会 fail,保持有效回归。
---------
Co-authored-by: 申晗 <shenhan.sh@bytedance.com>
(cherry picked from commit 665b2f0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么
regularGroupMentionMode: topic+ owned session 放行而一起响应的问题。mentionsAnotherMember()补齐 app_id 形态的 bot mention 识别,和isBotMentioned()的 app_id 支持保持一致。topic/ambient模式下遇到“@ 其他成员/机器人”时让路,不再折回当前 bot 的 chat session。topic模式的 owned-thread 免 @ 续话增加“@ 其他成员/机器人则让路”的限制。为什么
用户通过 npm 安装运行自己的 botmux daemon,在一个话题群中由主机器人分派任务给子机器人后,后续明确 @ 任意一个机器人时,多个机器人都会响应。根因是多个 bot 都可能拥有同一个 thread/alias 的 session,
topic模式把它们都放行了;同时飞书 bot mention 可能以app_id形态出现,旧 redirect 判断漏识别。影响面
im.message.receive_v1人类消息路径下的群聊/话题群路由。regularGroupMentionMode: topic和 shared-topic alias;never保持无条件响应语义不变。ambient保持原本“@ 别人让路”的语义,并补齐 app_id mention 形态。验证
pnpm vitest run test/event-dispatcher.test.ts:181 tests passedpnpm build:passed补充:当前环境跑完整
pnpm test有 12 个与本次改动无关的既有/环境失败:test/dashboard-create-session.test.ts的 role-resolver mock 缺resolveRoleInjectiontest/recall-frozen-cards.test.ts/test/terminal-url.test.ts受当前 dashboard tunnel URL 环境影响test/session-discovery.smoke.test.ts在本机/proccomm 读到MainThread而非node