Avoid too long search results#57
Merged
Merged
Conversation
Contributor
yantar92
commented
Apr 18, 2026
- macher.el (macher--tool-search-helper): Respect `macher--max-read-length' when returning search results.
* macher.el (macher--tool-search-helper): Respect `macher--max-read-length' when returning search results.
Rename to `macher-max-tool-output-length' and convert from defconst to defcustom. The cap was already being applied by the read tool; making it customizable lets users tune the limit for their model's context window, and reusing it for other text-returning tools (in a follow-up) needs a name that isn't tied to the read tool. Change-Id: I3f799bd094f15df69bbcc772f722d60c4f7afde0
Apply `macher-max-tool-output-length' to the search and list-directory tools, which previously could dump unbounded amounts of text into the LLM context. Factor the check into `macher--check-output-length' and reuse it in the read tool for consistency. When the limit is exceeded, include the leading and trailing 256 bytes of the output in the error so the caller can see the structure of the truncated payload. Change-Id: I0eca3de190b510e00957eeeb47034ec6c1e91d79
Exercise the under-limit/at-limit no-op path, the over-limit error, the contents of the error message (description, sizes, head/tail previews), and the small-payload preview-shrinking branch. Change-Id: I6bab46f6d4d307f54592dac246525d8d4ce7109b
Exercise the under-limit/at-limit no-op path, the over-limit error, the contents of the error message (description, sizes, head/tail previews), and the small-payload preview-shrinking branch. Change-Id: I6bab46f6d4d307f54592dac246525d8d4ce7109b
Brings in the directory workspace type (kmontag#48), no-workspace user-error fix (kmontag#48), and the large/remote workspace perf fixes (kmontag#60). Resolved conflicts: - macher.el (macher--tool-read-file): kept main's perf-improved body that skips the redundant path resolution in macher--with-workspace-file, but used the new `macher--check-output-length' helper from this branch in place of main's inline length check. - tests/test-unit.el (macher--tool-search-helper): kept both `it' blocks added at the same spot (one from each side). Change-Id: I713522bc98a021f55cf186806c2f34de3d5592a3
Owner
|
thanks @yantar92! made a proper |
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.