Skip to content

Conversation

@mrubens
Copy link
Collaborator

@mrubens mrubens commented May 26, 2025

Closes #4009

#3936 (comment)


Important

The PR updates the read_file tool to conditionally include partial read instructions based on a new partialReadsEnabled flag, affecting tool descriptions, parameters, and examples.

  • Behavior:
    • read_file tool now conditionally includes start_line and end_line parameters based on partialReadsEnabled flag in read-file.ts.
    • Updates read_file usage examples to include partial read scenarios when partialReadsEnabled is true.
  • System Prompt:
    • Modifies generatePrompt in system.ts to pass partialReadsEnabled to tool descriptions.
    • Updates SYSTEM_PROMPT and generateSystemPrompt to handle partialReadsEnabled flag.
  • Tests:
    • Adds test cases in system.test.ts and custom-system-prompt.test.ts to verify behavior with partialReadsEnabled flag.

This description was created by Ellipsis for acb2d67. You can customize this summary. It will automatically update as commits are pushed.

@user202729
Copy link
Contributor

Looks reasonable to me.

Side question, how much of, let's say, this particular pull request was generated by Roo-Code (or other agentic AI coding tool, if you use anything else)? How do you make it handle with large code base with lots of implicit structures?

@mrubens
Copy link
Collaborator Author

mrubens commented May 26, 2025

Looks reasonable to me.

Side question, how much of, let's say, this particular pull request was generated by Roo-Code (or other agentic AI coding tool, if you use anything else)? How do you make it handle with large code base with lots of implicit structures?

Thank you. Roo Code wrote all of this code. I just opened the file with the current prompt in it and then started a task telling it about your feedback and asking it to conditionally hide the parts about partial reads if it's disabled. I'm using Sonnet 4 now which seems to do a good job.

@KJ7LNW
Copy link
Contributor

KJ7LNW commented May 26, 2025

Someone reminded me in an issue that we should make these line_range instructions conditional on whether partial file reads are enabled. Maybe that fix should be a separate PR, but related to this one too I think.

There are cases where line-range reads are useful even when full reads are enabled, and I use these often:

  1. when pasting a diff that has line references for use by the model
  2. the result of git grep -n
  3. probably others

I have been particularly impressed with Gemini's ability to use @samhvw8's multi-read_file to read multiple line ranges in these cases, and the line-range-targeted result is extremely useful on large files.

I think the bigger problem trying to be addressed here is that the model will re-read ranges after it has read the entire file, which is of course unnecessary: the proper fix for that would be to track file modification time along with line ranges and reject if a line range is already loaded since the file modification. Modification times need to be stored in the task JSON files for all file IO operations to handle this.

@KJ7LNW KJ7LNW added the Issue - Needs Approval Ready to move forward, but waiting on maintainer or team sign-off. label May 26, 2025
@mrubens
Copy link
Collaborator Author

mrubens commented May 26, 2025

I think that is a separate discussion from this PR since currently the model is unable to perform partial reads when this is set to -1.

@mrubens mrubens merged commit ce6cc6f into main May 26, 2025
17 checks passed
@mrubens mrubens deleted the handle_partial_reads_in_prompt branch May 26, 2025 18:55
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap May 26, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap May 26, 2025
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 28, 2025
SmartManoj pushed a commit to SmartManoj/Raa-Code that referenced this pull request Jun 13, 2025
* making claude4 feel better

* system prompt whoops

* small system prompt change

---------

Co-authored-by: Cline Evaluation <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue - Needs Approval Ready to move forward, but waiting on maintainer or team sign-off. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

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

5 participants