Evaluate quality of edit tool and improve it
Edit tool is one of the most critical pieces and invariably there are issues with editing files (especially large files).
Evaluate the quality of the current edit tool , track issues and propose solutions
Other related issues: b/427299140
I'm surprised by the lack of traction for this edit tool failure continuous loop because it happens to us on nearly every session (despite our files being 400 lines long max) and it's the only reason we have to keep using a competitor.
Is there any workaround to this issue? perhaps using a MCP for file handling, I have multiple issues for file handling for reading and writing
note, I thought this problem stopped for me after I added a mcp server for file handling. but after a while the file handling errors came back.
Hello, folks! Thanks for reporting all those errors. I am going through them and working actively on improving it.
I added some sub-tasks that I will follow.
- First I Need to fix our logging issues to actually track the errors we are not seeing currently (issue: #61)
- Then I will measure the rate or success/failure and most common failures (issue #5209 ). I will report this.
- I will evaluate how much we can improve those metrics with few improvements, trying to be quick to release this soon (issues 5211 and 5213)
- I will continue to explore other approaches (issue 5214 ) . . Please share any other ideas or errors you are seeing!! :)
@srithreepo you sure about that? I am actively trying to figure out how to replace Gemini CLI because of this issue.
New user here to this cli tool (I used claude-code and others without issue), gosh this issue is terrible! It's definately a CLI issue as it's the same issue with qwen which is forked from this. It really makes the cli unusable for many projects I've tried. Sometimes it works fine but in some projects it just fails dismally to edit and keeps looping edit failures.
@silviojr Is there a minimal reproducible example of this?
@hongkongkiwi this is not necessarily a CLI issue. The problem that I've seen is that the tool usage is bad because the LLM doesn't have the correct version of the file in its context, perhaps because it has hallucinated something or perhaps because it thinks it has taken a step that it hasn't taken, but then when the tool fails its fallback is to re-read everything and try again, which doesn't always work.
The way I'd look at it is more like the tool is too "sharp" for the user; just like I wouldn't give a toddler a kitchen knife, but rather childsafe scissors, what the LLMs need are edit tools that can apply the edit they want without demanding silly things like exact character-for-character string matches; or, better error messags for the CLI that it can use to correct its request, or some other workaround for the fact that it just can't handle making a change to a 1,000 line file "from memory".
@andytwigg I could try to make you an example if you want, but truly it is trivial. Just ask the CLI to edit any moderately large project. I used it to fork itself as part of bootstrapping my project and it really struggled to do the job (it did eventually ... $200-$300 later). Pretty much any simple refactoring of the CLI's own code should run up against the issue, I would think, based on how often I ran into it. Jules does not seem to suffer from this problem, or perhaps it just doesn't provide visibility into its struggles.
Found possible duplicate issues (updated):
- #7463
- #10997
- #5825
- #3934
- #4865
- #5629
- #2101
- #5761
- #7706
- #9017
If you believe this is not a duplicate, please remove the status/possible-duplicate label.
@silviojr Have you tried different formats for edits, such as apply_patch (cf OAI codex)? That may be less brittle.
I'm rooting for Gemini but unfortunately unable to use it for anything at all. We have mixed objc / swift projects and Gemini goes into edit loops, corrupts code, misses braces, places replacements midway into a line and does other similarly weird things. Then it goes into a loop and recently has started saying "detected a loop" and aborts editing.
For comparison right now Gemini CLI is in fact the only CLI that struggles with the most basic of edits, forget about actual refactoring efforts. I've had no problems with Claude Code or more recently Codex. Not once.
I'm hoping this one critical issue is resolved before I'm able to utilize the best model on the planet in terms of reasoning by far (Gemini 2.5 Pro) even with all the newer ones coming out after it.
@guidedways Jules does better and its billing is rational unlike Gemini CLI. But copilot agent is far cheaper and almost as good.
Hello! As part of our effort to keep our backlog manageable and focus on the most active issues, we are tidying up older reports.
It looks like this issue hasn't been active for a while, so we are closing it for now. However, if you are still experiencing this bug on the latest stable build, please feel free to comment on this issue or create a new one with updated details.
Thank you for your contribution!