Repository navigation
tools: default Grep to content mode with a 200-line cap - #310
Merged
Merged
Conversation
A Grep call that named only a pattern returned matching paths, because output_mode defaulted to files_with_matches. Models that never pass a mode (grok, in the WI-1311 report) then saw no lines and reported the tool as returning no content. Content with line numbers is what a pattern-only call is asking for, so it is now the default, capped at 200 lines with the remainder counted; files_with_matches and count stay explicit and uncapped. Context flags (-A/-B/-C) also force line numbers, since context lines are unreadable without them. Measured: CGO_ENABLED=0 go build ./..., go vet ./..., go test ./internal/..., and make hermetic all pass. Assumed: nothing outside internal/tools depends on the old default — the only callers asserting bare paths were the tool's own tests, which now pass output_mode explicitly. Co-Authored-By: Klaudia <noreply@greenthread.ai>
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
output_modedefaulted tofiles_with_matches, so a call naming only a pattern returned paths. Models that never pass a mode (grok, WI-1311) saw no lines and reported the tool as returning no content.contentwith line numbers, capped at 200 lines with the remainder counted.files_with_matchesandcountstay explicit options and are uncapped.-A/-B/-Calso force line numbers.TestGrepDefaultIsContentWithLineNumbersAndCap; existing tests that asserted bare paths now passoutput_modeexplicitly.WI-1311. The cwd half of the original report is out of scope (removed at the source by WI-1298).
Test plan
CGO_ENABLED=0 go build ./...go vet ./...go test ./internal/...make hermetic