fix(dashboard): 运行时热切 CLI 立即关闭存量失配会话 - #348
Merged
Merged
Conversation
#346 只在 daemon 重启的 restore 路径清理 CLI 失配会话;dashboard PUT /api/bot-agent 热改 cliId/wrapperCli 不重启 daemon,存量会话冻结的 旧 CLI 仍会被下一条消息 lazy resume 复活,要等下次重启才被清。 - session-manager 导出 closeCliMismatchedSessionsForBot(larkAppId): 按 bot 扫活跃会话,复用同一失配判定(含 wrapper 轴)关闭并连带杀 backing pane;豁免口径与 restore 一致(queued / adopt 不动) - restore 私有 helper 更名 closeActiveSessionIfCliMismatch(不再限 restore 语境),日志措辞同步中性化 - PUT /api/bot-agent 改完配置后调用清理,响应新增 closedMismatchedSessions 计数 - 测试:restore-zombie-close 新增 runtime sweep describe ×4(失配关闭/ wrapper 轴/豁免与跨 bot 隔离/registry 未初始化),15/15 绿
活 worker(运行时热切)场景由 closeSession 的 close IPC 让 worker 侧 优雅拆除 backing session;daemon 先硬杀 pane 会与 worker 退出处理赛跑。 预杀保留给 restore 守卫(ds 未进 registry、killWorker 摸不到 pane)与 worker-less 记录。补活 worker 用例断言不预杀。
killed 未置空的 worker 同样收不到 close IPC、无法优雅拆 backing, 与 !ds.worker 同等对待(Codex review 建议)。
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.
背景
#346 修复了「切换 CLI 后还唤起历史 CLI」,但只覆盖 daemon 重启路径(restoreActiveSessions 守卫)。dashboard 的
PUT /api/bot-agent热改 cliId/wrapperCli 不重启 daemon,存量会话冻结的旧 CLI 仍会被下一条消息(或 terminal 唤醒)lazy resume 复活,要等下次重启才被清理——review #346 时确认的 follow-up ①。改动
session-manager导出closeCliMismatchedSessionsForBot(larkAppId):按 bot 扫活跃会话 registry,复用 chore: 修复切换cli时,还会唤起历史cli的问题 #346 的同一失配判定(含 wrapper 轴),失配即关闭并连带杀 backing panecloseActiveSessionIfCliMismatch(不再限 restore 语境),日志措辞中性化PUT /api/bot-agent改完配置后调用清理,响应新增closedMismatchedSessions计数供 dashboard 展示/审计测试