fix(grep): honor head_limit values above 100#31
Open
T0mSIlver wants to merge 1 commit into
Open
Conversation
The head_limit clamp read 'if head_limit < limit and head_limit > 0', so any value >= 100 was discarded and the cap stayed at 100 — the model could never raise the limit despite the schema saying it shows all results. Honor any positive head_limit, document that output is capped at the first 100 lines when head_limit is omitted, and add a regression test.
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.
Problem
The schema says
head_limitlimits output to the first N entries. The clamp was:Because of the
head_limit < limitguard, any value >= 100 was silently ignored and the cap stayed at 100 — the model could never raise the limit. (The test even passeshead_limit: 200and gets 100.) The schema also claimed unspecified means "shows all results from ripgrep", which was never true.Fix
head_limit, including values above 100.head_limitis omitted, and update the schema description to state that accurately.test_grep_head_limit(hermetic, 250-line file) assertinghead_limit=150is honored and an omitted value falls back to 100. This test fails against the old clamp.Paper reference
The paper defines
head_limitas "Limit output to the first N lines or entries" (FastContext paper (arXiv:2606.14066), Appendix E "FastContext Explorer: Tool Schemas", p. 19), confirming N must be honored. The paper specifies no hard cap and no "shows all results" behavior — the 100-line default applied whenhead_limitis omitted is an implementation choice (judgment call), not from the paper.