fix(session): 让 delete 与 daemon 关闭状态对齐#563
Open
kaopupengpeng wants to merge 2 commits into
Open
Conversation
deepcoldy
requested changes
Jul 22, 2026
deepcoldy
left a comment
Owner
There was a problem hiding this comment.
发现 1 个会造成“删除成功但实际没删”的兼容性问题,建议修复后再合并。其余 daemon-first、fail-closed、鉴权和 close barrier 方向均合理;本地 pnpm build 通过,8 个定向测试文件 175/175 通过。
closeSessionForDelete 原先在会话缺 larkAppId 且仅一个 daemon 在线时,
会把会话路由给该唯一 daemon。但 daemon 的 sessionStore.closeSession
只写当前 appId 的 sessions-<appId>.json,不会碰 legacy sessions.json,
导致 getSession 跨文件读到 wasOpen=true、closeSession 静默 no-op,
daemon 返回 {ok:true},CLI 不走本地收口,legacy 记录仍是 active。
修复:无 larkAppId 的会话一律走本地收口 closeSessionOffline,
其 saveSession 能正确写到 legacy sessions.json。
补回归测试:legacy 会话 + 单 daemon 在线 → CLI 不调 daemon、本地收口。
Owner
|
维护者跟进:已将修复提交 修复内容:缺少 复核结果:
原 P2 技术问题已修复;仍按话题约定,等待申晗对兼容性/端到端语义确认后再决定合并。 |
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.
背景
botmux delete原先只在 CLI 侧直接终止进程/tmux 并写入关闭状态,不会同步移除 daemon 内存中的activeSessions条目。删除当前会话时,如果先 kill 再通知 daemon,执行命令的 CLI 本身会随 backing session 一起退出,IPC 没有机会发出。方案
botmux delete先调用已有的POST /api/sessions/:sessionId/close,由 daemon 统一执行 worker/backend 回收、activeSessions删除、持久化关闭、订阅清理和生命周期事件。delete all将当前会话放到最后,避免自删除提前终止批处理。TUI 删除也走同一条路径。本 PR 不新增
botmux session close-self命令或新 IPC 路由。验证
corepack pnpm build通过。tsc --noEmit通过。git init -b失败;使用 Git 2.31 对对应的 3 个文件复跑为 31/31 通过。/procPID namespace 的进程发现与超时用例;已在未修改的origin/master(ec4d3407) 临时工作树上按相同签名复现 7/7。