Files
mnote/bugs/07-ai/done/7-62-page-ai-pi-rust-builtin-tools-overreplacement-v1.md
Agent Board d47f6447fd fix: restore pi rust builtin tool surface
- expose Pi Rust built-in tools by permission mode instead of replacing them with MNote file tools
- update Pi Lab smoke coverage for native ls/read/bash usage
- document the overreplacement regression and verification evidence
2026-07-11 20:34:21 +08:00

40 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 7-62 Page AI Pi Rust 内置工具被 MNote 工具过度替代
## 状态
- 已修复
- 日期:2026-07-11
- Owner`07-ai`
## 症状
Pi Lab 切到 `pi_agent_rust` 后,普通对话可用,但文件/目录类任务会退化为只看到 `mnote_local_file_read` / `mnote_local_file_patch` 等 MNote bridge 工具。用户要求列目录或删除测试文件时,模型会判断“没有删除工具”“不能直接列目录”,甚至尝试把 MNote read 当作文件系统能力。
## 根因
MNote 启动 Pi Rust RPC 时固定传 `--tools <allowlist>`。此前 allowlist 主要由 MNote bridge 工具组成,Pi Rust 官方 8 个内置工具只有在旧外部 `pi-permission-system` 条件下才会加入。当前默认使用本地官方 `permission-gate` 镜像时,这个条件不成立,导致 `read/write/edit/hashline_edit/bash/grep/find/ls` 被系统性裁掉。
这和 Pi Rust 官方定位冲突:Pi Rust 的文件、搜索和 shell 能力应由 Pi 原生 builtins 承载,MNote 只补当前页、allowed roots、URL/reference、知识库和宿主上下文。
## 修复
- `full_access`:恢复 Pi Rust 官方 8 个 builtins`read/write/edit/hashline_edit/bash/grep/find/ls`
- `auto_edit`:开放读写编辑和检索类 builtins,但不开放 `bash`
- `plan`:仅开放只读 builtins`read/grep/find/ls`
- `mnote_allowed_roots_describe` 返回的 `managedPiBuiltinTools` / `deniedPiBuiltinTools` / `permissionProvider` / `note` 按 permission mode 精确说明,避免继续诱导模型把 MNote file tool 当主文件系统工具。
- full_access smoke 改为要求真实调用 Pi Rust `ls/read/bash`,并断言不调用 `mnote_local_file_read` / `mnote_local_file_patch`
## 验证
- `node scripts/task-pi-lab-static-smoke.js`246 checks passed
- `node --check scripts/task-pi-lab-full-access-builtin-delete-smoke.js`
- `node --check scripts/task-pi-lab-static-smoke.js`
- `node --check scripts/task-pi-lab-rpc-api-smoke.js`
- `node --check scripts/task-pi-lab-user-exact-web-smoke.js`
- `cargo test -p mnote-web page_ai_pi::tests::permission_modes_expose_pi_builtins_by_mode -- --nocapture`passed
- `cargo test -p mnote-web page_ai_pi::tests::start_uses_ai_settings_for_model_skills_mcp_and_tools -- --nocapture`passed
## 遗留
`confirm` 模式仍未接入 Pi Rust 原生 tool approval 流;在 MNote 能可靠承接 approval 前,不应把 `bash/write/edit` 暴露给 confirm 模式并假装已有审批闭环。