Repository navigation
fix(mcp): 隔离外部工具名称并校验审批恢复来源 - #1220
Merged
Merged
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
按工具调用 ID 记录来源,拒绝执行无法证明来源的旧等待调用,无需重写历史检查点。保留现有出站授权,移除多余的标记、目录包装和停写 SQL,并明确回滚前的排空要求。
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.
简介
同一个 Agent 可以同时使用本地文件工具、管理员接入的 MCP 和动态插件。多个服务都声明
edit_file时,原来的工具目录会发生名称冲突,影响聊天或插件激活。外部 MCP 工具现在有稳定的模型别名;管理页和出站 MCP 请求仍使用协议原名。审批恢复按调用 ID 核对来源,缺少记录或来源不符时只拒绝该次调用,并返回工具错误供模型重新选择。
具体改动与影响
实现依据与设计取舍
关键行为与实现边界
命名规则用 slug 和协议原名构造模型别名;对歧义或不符合模型约束的名称使用独立摘要前缀。别名仅用于模型目录,不改变 adapter 的出站协议身份。来源记录不代替出站授权或个人 OAuth 的配置修订检查。
决策记录
外部 MCP 工具的模型名称
简化与删除验收
用逐调用记录替代 Turn 标记,移除恢复前额外检查点查询、目录包装、来源配置摘要及专用停写 SQL。核对了目录消费者、部署文档及 CI 引用;保留真实 PostgreSQL 检查点回归和回滚排空规程。
验证情况
行为验证
uv run --project backend --frozen --group test pytest <下列五个测试文件> -q -rs,102 项通过、4 项跳过。范围:backend/test/integration/services/{test_mcp_namespace_checkpoint,test_mcp_oauth,test_mcp_delegation_lifecycle,test_abridge_devices}.py和backend/test/integration/api/test_managed_abridge_browser.py。回读检查点与协议调用结果,覆盖旧历史续聊、旧等待调用拒绝后重选、相邻调用记录不能放行当前调用、撤权后零投递,以及同 slug 配置变更后按当前配置重新发现。uv run --project backend --frozen --group test pytest backend/test/unit -m 'not slow' -q:4,276 项通过,1 项需预置 OCR 模型目录的用例跳过。来源单测覆盖连接器或协议名变化、本地与远端互换及当前批次替换。提交检查
python3 scripts/ci/verify_engineering_contracts.py;python3 -m unittest scripts.ci.test_verify_engineering_contracts(56 项);uv run --project backend --frozen ruff check和ruff format --check(变更的后端文件);(cd docs && pnpm run build);git diff --check。独立审阅、风险与未验证范围
独立审阅
独立 Reviewer 审阅了需求、完整差异和验证范围,发现四处集成测试仍使用已移除的目录包装。已修正并重跑可用的隔离回归。
未验证范围与已知风险
docker compose exec api uv run --no-sync --group test pytest test/unit -m 'not slow'在解析部署配置时停止,已改用上列主机命令跑完整非慢单测。早期分支验证不计作本提交结果。