tool/workspaceexec: add workspace-scoped file tools sharing workspace_exec state#1683
tool/workspaceexec: add workspace-scoped file tools sharing workspace_exec state#1683bytethm wants to merge 1 commit into
Conversation
…_exec state Introduce six file tools (workspace_read_file, workspace_list_dir, workspace_search_file, workspace_search_content, workspace_write_file, workspace_replace_content) that operate on the same invocation-scoped workspace as workspace_exec. They reuse the WorkspaceRegistry, resolver, and reconcile layer added in trpc-group#1660, and refuse to write framework-managed paths (work/inputs/**, skills/**, and WorkspaceBootstrapSpec.Files targets). Expose them through an opt-in llmagent.WithWorkspaceFileToolsEnabled option. Extend WorkspaceExecRequestProcessor to compose exec and filetools guidance so both surfaces receive consistent instructions, including write-protection and truncation semantics.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (68.49530%) is below the target coverage (85.00000%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1683 +/- ##
===================================================
- Coverage 88.49296% 88.33852% -0.15444%
===================================================
Files 860 862 +2
Lines 169896 171119 +1223
===================================================
+ Hits 150346 151164 +818
- Misses 14237 14543 +306
- Partials 5313 5412 +99
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| f := files[0] | ||
| content := []byte(f.Content) | ||
| if int64(len(content)) > maxBytes { | ||
| content = content[:maxBytes] |
There was a problem hiding this comment.
Capping raw bytes here can split a UTF 8 rune, so a valid large text file starts failing workspace_read_file and workspace_search_content as not text. Please trim the capped buffer to the last complete rune before returning it.
中文
这里直接按字节截断会切开 UTF 8 rune,合法的大文本会让 `workspace_read_file` 和 `workspace_search_content` 被误报为非文本。请在返回前把截断结果回退到最后一个完整 rune 边界。| out.FilesSkipped++ | ||
| continue | ||
| } | ||
| out.FilesScanned++ |
There was a problem hiding this comment.
max_files is described as an inspect cap, but skipped unreadable files do not increment FilesScanned here. A tree full of skipped files can bypass the limit and still return a later match with truncated=false, so please count inspected files before read and validation.
Introduce six file tools (workspace_read_file, workspace_list_dir, workspace_search_file, workspace_search_content, workspace_write_file, workspace_replace_content) that operate on the same invocation-scoped workspace as workspace_exec. They reuse the WorkspaceRegistry, resolver, and reconcile layer added in #1660, and refuse to write framework-managed paths (work/inputs/, skills/, and WorkspaceBootstrapSpec.Files targets).
Expose them through an opt-in llmagent.WithWorkspaceFileToolsEnabled option. Extend WorkspaceExecRequestProcessor to compose exec and filetools guidance so both surfaces receive consistent instructions, including write-protection and truncation semantics.