Repository navigation
fix(dashboard): Bot 配置页分开显示当前绑定群数和自动绑定过的群数 - #2118
Merged
Merged
Conversation
名字行右侧原来的「已自动绑定 N 个群」取的是 defaultOncallAutoboundChats 的长度。 这个列表记的是「自动绑定机会已经用过」的群:自动绑定过的、执行过 /oncall unbind 的、切出 Oncall 值班模式时被释放的都在里面,不是当前绑定数,容易被读成群都还绑着。 - daemon 的 GET /api/bot-default-oncall 新增 oncallChatCount(oncallChats 条数, 与 findOncallChat 一样按 bots.json mtime 刷新,能看到 create-group 等别的进程写的绑定) - 页面改为「当前绑定 M 个群 · 自动绑定过 N 个群」,带悬浮说明:累计数不是当前绑定数, 已解绑或切模式释放的群不会再自动绑定,需要在群里 /oncall bind <目录> - 旧 daemon 不回 oncallChatCount 时只显示「自动绑定过 N 个群」,不补 0、不拿累计数顶替 - 不改 bots.json 数据结构和绑定行为 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 21, 2026 17:19
- 当前绑定数 > 0 时即显示(只有手动绑定、自动绑定名单为空的 bot 原来看不到); 名单为空时不显示「自动绑定过」和悬浮说明,两个数都没有时仍不显示 - 悬浮说明不再称其为「累计数」:手动 /oncall bind 会把群移出名单,这个数会变小; 英文标签同步改为 auto-bound before - getBotDefaultOncall 注释删掉「auto-bind 判定也在用」的旧说法(实际只有 IPC 路由调用) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…l-chat-counts Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
Author
|
已合并 →
Follow-up(不阻断,另行处理)
未做:发版、部署。 |
|
🚀 Released in v3.49.0 |
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.
改了什么
Dashboard → Bot 配置页,bot 名字那一行右侧原来显示「已自动绑定 N 个群」,N 取的是
defaultOncallAutoboundChats的长度。这个列表记的是「自动绑定机会已经用过」的群:自动绑定过的、在群里执行过/oncall unbind的、切出「Oncall 值班模式」时被释放的群都在里面(见src/services/oncall-store.ts),不是当前绑定数。线上有用户(3.47.0)看到计数 1052,以为这些群都还绑着,实际早已解绑,排查时误判成了权限问题。现在改为:
oncallChats的条数,N 仍是原来那个数(自动绑定名单的长度)。?):「自动绑定过」不是当前绑定数,而是自动绑定名单里的群数——自动绑定过的群、在群里执行过/oncall unbind的群会记进名单,手动/oncall bind后移出;名单里已解绑、或切出「Oncall 值班模式」时被释放的群不会再自动绑定,需要在群里发/oncall bind <目录>重新绑定。create-group --working-dir绑定的)现在也显示「当前绑定 M 个群」,不带「自动绑定过」和悬浮说明。两个数都为 0 时不显示。0 chats bound now · 1052 chats auto-bound before)。实现:
bot-registry.ts新增只读的listOncallChats(appId):与findOncallChat一样,先按 bots.json 的 mtime 刷新再取,能看到botmux create-group --working-dir等别的进程写入的绑定。oncall-store.getBotDefaultOncall多返回oncallChatCount;daemon 的GET /api/bot-default-oncall把它带给 Dashboard。bot-payload.ts透传;旧 daemon 不回这个字段时为null。OncallChatCounts组件。不变的部分
影响面
bot-registry.ts只新增一个只读导出;oncall-store.getBotDefaultOncall的唯一调用方是这个 IPC 路由;IPC 响应只多一个字段。__dirname,编译态不受影响。getBotDefaultOncall的注释顺手删掉了「auto-bind 判定也在用」的旧说法(实际唯一调用方是这个 IPC 路由)。验证
新增 / 修改的测试:
test/dashboard-oncall-chat-counts.test.ts:两个数各自映射到对应文案、不互相顶替;旧 daemon(null / 缺字段)只显示名单数;只有手动绑定时只显示当前绑定数、不带悬浮说明;两个数都没有时不显示;英文下胶囊和悬浮说明都切成英文。期望文案从翻译表取,不钉措辞。test/oncall-store.test.ts:/oncall unbind和切出 oncall 模式只让当前绑定数变少,累计列表不变;别的进程写进 bots.json 的绑定也计入。test/dashboard-bot-payload.test.ts:透传oncallChatCount,旧 daemon 缺字段时为null。test/dashboard-ipc.test.ts:GET /api/bot-default-oncall同时返回autoboundChatCount=3、oncallChatCount=1。变异验证 10 处(都在最终 head 上重跑过),全部变红:IPC 回传名单长度、不刷新磁盘只读内存、组件两个数互换、旧 daemon 补成 0、payload 缺字段补 0、去掉悬浮说明、回到只看名单数的显示条件、只有手动绑定时也带悬浮说明、名单为空也显示「自动绑定过 0」、两个数都为 0 也显示。
全量单测交给 CI 跑。
同步 master(只有 merge,没有手改)
为了带上 #2124(codex-app-threads 偶发根治)把最新 master 普通 merge 进来,没有 rebase、没有 force-push:
2698c24256(merge commit),父提交 = 上轮评审过的4c26481adf+ masterb32c560a3。git show --remerge-diff --format= 2698c24256输出为空(实际提交与 git 自动合并结果逐字相同);git rev-parse 2698c24256^{tree}=git merge-tree --write-tree 4c26481adf b32c560a3=774142027c;4c26481adf相对其基线的 patch-id 相同。bunx tsc --noEmit -p .通过;test/dashboard-oncall-chat-counts.test.ts、test/dashboard-bot-payload.test.ts、test/oncall-store.test.ts、test/dashboard-i18n*.test.ts共 508 passed;test/dashboard-ipc.test.ts -t "oncall chat counts"1 passed。截图(合成数据,用真实构建的 Dashboard + 假 API 渲染)
改前:
改后(悬浮说明展开):
英文:
暗色:
只有手动绑定的 bot:
移动端(390px):
🤖 Generated with Claude Code