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
Read tool 50 KB byte cap undocumented in tool description - AI may edit based on incomplete content #30773
The Read tool at packages/opencode/src/tool/read.ts has a 50 KB byte cap (MAX_BYTES = 50 * 1024 at line 17) on total output, in addition to the documented 2000-line limit. However, the tool description in packages/opencode/src/tool/read.txt only mentions the line limit:
By default, this tool returns up to 2000 lines from the start of the file.
The 50 KB byte limit is NOT mentioned. This means an AI told "up to 2000 lines" may believe it has the full file content when lines 166-175 actually cut off output early due to the byte cap. For example, a TypeScript file with approximately 400 lines of 130-byte width (typical for long function signatures, template literals, etc.) would hit 50 KB before reaching 2000 lines.
The AI gets a truncated: true flag in metadata (line 376) and a text note:
(Output capped at 50 KB. Showing lines X-Y. Use offset=Z to continue.)
But there is no mechanism forcing the AI to continue reading. The AI can proceed to edit based on partial content.
Affected code in packages/opencode/src/tool/read.ts lines 14-18:
Activity
github-actions commentedon Jun 4, 2026
This issue might be a duplicate of existing issues. Please check:
rekram1-node commentedon Jun 4, 2026
send a session where the agent didnt properly understand this and we can tweak