Skip to content

fix(filesystem): support ranged file reads - #3895

Merged
Sayt-0 merged 1 commit into
mainfrom
fix/3889-read-file-ranges
Aug 3, 2026
Merged

fix(filesystem): support ranged file reads#3895
Sayt-0 merged 1 commit into
mainfrom
fix/3889-read-file-ranges

Conversation

@Sayt-0

@Sayt-0 Sayt-0 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Summary

  • add optional 1-based line and positive limit arguments to read_file
  • stream selected text ranges while preserving rooted filesystem access and total line metadata
  • forward and validate ranges through ACP
  • retain the head of oversized built-in read_file results and provide actionable continuation guidance
  • preserve tail truncation for shell, MCP, A2A, and other filesystem tools

Fixes #3889.

Issue expectations

Expectation Implementation
Large files can be read incrementally read_file accepts ACP-aligned line and limit arguments
Document orientation is not discarded oversized built-in read_file results retain the head instead of the tail
Truncation is recoverable the notice identifies the next line for a follow-up ranged read
Spill-file guidance is truthful a line over the byte cap reports that line ranges cannot advance within it and recommends a byte-range-capable tool
Log-oriented output keeps recent context shell, MCP, A2A, and other tools retain tail truncation
ACP behavior matches the built-in tool ACP validates and forwards line and limit

The issue's smaller suggestions about directory-entry byte sizes and edit_file replacement semantics are intentionally left for separate changes.

Validation

Check Result
focused filesystem, hook, and ACP tests pass
race tests for affected packages pass
task lint pass
task build pass
task check-plan-cross pass
affected OpenAI, Anthropic, Gemini, and Mistral cassette replays pass
documentation lint and build checks pass
compiled CLI E2E with a 109,900-byte file and deterministic local model endpoint pass

The compiled CLI E2E verified the full model/tool loop: the first read retained front matter and suggested line 88, subsequent ranged reads progressed through the file and reached its tail, and the command exited successfully. The same scenario on the baseline commit retained only the tail and provided no ranged-read recovery.

The repository-wide test run reaches unrelated, environment-dependent failures in existing non-public-address/SSRF tests because this host routes private addresses instead of rejecting them. The affected packages and cassette tests pass independently.

Add ACP-aligned line and limit arguments to read_file and preserve the head of oversized read results with actionable continuation guidance. Keep tail truncation for shell and external tools.

Fixes #3889
@Sayt-0
Sayt-0 requested a review from a team as a code owner August 3, 2026 12:41
@aheritier aheritier added area/core Core agent runtime, session management area/docs Documentation changes area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/fix PR fixes a bug (maps to fix:). Use on PRs only. labels Aug 3, 2026
@Sayt-0
Sayt-0 merged commit dd10818 into main Aug 3, 2026
21 of 23 checks passed
@Sayt-0
Sayt-0 deleted the fix/3889-read-file-ranges branch August 3, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Core agent runtime, session management area/docs Documentation changes area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/fix PR fixes a bug (maps to fix:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

read_file: no ranged read, and tail-only truncation makes large documents unreadable rather than partially readable

3 participants