Skip to content

[Feature]: Make the read_file page maximum configurable #3984

Closed

Description

@DennisWLX

Is your feature request related to a problem? Please describe.

#3821 added Unicode-safe pagination to read_file, with a default page size of 16,000 Unicode code points and a fixed maximum of 32,000. The output bound is useful, but applications cannot tune the maximum through HarnessAgent.Builder.

For example, an application with a larger context budget may request max_chars=64000 when reading a large file. The request is still clamped to 32,000, requiring additional continuation calls even when the application intentionally allows a larger page.

Describe the solution you'd like

Add an application-level HarnessAgent.Builder.readFileMaxChars(int) setting and a corresponding FilesystemTool constructor option:

HarnessAgent.builder()
        .model(model)
        .workspace(workspace)
        .readFileMaxChars(64_000)
        .build();

Preserve the existing behavior when the setting is omitted:

  • Default maximum: 32,000 Unicode code points.
  • Default page size when a tool call omits max_chars: 16,000.
  • Explicit max_chars requests are clamped to the configured maximum.
  • The configured maximum must be at least 16,000 so the default page size remains valid.
  • Unicode-safe char_offset continuation and line selection retain their existing behavior.
  • Automatically constructed general-purpose and declared subagents inherit the parent's setting.

With the maximum configured to 64,000, a tool call requesting 64,000 can receive that page size; omitting max_chars still uses 16,000.

Describe alternatives you've considered

  • Raising the fixed constant changes the limit for every application and still requires a framework change for the next adjustment.
  • Replacing the built-in filesystem tools requires applications to reproduce tool registration, path normalization, and subagent configuration propagation.
  • Removing pagination would lose the output bound introduced in fix(harness): bound read_file output with Unicode-safe pagination #3821.

Additional context

This is a follow-up to #3821. It keeps the existing defaults and pagination behavior while allowing applications to choose a maximum that fits their context budget. I have an implementation with behavior tests and matching English/Chinese documentation ready to contribute.

Activity

  1. added a commit that references this issue on Nov 5, 2026
    e40a11a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions