Repository navigation
更新时自动关掉本根目录的 MCP 服务,不再拦下来让用户去关 - #309
Merged
Merged
Conversation
更新(管理器和命令行 modavd update 都走 update 包换包前的检查)扫描时,把本根 tools\modavd.exe 跑的 `mcp`(只带 --root=本根 / --json / --quiet / --verbose) 认作 MCP 服务:在 .update\mcp-exit\<pid> 写下它的进程创建时间请它退出,MCP 服务 每 0.5 秒查一次,对上了就照 EOF 的路径收尾(写文件的请求先做完)并在 stderr 说明 原因;更新这边最多等 40 秒,没退的按扫描时记下的 PID(核对创建时间和映像)强制 结束。持锁后的最终扫描若只剩新拉起的 MCP 服务,再关一次再扫。别的 modavd 命令行 照旧拦。ProgramsInUse、管理器提示、占用报错、命令行帮助、README 和 MACOS 文档 去掉要用户关 MCP 客户端的说法。 Refs ModAVD/ModAVD#461
Collaborator
总体结论:修改后合并以下仅供参考 更新主动请同一根目录的 MCP 退出,比让用户自己找进程省事。问题是这里认的是程序放哪儿,不一定是它正在管哪一套实例。 [逻辑 · P2] 更新 A 目录,可能关掉正在管理 B 目录的 MCP。阻断合并:是。 两套安装共用一份 CLI 时,MCP 可以通过环境配置选 B,实际启动就按解析出来的 B 建管理器。但更新侧把没有显式 自动退出只应对能核实实际工作根目录的服务生效。不能确认就按占用提示处理;单纯把监听换到 B 也不够,更新侧的超时结束路径仍得守住同一条件。补个双根目录回归,确认更新 A 不会断开管理 B 的服务。 dot酱敬上 |
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.
更新时自动关掉本根目录开着的
modavd mcp(AI 助手拉起的 MCP 服务),不再拦下来让用户去关。别的 modavd 命令行照旧拦。Refs ModAVD/ModAVD#461
做法
tools\modavd.exe(macOStools/modavd),命令行只有mcp加--json/--quiet/--verbose/--root,--root是绝对路径且就是本根(不带--root也算)。其余(别的根、别的命令、--help、多余参数、读不到命令行)照旧算占用。.update\mcp-exit\<pid>,内容是该进程的创建时间(防 PID 复用)。MCP 服务每 0.5 秒查一次,对得上就照 EOF 的路径收尾(写文件的调用先做完,最多 30 s),退出码 0,stderr 写一句原因。lockForSwap持锁后的最终扫描若只剩 MCP 服务(扫描和持锁之间新拉起的),在锁里再关一次再扫。macOS 的lockNativeSwap持锁后本来就会再跑一遍ensureNotInUse。ProgramsInUse不再算 MCP 服务;管理器更新提示、换包报错、modavd update帮助、README 和 MACOS 文档去掉「关掉 MCP 客户端 / AI 助手」。测试
stopMCPServers用假时钟覆盖自己退出、超时结束、PID 已复用、映像已变、结束失败;MCP 收到退出信号后照 EOF 收尾、删除做完才返回;ProgramsInUse和各处文案不含 MCP。tools\modavd.exe mcp --root <临时根>):真扫描认得出、收信号自己以 0 退出;不响应的超时后被按 PID 结束;整个Install能关掉它并换上新版;持锁后新拉起的也被关;别的命令行照旧被拦且不被动。--root核对、扫描不标 MCP、不写请求文件、超时不结束、ProgramsInUse不排除 MCP、MCP 端不响应退出信号,各自都有测试挂,已还原。没做的:
native_guard_darwin.go,要 cgo)在 Windows 上 vet 不到,等 macOS CI。