fix(fork): 修正 fim_edit 与 update_plan 的 capability 标志 - #5
Open
asto18089 wants to merge 1 commit into
Open
Conversation
- fim_edit 实际原子写回目标文件(execute 步骤 7 write_atomic), 删除自相矛盾的 ReadOnly 声明;WritesFiles 保留,repo_law 写门 控(repo_law.rs WRITE_TOOLS)依赖其写工具身份,已有注释佐证 - update_plan 只写内存会话计划状态(锁 plan_state 更新快照), 不写文件系统,删除 WritesFiles 声明;ToolCapability 文档语义 明确为 "Tool writes to the filesystem" - 各补一条 capability 回归断言 生产面影响分析:两工具的 approval_requirement 均为显式覆盖 (Suggest/Auto),不走 capabilities 默认推导;is_read_only 前后 取值不变;repo_law 门控按工具名不按 capability;command_palette 标签朝正确方向修正。todo/checklist 系列同为内存状态却声明 WritesFiles,属同类问题,留待后续单独决策。 Signed-off-by: asto <asto18089@126.com>
|
Thanks @asto18089 for taking the time to contribute. This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered. Please read |
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.
背景
提示词审查(#4)的附带核查发现两处工具 capability 标志与
ToolCapability文档语义矛盾:ToolCapability::ReadOnly文档语义:"Tool only reads data, never modifies state."ToolCapability::WritesFiles文档语义:"Tool writes to the filesystem."变更
fim_edit:声明[ReadOnly, WritesFiles, RequiresApproval],但execute步骤 7 实际write_atomic写回目标文件——ReadOnly自相矛盾,删除。WritesFiles保留且必须保留:repo_law.rs的WRITE_TOOLS注释明确记载 "fim_edit was such a hole (it declares WritesFiles, takes apath, andfs::writes to it)",写门控依赖其写工具身份。update_plan:声明[WritesFiles],但execute只锁plan_state更新内存快照(_context均未使用),不写任何文件,删除WritesFiles。生产面影响分析(为何安全)
approval_requirement都是显式覆盖(fim→Suggest,plan→Auto),不走capabilities()的默认推导,审批行为不变。is_read_only()前后取值不变(fim 含WritesFiles本就为 false;plan 不含ReadOnly本就为 false)。repo_law门控按工具名(WRITE_TOOLS)而非 capability,不受影响。filter_by_capability无生产调用方(仅测试);plan 模式工具门控按名字段(tool_catalog.rs、engine/tests.rs的plan_state_tools排除清单)而非 capability。command_palette的工具标签朝正确方向修正(fim 不再可能被误标 read-only 路径——实际该路径本就因is_read_only为 false 不可达;plan 不再显示 "writes" 标签)。验证
cargo test -p codewhale-tui fim/plan/plan_mode/forkguard_ --lib全过(新增 2 条断言通过;plan 模式注册测试 11 项全过)cargo clippy -p codewhale-tui --lib无新增告警./scripts/fork-guard.sh --fast指纹层全过repo_law::模块 8 项失败为 macOS TempDir 符号链接(/var→/private/var)导致的环境性既有失败,在未改动基线pinvou3-clean上复现完全一致,与本次改动无关已知风险与后续
todo_add/todo_update/todo_write(checklist/work_update 别名同理)同样只写内存状态却声明WritesFiles,属同类问题;engine/tests.rs的 plan 模式测试已将这批"plan state tools"按名排除,说明维护者知情。改动面更大,留待后续单独决策,本 PR 不动。docs/fork-modifications.md。Signed-off-by: asto asto18089@126.com