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

Potential Infinite Loop in Gemini CLI After Successful Task Completion

Open VirtualArcher opened this issue 2 months ago • 0 comments

What happened?

After instructing Gemini CLI to correct test cases so that no test errors occur, the CLI successfully completed the task. The output confirmed that all tests passed and the build was successful:

[INFO] 1 chart(s) linted, 0 chart(s) failed [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 14.153 s [INFO] Finished at: 2025-12-10T12:50:29+01:00 [INFO] ------------------------------------------------------------------------

However, instead of finishing cleanly, Gemini CLI entered an infinite loop, repeating actions or logging. Eventually, the process was halted with a message:

ℹ A potential loop was detected. This can happen due to repetitive tool calls or other model behavior. The request has been halted.

What did you expect to happen?

I expected Gemini CLI to terminate gracefully after accomplishing its task and reporting a successful build, without entering any further loops or repeated actions.

Client information

Client Information

Run gemini to enter the interactive CLI, then run the /about command.

> /about
 About Gemini CLI                                                                                                                                                                                                              │
│                                                                                                                                                                                                                               │
│ CLI Version                                                                  0.18.0                                                                                                                                           │
│ Git Commit                                                                   7beccfa03
│ Model                                                                        auto                                                                                                                                           │
│ Sandbox                                                                      no sandbox                                                                                                                                       │
│ OS                                                                           linux                                                                                                                                            │
│ Auth Method                                                                  OAuth                                                                                                                                            │
│ User Email                                                                                                                                                                           │
│ GCP Project                                                               

Login information

Google Account

Anything else we need to know?

  • The infinite loop only occurred after all test cases were successfully fixed and no errors remained.
  • Output clearly indicated "BUILD SUCCESS" before the loop started.
  • This could potentially be related to the Gemini CLI's handling of task completion or exit conditions.

Let me know if you want to add more details or if you need the placeholders (like for Client Information or Login Information) filled with specific values.

VirtualArcher avatar Dec 10 '25 12:12 VirtualArcher