fix(harness): mark optional FilesystemTool params as required=false#2227
Open
wzq-xzwj wants to merge 2 commits into
Open
fix(harness): mark optional FilesystemTool params as required=false#2227wzq-xzwj wants to merge 2 commits into
wzq-xzwj wants to merge 2 commits into
Conversation
read_file(offset,limit), grep_files(path,glob) and glob_files(path) are documented as optional and the AbstractFilesystem implementation already handles null/default values, but they lacked required=false and therefore appeared as required in the generated tool schema. Align the annotations with the descriptions and the implementation. Schema-only, no behavior change. Mirrors the existing edit_file.replace_all annotation.
a89f2f6 to
bd74c43
Compare
…potless The sessionId @ToolParam line exceeded the 100-column AOSP limit enforced by spotless:check, causing the build to fail on every PR touching this module. Wrap it as spotless expects. Formatting-only, no behavior change.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Several
@ToolParamparameters onFilesystemToolare documented as optional(their descriptions say "Default: ...", "Optional ...") and the underlying
AbstractFilesystemimplementation already handles missing / null / defaultvalues gracefully. However, they are not annotated with
required = false.Because
ToolParam.required()defaults totrue, these parameters end up in thegenerated JSON schema as required, contradicting both their descriptions and
the implementation.
Affected parameters:
read_fileoffsetread_filelimitgrep_filespathgrep_filesglobglob_filespathWhy this matters
Models calling these tools believe they must supply every parameter. In practice
this pushes the model to always pass a
globfilter togrep_files(narrowingresults unintentionally) or an explicit
offset/limittoread_file, and oftenleads models to prefer shell commands over the built-in tools. The mismatch
between the human-readable description ("Optional") and the schema ("required")
is confusing for both models and integrators.
Note:
edit_file'sreplace_allis already correctly annotated withrequired = false, which shows the intended pattern — the other optionalparameters were simply missed.
Implementation is already optional-safe
The backing implementation already tolerates missing values, so this is a
schema-only correction with no behavioral risk:
LocalFilesystem.grep(...):resolvePath(runtimeContext, path != null ? path : ".")LocalFilesystem.glob(...): handlespath == null→ falls back to cwdripgrepSearch/javaSearch:if (includeGlob != null && !includeGlob.isBlank())LocalFilesystem.read(...):int startIdx = Math.max(0, offset),limit > 0 ? ... : allChange
Add
required = falseto the five parameters listed above. No logic changes.Testing