Skip to content

Conversation

@mrubens
Copy link
Collaborator

@mrubens mrubens commented May 24, 2025

Anecdotally Roo seems dumber when it doesn't read the whole file. I think full file reads are a safer default for now.

@mrubens mrubens merged commit 2053d27 into main May 24, 2025
14 checks passed
@mrubens mrubens deleted the default_to_full_file_reads branch May 24, 2025 19:17
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap May 24, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap May 24, 2025
@user202729
Copy link
Contributor

This PR explicitly makes the tool not do what it tells the AI to do.

With this change, by default, even if the AI provides <start_line> and <end_line>, the whole file will be provided. So that there is no way for the AI to actually read a line range.

There are a few problems with this:

  • With very large file, this can lead to overflow of context window after every file read and make the AI stuck in a loop.
  • Worse, a single file read may overflow the context window.

Or any other rationale that made #1440 added in the first place.

@mrubens
Copy link
Collaborator Author

mrubens commented May 25, 2025

This PR explicitly makes the tool not do what it tells the AI to do.

With this change, by default, even if the AI provides <start_line> and <end_line>, the whole file will be provided. So that there is no way for the AI to actually read a line range.

There are a few problems with this:

  • With very large file, this can lead to overflow of context window after every file read and make the AI stuck in a loop.
  • Worse, a single file read may overflow the context window.

Or any other rationale that made #1440 added in the first place.

Yeah that’s a good point - we should probably make the prompts smarter. And you can always change your settings if you prefer the partial reads, but I and others noticed that the AI seems to make a lot more mistakes when using partial reads so we decided to change the default.

@user202729
Copy link
Contributor

user202729 commented May 25, 2025

Yes, but the implementation leads to misleading output to the user.

A better way to implement it may be if maxReadFileLine option is -1, then don't tell the AI that <start_line> and <end_line> exists at all (and just act like it doesn't exist). Otherwise it would leads to a confusing situation where the AI says "I will read line 1000--1100 of the file", but actually reads all of it.

This probably involves some refactoring — first getReadFileDescription function needs to be changed, but also we need to pass maxReadFileLine to it somehow. (It isn't currently passed.)

@mrubens
Copy link
Collaborator Author

mrubens commented May 25, 2025

I agree, that’s a great point. We should fix.

@mrubens
Copy link
Collaborator Author

mrubens commented May 26, 2025

#3995

@user202729
Copy link
Contributor

user202729 commented May 26, 2025

in order to test out Roo-Code I try to replicate fixing the issue pointed out above, and immediately see an issue when full file read is not enabled (GPT 4.1 mini):

image

The cause is because it only reads line 1–40 previously.

That said, the reaction makes sense — it doesn't know the surrounding context yet, so its best guess is the user forget the closing quote there.

It might helps here when, in partial read_file calls, adds e.g. a [10 more lines...] at the end of the returned result. So that the model would know it's not yet the end of the file.

Another idea would be in replace_in_file tool call, disallow the model from changing parts that it has not read (more precisely, if the model want to change line X → Y, it must have read line max(1, X-5) → min(N, Y+5) where N is the total number of lines). This can be checked with 100% certainty without the use of AI, just keep track of what tool calls has been performed.

[also lesson learnt: don't use Roo-Code in development mode to develop itself, otherwise you will get

♻️ File changed: /home/user202729/Roo-Code/src/core/prompts/tools/read-file.ts. Reloading host…

and the extension being killed. I think it's worth adding this as a note to Local Setup & Development
section in the README. ]

SmartManoj pushed a commit to SmartManoj/Raa-Code that referenced this pull request Jun 13, 2025
…ger (RooCodeInc#3936)

* fix(bedrock): resolve AWS credential caching issue with Identity Manager

- Add ignoreCache option for profile-based authentication to detect external credential file changes
- Implement smart caching for manual credentials with 5-minute TTL to maintain performance
- Add configuration hash-based cache invalidation for manual credential changes
- Add invalidateCredentialCache() method for error recovery scenarios

Fixes issue where AWS Identity Manager credential updates were not detected,
requiring extension restart. Profile-based authentication now always reads
fresh credentials while manual credentials maintain performance through caching.

Resolves credential refresh issues reported by users using AWS Identity Manager
with role-based authentication workflows.

* Potential fix for code scanning alert no. 66: Use of a broken or weak cryptographic algorithm

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* merge conflict

* updated to fixe the original medrock issue

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants