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

GEMINI-CLI often has content loops and task loops

Open oiuv opened this issue 1 year ago • 4 comments

What happened?

GEMINI-CLI is an amazing code tool,I used it to develop and launch a project, and basically all the functional requirements have been fulfilled. However, I often encountered two problems during the development process. The first one is getting stuck in an infinite loop.

like this, It won't stop unless you intervene and terminate it in time.:

Image

But sometimes it can recognize that it has entered a loop and stop on its own.

Image

The second issue is that as the development continues, it increasingly forgets the tasks it has already completed and attempts to re-execute them. I've had to constantly remind it or directly use /quit and restart GEMINI-CLI.

What did you expect to happen?

  1. Avoid infinite loops entirely, with proactive detection of potential loops or reliable self-termination without manual intervention.
  2. Better remember completed tasks during development, reduce redundant re-execution, and minimize the need for frequent reminders or CLI restarts.

Client information

$ gemini /about
CLI Version                0.1.13    
Model                      gemini-2.5-flash
Sandbox                    no sandbox 
OS                         win32 

Login information

No response

Anything else we need to know?

Despite the issues, GEMINI is still amazing! I managed to complete my project without writing a single line of code or documentation—it did everything for me!

Image Image

oiuv avatar Jul 25 '25 03:07 oiuv

I also see this occasionally... I think it's happening inside the AI model... perhaps the google cli terminal window should pay attention to what AI model is outputting and then somehow intercept/interrupt it and terminate it. This could cost people lots of money in wasted token usage... definetly a priority.

DelphinityLabs avatar Jul 25 '25 06:07 DelphinityLabs

It just happened again, for me it seems to do it when it completes it's task, kinda weird, maybe there is something in my task description which causes it to loop:

Image

DelphinityLabs avatar Jul 25 '25 06:07 DelphinityLabs

It just happened again, for me it seems to do it when it completes it's task, kinda weird, maybe there is something in my task description which causes it to loop:

I encounter this frequently too. It repeatedly restarts tasks that have already been completed, especially tasks related to fixing errors. Because the error has already been fixed, it gets stuck in a loop where it can't find the relevant code to replace, and keeps trying different ways to search and replace. Even if you tell it the problem has been solved and to stop focusing on it, after a few rounds of conversation, it might come back to deal with it and get stuck in the loop again.

oiuv avatar Jul 25 '25 08:07 oiuv

Duplicate of #3934

SandyTao520 avatar Jul 29 '25 17:07 SandyTao520