Skip to content

Conversation

@SandyTao520
Copy link
Contributor

@SandyTao520 SandyTao520 commented Jan 31, 2026

TLDR

This PR adds a new setting model.disableLoopDetection to allow users to disable the automatic detection and prevention of infinite loops. This is useful for scenarios where productive repetitive behavior is incorrectly flagged as a loop.

Dive Deeper

The LoopDetectionService currently monitors both tool call repetitions and content streaming patterns. While effective, it can sometimes produce false positives. By adding this setting, users can opt-out of this behavior globally via their settings.json or the /settings command.

Changes include:

  • Core configuration updates to support the new flag.
  • Integration into the CLI settings schema and JSON schema for IDE support.
  • Documentation updates in configuration.md and settings.md.
  • Marking the setting as requiring a restart.

Reviewer Test Plan

  1. Open Gemini CLI.
  2. Run /settings and navigate to the Model section.
  3. Verify "Disable Loop Detection" is present and defaults to false.
  4. Enable it and verify it's saved to settings.json.
  5. Verify that with the setting enabled, LoopDetectionService bypasses its checks.

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker
Podman - -
Seatbelt - -

Linked issues / bugs

#18007

@SandyTao520 SandyTao520 requested review from a team as code owners January 31, 2026 01:11
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @SandyTao520, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new configuration option to control the automatic loop detection mechanism within the system. This enhancement provides users with the flexibility to bypass the loop detection service, particularly in cases where the current system might misinterpret intended repetitive actions as infinite loops, thereby improving the user experience for specific workflows.

Highlights

  • New Configuration Setting: A new setting, model.disableLoopDetection, has been introduced to allow users to disable the automatic detection and prevention of infinite loops.
  • Purpose: This setting addresses scenarios where productive repetitive behavior might be incorrectly flagged as a loop by the LoopDetectionService, providing greater flexibility.
  • Integration and Documentation: The new setting is integrated into the CLI settings schema, JSON schema for IDE support, and documented in configuration.md and settings.md.
  • Restart Requirement: The model.disableLoopDetection setting requires a restart to take effect.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@chrstnb
Copy link
Collaborator

chrstnb commented Jan 31, 2026

Build failed: Build process failed (no specific link errors found). Check logs for details.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new setting, model.disableLoopDetection, to give users the ability to turn off the automatic loop detection mechanism. The changes are well-implemented across the configuration, core logic, and documentation. The new setting is disabled by default for safety, and the implementation in LoopDetectionService is straightforward and correct. The inclusion of unit tests to verify the new behavior is also appreciated. Overall, this is a solid contribution that adds a useful feature for advanced users who might encounter false positives with the loop detection system.

@github-actions
Copy link

github-actions bot commented Jan 31, 2026

Size Change: +639 B (0%)

Total Size: 23.6 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 23.6 MB +639 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@SandyTao520 SandyTao520 force-pushed the st/feat/loop-detection-setting branch from 1876a84 to fb0fe4f Compare January 31, 2026 20:25
@chrstnb
Copy link
Collaborator

chrstnb commented Jan 31, 2026

Build failed: Build process failed (no specific link errors found). Check logs for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants