Skip to content

file_read's 500-line limit does not bound single-line tool-result bytes #1875

Closed

Description

@rep-de

file_read's 500-line limit does not bound single-line tool-result bytes

Verified in the v1.13.0 pin 1672852136fc87748249d22bce0819f33419ea79: file_read.go. Related to #1827 (code_search) and #1171 (body-size versus diff-size), but this concerns file_read itself.

A single minified JSON line can be arbitrarily large. Execute reads up to 500 lines and appends each complete line to the result. A 167 KB single-line JSON therefore enters the conversation in full; IS_TRUNCATED can be false because the line-count limit was not reached. Repeated reads accumulate this content before compression.

Suggested regression: write a JSON file with one 170,000-byte line into t.TempDir(); use FileReader{RepoDir: dir, Mode: ModeWorkspace}, NewFileRead(fr).Execute(context.Background(), map[string]any{"file_path":"receipt.json"}); assert a configured byte bound as well as truthful truncation/range metadata. No model call is necessary.

Please add a configurable result byte bound, including oversized individual lines, UTF-8-safe handling, and an explicit continuation/omission marker. A line-count cap alone cannot enforce a prompt-size budget. This report uses a synthetic reproduction; no private repository contents or credentials are attached.

Prepared with Codex assistance; source inspected at the pinned commit.

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

Metadata

Metadata

Assignees

No one assigned

    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