Skip to content

feat(harness): make read_file page maximum configurable - #3985

Merged
jujn merged 2 commits into
agentscope-ai:mainfrom
DennisWLX:codex/configurable-read-file-max-chars
Nov 5, 2026
Merged

jujn merged 2 commits into
agentscope-ai:mainfrom
DennisWLX:codex/configurable-read-file-max-chars

Conversation

@DennisWLX

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT, based on commit 3ed55c5701be625dfcc8200ac5f45d55652713d7.

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.

- 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.

Evidence

  • Before: max_chars=64000 is clamped to the fixed 32,000-code-point maximum.
    After: configuring .readFileMaxChars(64_000) permits a 64,000-code-point page. Behavior tests exercise the registered tool on the parent and both built-in subagent types.
  • Tests also cover the minimum valid configuration, invalid configurations, unchanged default page size, clamping above the configured maximum, and lossless Unicode page reconstruction.
  • Targeted tests: 119 tests, no failures, errors, or skips.
  • Full reactor clean verify: passed, including Spotless. Surefire XML reports contain 11,935 tests, 248 skipped, no failures or errors. Run with JBR 21.0.11 and Maven 3.9.16; Java source/target remains 17.

Commands run from the repository root, using a separate local revision for build artifacts:

mvn -B -T1C -pl agentscope-harness -am test -Drevision=2026.11.05-read-file-max-chars-SNAPSHOT -Dtest=BoundedFileReadTest,FilesystemToolTest,HarnessAgentTest
mvn -B -T1C clean verify -Drevision=2026.11.05-read-file-max-chars-SNAPSHOT

Documentation checks from docs/: npm test passed (13 tests), the local syntax/navigation/link/asset check passed (432 pages and 584 redirects), and npm run broken-links passed. npm run validate reached Mint's strict build validation but failed inside p-cancelable with The onCancel handler was attached after the promise settled on Node 24.22.1. A Node 22 recheck could not run because downloading that runtime timed out. The strict docs validation gap remains explicit for CI/review.

Merge Danger

Door: Two-way. Additive configuration and constructor support; no persisted-state changes.

Blast Radius: Harness. File read output limits on agents that configure the new setting and their automatically constructed subagents.

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

Add a builder setting and compatible FilesystemTool constructor for the
read_file page maximum while retaining the 16000/32000 defaults.
Propagate the setting to automatically constructed subagents and cover
configuration validation and Unicode-safe pagination with behavior tests.
Update the English and Chinese filesystem documentation.

Closes agentscope-ai#3984.
@mintlify

mintlify Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit cfe8ce3.

Approve preview

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jujn
jujn merged commit e40a11a into agentscope-ai:main Nov 5, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Make the read_file page maximum configurable

3 participants