Repository navigation
fix(harness): bound read_file output with Unicode-safe pagination - #3821
Merged
jujn merged 1 commit intoOct 29, 2026
Merged
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
wzq-xzwj
marked this pull request as ready for review
October 28, 2026 03:24
This was referenced Oct 29, 2026
Open
jujn
approved these changes
Oct 29, 2026
This was referenced Nov 5, 2026
jujn
pushed a commit
that referenced
this pull request
Nov 5, 2026
## Description Closes #3984. ### Summary After #3821, a `read_file` call requesting 64,000 Unicode code points is always clamped to 32,000. Applications with larger context budgets cannot adjust that maximum through the Harness builder. ```diff - Math.min(maxChars, MAX_READ_CHARS) + Math.min(maxChars, readFileMaxChars) ``` Add `HarnessAgent.Builder.readFileMaxChars(int)` and a matching `FilesystemTool` constructor. The maximum defaults to 32,000 and must be at least 16,000. A tool call omitting `max_chars` still reads 16,000; requests above the configured maximum are paginated as before. Automatically constructed general-purpose and declared subagents inherit the setting. Existing constructors, Unicode-safe continuation, and line selection remain compatible. Update the tool description and English/Chinese filesystem documentation.
This was referenced Nov 10, 2026
Closed
jujn
pushed a commit
that referenced
this pull request
Nov 13, 2026
## Description Fixes #4098 `session_search` only caps the number of matches (#3270), not their size. Each match embeds a whole stored message, so a handful of matches can exceed the eviction threshold. Because `session_search` was in `ToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS`, such results were never offloaded and could push the next model request over budget. Changes: - Remove `session_search` from `ToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS`. Results under the threshold (80K chars by default) are unchanged; larger ones get the usual head/tail preview and a `read_file` pointer. Long single-line offload files are readable since #3821. - Update the `SessionSearchTool` comment that relied on the exclusion. - Update the default exclusion list in `docs/v2/{en,zh}/docs/harness/context.md`. The prune exclusion in `CompactionConfig.PruneConfig` is left unchanged: once a large result is offloaded, only the preview stays inline.
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.
Closes #2951.
read_file(offset=0, limit=1)can currently return an arbitrarily long single line. Reading an offloaded browser snapshot without line limits also puts the entire artifact back into context, while read_file is excluded from default result eviction.Bound returned file content to 16,000 Unicode code points by default, with an explicit hard maximum of 32,000. Optional
char_offsetpages within the selected line range; truncation guidance supplies the next offset. Existing line selection and the four-argument Java entry point are preserved, and only the new overload is registered as a tool. Small results remain unchanged. EN/ZH documentation explains pagination, stable-file assumptions and encoded binary data.Validation:
mvn -B -T1C clean verifyattempted. Initial attempt hit a Maven dependency TLS handshake error; retry reached 2,830 core tests (0 assertion failures, 2 errors, 9 skipped). Both errors are existingDangerousPathBypassTestsymlink creation cases requiring Windows privileges. The reactor stopped before the remaining modules, so this is not a passing local full build.broken-linksreports 2,218 links across 326 files on Windows, despite the repository's local-link checker and Mintlify build validation passing. This PR adds no links or headings; the reported links were not modified. This separate check is not claimed as passing.This is an output bound, not a bound on filesystem backend allocation/I/O or total model-request tokens. Pagination can still accumulate context over many reads. It does not attempt to backport the separate 2.1 streaming recovery changes to 2.0.x.