fix(mcp): 保留网关标记间的 Codex 信任配置 - #1376
Open
Ginufet wants to merge 1 commit into
Open
Conversation
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.
背景
Codex CLI 审批 Hook 后,会将
hooks.state写入用户级 TOML。实测新表可能插入 BotMux MCP Gateway 结束注释之前。旧逻辑更新 Gateway 时按注释起止位置删除整个块,误删信任记录,导致botmux start后原生 Codex 和 Bot 会话再次要求审批。Closes #1375
改动
stripCodexBotmuxSections删除 BotMux 自己的 MCP 表和子表。影响范围
实际验证
构建工具 Bun 1.4.2,依赖通过
bun install --frozen-lockfile安装。bun run test -- test/plugin-mcp-gateway-installer.test.ts test/plugin-manifest-store.test.ts test/plugin-mcp-sandbox.test.ts test/bypass-codex-hook-trust-config.test.ts bun run build BOTMUX_VERIFY_BAKED_VERSION=3.21.0-hooktrust.89eb378c bun run build:bun --target bun-linux-x64 node scripts/smoke-bun-binary.mjs dist-bin/botmux-linux-x64 git diff --checkbotmux restart;确认新安装的 SHA-256 与构建产物一致,daemon 和 Dashboard 均 online。hooks.state的原有信任哈希保留,且位于 Gateway 标记块外。此检查没有关闭 Hook 审批,也没有重新授予信任。效果
当 Codex 在 Gateway 注释块中插入其他表时,下一次 Gateway 更新或移除不再把这些表一并删除。已丢失的信任记录不会凭空恢复,需要用户正常审批;仍存在的记录会被保留。