Skip to content

feat(groups): 支持按群自动关闭无交互会话 - #1742

Merged
deepcoldy merged 2 commits into
deepcoldy:masterfrom
Vivapercuore:feat/group-idle-session-auto-close
Oct 12, 2026
Merged

deepcoldy merged 2 commits into
deepcoldy:masterfrom
Vivapercuore:feat/group-idle-session-auto-close

Conversation

@Vivapercuore

Copy link
Copy Markdown
Contributor

群组管理缺少按无交互时长关闭会话的设置。本次在「新话题默认模型」上方新增「无交互的会话自动关闭」卡片,按群内机器人分别配置,默认关闭,预填 1 天。时长支持正整数输入和原生数字步进,可切换天/小时。

配置保存到 bots.json,保存后用于本群已有和新建会话。后台根据最近一次消息时间检查空闲、休眠会话,并沿用现有关闭流程。执行中、等待确认、已锁定、接管、转移中以及持有待处理输入的会话会跳过;取得会话变更锁后再次检查配置和活动时间,避免检查期间的新消息被误关。前端和接口均校验正整数,保存失败会保留输入并显示错误。

影响范围:涉及 Dashboard、群级配置存储和 daemon 公共会话管理,不改动具体 CLI 适配器或平台进程实现。测试覆盖 pty、tmux、zmx、remote-runner 状态夹具,以及普通空闲会话、休眠会话和受保护会话。已在 macOS 验证;Linux、真实 CLI 进程和飞书环境尚未实测,也未部署或重启已有 daemon。

验证结果:

  • bun run build 通过,包含 TypeScript 检查和 Dashboard 打包。
  • 以下相关回归命令通过,共 15 个测试文件、288 项测试。
  • node scripts/verify-group-idle-close.mjs 通过。使用模拟数据验证实际页面组件的卡片顺序、默认关闭、整数与步进输入、单位切换、保存回显、失败提示、关闭开关和手机布局。
  • git diff --check 通过。
bun run test \
  test/group-idle-close.test.ts \
  test/group-idle-close-sweeper.test.ts \
  test/dashboard-group-idle-close.test.ts \
  test/ipc-group-idle-close.test.ts \
  test/group-serial-input-store.test.ts \
  test/dashboard-group-serial-input.test.ts \
  test/dashboard-group-default-models.test.ts \
  test/group-default-models-store.test.ts \
  test/groups-action-helpers.test.ts \
  test/dashboard-i18n.test.ts \
  test/session-cleanup.test.ts \
  test/idle-worker-sweeper.test.ts \
  test/bot-registry.test.ts \
  test/config-store.test.ts \
  test/dashboard-project-group-mode-ui.test.ts

桌面截图(模拟数据):

桌面群组管理卡片

手机截图(模拟数据):

手机群组管理卡片

@deepcoldy

Copy link
Copy Markdown
Owner

你好 @Vivapercuore,这个 PR 的自动评审群已经建好,首轮 review 正在进行。

你目前不在我们的自动拉群作者名单里,麻烦点击下面的链接自行加入评审群(一年有效):
https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=886p6604-f396-4c3b-b1e8-0befd280176e

也欢迎把 GitHub 账号和飞书信息补录到名单文档,后续你的 PR 会被自动拉进评审群:
https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe

(本条为自动化流程发送,评审意见最终以维护者审阅为准。)

GET /api/groups 随本特性对每个群返回 idleClose 默认值,
五处既有 toEqual 契约快照补齐该字段。

Co-Authored-By: Claude Code <noreply@anthropic.com>
@deepcoldy
deepcoldy merged commit 510588d into deepcoldy:master Oct 12, 2026
18 of 21 checks passed
@deepcoldy

Copy link
Copy Markdown
Owner

已合入 master(510588de1),感谢贡献 🎉

合入前在最新主干上补了一个纯测试修正:本特性给 GET /api/groups 的每个群新增了 idleClose 默认字段,既有 test/dashboard-ipc.test.ts 中 5 处契约快照(7 个群对象)需要同步补齐该字段,否则 bun 运行时下会失败。

非阻断的后续项(测试硬化、guard 结构、文档互指、真机验收)已集中记录在 #1838。

@github-actions

Copy link
Copy Markdown

🚀 Released in v3.42.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants