Skip to content

[FEATURE]: Make read tool MAX_LINE_LENGTH configurable (currently hardcoded at 2000 chars) #25337

Closed as not planned

Description

@moisestohias

Describe the enhancement you want to request

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:

const MAX_LINE_LENGTH = 2000
const MAX_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:

{
  "experimental": {
    "read_max_line_length": 8000
  }
}

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

  1. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions