You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Byte-capped Read reports prefix count as whole-file total #53230
The legacy Read tool reports a partial scan count as the whole-file total when it stops at the 50 KiB byte cap. For a 1,000-line file, it returns lines 1–506 with truncated: true but incorrectly reports totalLines: 507.
Steps to reproduce
Create a file containing 1,000 lines of 100 ASCII characters each, joined by newlines without a trailing newline.
Read it with the legacy Read tool from offset 1 with limit 2000.
Inspect the raw tool metadata: the returned range is 1–506 and continuation starts at 507, but totalLines is 507 instead of an unknown total.
Expected behavior
Omit totalLines when the byte cap prevents scanning to EOF. Report the exact total after a complete scan. Returned text and continuation offsets should stay unchanged.
OpenCode version
Source checkout dev at 907b3bc518fa48e90e8ec24dd327d13eee71c36c; Bun 1.3.14 test runtime.
The legacy Read implementation this report concerns was removed in v2.0.27. The v2 read tool returns the requested text, a truncation flag and a continuation offset, without a whole-file totalLines field, so this issue no longer applies. To get v2, run npm i -g @opencode/cli@latest. If you still see this on v2, please open a new issue with the details.
Activity
github-actions commentedon Oct 4, 2026
Thanks for updating the issue with clear reproduction steps and system details!
neriousy commentedon Oct 19, 2026
The legacy Read implementation this report concerns was removed in v2.0.27. The v2 read tool returns the requested text, a truncation flag and a continuation offset, without a whole-file
totalLinesfield, so this issue no longer applies. To get v2, runnpm i -g @opencode/cli@latest. If you still see this on v2, please open a new issue with the details.