gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Evaluate quality of edit tool and improve it

Open anj-s opened this issue 6 months ago • 14 comments

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

anj-s avatar Jul 14 '25 15:07 anj-s

Other related issues: b/427299140

anj-s avatar Jul 14 '25 17:07 anj-s

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.

J8-8N avatar Jul 21 '25 07:07 J8-8N

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

Image Image

jnui avatar Jul 24 '25 15:07 jnui

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.

jnui avatar Jul 24 '25 17:07 jnui

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.

  1. First I Need to fix our logging issues to actually track the errors we are not seeing currently (issue: #61)
  2. Then I will measure the rate or success/failure and most common failures (issue #5209 ). I will report this.
  3. 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)
  4. I will continue to explore other approaches (issue 5214 ) . . Please share any other ideas or errors you are seeing!! :)

silviojr avatar Jul 30 '25 18:07 silviojr

@srithreepo you sure about that? I am actively trying to figure out how to replace Gemini CLI because of this issue.

anicolao avatar Aug 12 '25 06:08 anicolao

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.

hongkongkiwi avatar Aug 19 '25 18:08 hongkongkiwi

@silviojr Is there a minimal reproducible example of this?

andytwigg avatar Sep 02 '25 21:09 andytwigg

@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.

anicolao avatar Sep 02 '25 22:09 anicolao

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.

gemini-cli[bot] avatar Sep 12 '25 19:09 gemini-cli[bot]

@silviojr Have you tried different formats for edits, such as apply_patch (cf OAI codex)? That may be less brittle.

andytwigg avatar Sep 17 '25 00:09 andytwigg

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 avatar Sep 18 '25 03:09 guidedways

@guidedways Jules does better and its billing is rational unlike Gemini CLI. But copilot agent is far cheaper and almost as good.

anicolao avatar Sep 18 '25 03:09 anicolao

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!

gemini-cli[bot] avatar Dec 03 '25 21:12 gemini-cli[bot]