Skip to content

"Always read entire file" setting prevents line-range reads #4009

@KJ7LNW

Description

@KJ7LNW

This issue is related to functionality discussed in PR #3995 regarding how files are read.

Problem

There are cases where line-range reads are useful even when the "Always read entire file" setting is enabled:

  1. When pasting a diff that has line references for use by the model
  2. The result of git grep -n
  3. The result of <search_files>
  4. The result of <list_code_definitions>
  5. Output from <execute_command> running tools like git blame, lint commands, and other development tools
  6. Error messages and warnings from compilers/linters that include line numbers
  7. Other tools that display code with line number references

Testing has shown that models (particularly gemini-2.5) with @samhvw8's implementation of multi-read_file effectively handle multiple line ranges in these scenarios, and the line-range-targeted result is extremely useful on large files.

Implementation Suggestion

The bigger problem trying to be addressed appears to be that the model will re-read ranges after it has read the entire file, which is unnecessary.

A more effective solution than disabling line ranges would be to track file modification time along with line ranges and reject redundant reads if a line range is already loaded since the last file modification. Modification times could be stored in the task JSON files for all file I/O operations to handle this effectively.

Version Information

App version: v3.18.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - Needs ScopingValid, but needs effort estimate or design input before work can start.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions