Skip to content

Force full file reads for files under 2000 lines#2271

Merged
hiroshinishio merged 1 commit intomainfrom
wes
Feb 18, 2026
Merged

Force full file reads for files under 2000 lines#2271
hiroshinishio merged 1 commit intomainfrom
wes

Conversation

@hiroshinishio
Copy link
Collaborator

@hiroshinishio hiroshinishio commented Feb 18, 2026

Summary

  • Updated get_remote_file_content tool description to instruct GA to always read full files by default, only using start_line/end_line for files over 2000 lines
  • Added hard enforcement in the implementation: when a file has fewer than 2000 lines, all truncation parameters (line_number, keyword, start_line, end_line) are silently ignored and the full file is returned
  • Updated 10 existing tests to use 2001-line files so truncation behavior is still tested for large files, and added 2 new tests verifying truncation params are ignored for small files

Context

Root cause investigation of two failing SpiderPlus PRs (#13636, #13638) revealed that GA (Opus 4.6) truncated file reads - reading only the first 60 lines of a 460-line file and missing required data starting at line 87. The model decided to truncate, and we can't control that decision. So we removed the option entirely for files under 2000 lines - the tool now ignores truncation params and returns the full file regardless.

Social Media Post (GitAuto)

If you give an LLM a "read partial file" option, it will use it - even on a 460-line file it needs to fully understand. Our agent read only the first 60 lines and missed required fields at line 87. LLMs are lazy with context the same way devs are lazy with docs. The fix: don't offer the shortcut. Files under 2000 lines now always return in full, truncation params silently ignored.

Social Media Post (Wes)

LLMs try to optimize token usage by reading partial files. Our agent read 60 lines of a 460-line file and missed critical data at line 87. Can't fix the model's laziness, but you can remove the footgun. We silently ignore truncation params for files under 2000 lines now. If you're building tools for LLMs and they keep missing context, check if you're giving them a way to skip it.

@hiroshinishio hiroshinishio self-assigned this Feb 18, 2026
@hiroshinishio hiroshinishio merged commit cddc1fb into main Feb 18, 2026
1 check passed
@hiroshinishio hiroshinishio deleted the wes branch February 18, 2026 22:32
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.

1 participant