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
[FEATURE]: Make read tool MAX_LINE_LENGTH configurable (currently hardcoded at 2000 chars) #25337
The read tool truncates any line exceeding 2000 characters at a hardcoded limit, silently cutting content mid-word. This affects any file with long lines — dense markdown transcripts, minified code, data files, unwrapped text — and the user has no indication they're seeing partial content unless they spot the suffix.
Location in code
packages/opencode/src/tool/read.ts:
constMAX_LINE_LENGTH=2000constMAX_LINE_SUFFIX=`... (line truncated to ${MAX_LINE_LENGTH} chars)`
Why it matters
Modern LLMs support 128K–200K context windows; a 2000-char-per-line cap is unnecessarily restrictive
Single-line transcripts, long log entries, and base64-encoded content regularly exceed this limit
Users are silently served incomplete content with no way to know or configure around it
The read tool already has an offset/ limit pagination mechanism, but that doesn't help when the problem is within a single line
Proposed solutions (any of the below)
Option A — Make it configurable:
Add a config field read_max_line_length to opencode.json:
Option B — Increase the default:
Bump MAX_LINE_LENGTH from 2000 to a higher value (e.g. 10000 or 50000) to align with modern model context windows.
Option C — Surface a visible warning:
Even without configurability, warn the user clearly when truncation occurs (not just an appendage to the line), so they know content was cut and can take action.
Implementation notes
The ReadTool already defines its parameters via Schema.Struct and respects an offset/ limit interface. Adding an optional line-length override follows the same pattern. The MAX_LINE_LENGTH constant is used only in the output-formatting logic inside the tool handler.
Activity
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.