Problem
Native read_file output is limited by line count and per-line characters, but not by the active model's available input budget. The default path can return roughly 4 MB (2,000 lines x 2,000 characters), and an explicit limit can request even more. The complete result is then added to API conversation history, where it can exceed the model context window before recovery can run.
This was reproduced from #648 using the real read_file formatter.
Scope
Bound native textual read_file results before they are added to model-facing history.
- Derive the available read budget from the active profile's input capacity after accounting for current context, reserved output, and a safety margin.
- Apply an absolute ceiling so incorrect model metadata cannot permit an unbounded result.
- Clamp or reject explicit
limit values that would bypass the model-facing budget.
- Preserve useful line-range semantics and include a clear truncation marker with the returned range, original size, and continuation guidance.
- Cover ordinary text reads and native text extraction paths such as PDF/DOCX.
Acceptance criteria
Out of scope
- MCP output limiting
- Condensation-input sanitization
- Sliding-window recovery behavior
- Full-output spill files or resource references
- Aggregate budgeting across parallel tool calls
Estimate
1 story point. Independently mergeable and non-stacked.
Parent tracking issue: #648
Problem
Native
read_fileoutput is limited by line count and per-line characters, but not by the active model's available input budget. The default path can return roughly 4 MB (2,000lines x2,000characters), and an explicitlimitcan request even more. The complete result is then added to API conversation history, where it can exceed the model context window before recovery can run.This was reproduced from #648 using the real
read_fileformatter.Scope
Bound native textual
read_fileresults before they are added to model-facing history.limitvalues that would bypass the model-facing budget.Acceptance criteria
limitcannot bypass the budget.Out of scope
Estimate
1 story point. Independently mergeable and non-stacked.
Parent tracking issue: #648