pref(tool):删除无用工具#678
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
| @@ -290,17 +273,6 @@ func (s *Service) executeOneToolCallWithoutPersistence( | |||
|
|
|||
There was a problem hiding this comment.
High: removing the CapturePostDelete handling here regresses per-edit restore coverage for the only remaining path that can rename files or delete directories: bash. BashLikelyWritesFiles/SourceFilesInWorkdir only pre-capture file-like tokens with recognized source extensions, so operations like mv assets/logo.png assets/logo.old, mv dir1 dir2, or rm -rf build/ no longer record the deleted side/tree in the snapshot store. After such a command, restoring a checkpoint cannot recreate the source path or directory contents, which is a behavior change from the removed dedicated tools.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Closes: #677
摘要
删除
filesystem_move_file、filesystem_copy_file、filesystem_create_dir、filesystem_remove_dir四个已不再被模型调用的死代码工具,同步清理所有关联代码路径,净删除约 1700 行。动机
四个工具在当前的 ReAct 链路中已无实际调用:文件移动/复制通过
filesystem_write_file直接写入目标路径完成,目录操作由bash兜底。但它们仍然存在于工具注册表、提示词、权限映射、Runtime 写入检测链路和前端文件变更面板中,每次请求都被携带且维护着不会命中的分支逻辑。变更清单
删除 (8 文件)
internal/tools/filesystem/move_file.go+_test.gointernal/tools/filesystem/copy_file.go+_test.gointernal/tools/filesystem/remove_dir.go+_test.gointernal/tools/filesystem/create_dir.go+_test.go工具注册与常量
internal/tools/names.go: 移除 4 个ToolNameFilesystem*常量internal/tools/filesystem/helpers.go: 移除 4 个本地工具名常量internal/tools/permission_mapper.go: 移除 4 个权限映射 caseinternal/app/bootstrap.go: 移除 4 个Register()调用internal/runner/runner.go: 移除 4 个Register()调用Runtime 链路
internal/runtime/toolexec.go:remove_dir递归预捕获逻辑(filepath.WalkDir)RemoveDir/MoveFile的CapturePostDelete分支isFileWriteTool: 7→3 个 casetoolCallTouchedPaths: 去掉 switch 分支,统一从path字段解析internal/runtime/run.go: 更新过时注释Context 与 Pin 策略
internal/context/pin_checker.go: 从defaultPinToolNames移除 copy/move提示词
internal/promptasset/templates/core/tool_usage.md: 移除 4 行工具使用指令前端
web/src/utils/eventBridge.ts:FILE_WRITE_TOOLS5→3 个,移除_trackFileChangeFromTool中 move/copy 双路径分支文档
docs/architecture/architecture-v1.md: 移除 4 个工具行测试
同步修剪
tool_metadata_test.go、helpers_test.go、format_test.go、pin_checker_test.go、microcompact_test.go、tool_diff_helpers_test.go、per_edit_snapshot_test.go、eventBridge.test.ts中的相关用例。测试计划
go build ./...— 通过go test ./internal/tools/...— 通过go test ./internal/runtime/...— 通过go test ./internal/context/...— 通过go test ./internal/checkpoint/...— 通过go test ./internal/app/...— 通过go test ./internal/runner/...— 通过ToolNameFilesystemMoveFile、filesystem_move_file等均无匹配)影响面
filesystem_write_file覆盖文件移动/复制能力