gemini-cli - ✅(Solved) Fix When folder is trusted by VSCode but untrusted in trustedFolders.json, Gemini CLI is stuck in restart loop [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25032Fetched 2026-04-10 03:45:10
View on GitHub
Comments
1
Participants
2
Timeline
9
Reactions
0
Author
Timeline (top)
labeled ×4unlabeled ×2added_to_project_v2 ×1commented ×1

PR fix notes

PR #25163: fix(cli): prevent restart loop on initial IDE trust mismatch

Description (problem / solution / changelog)

Summary

When opening a workspace that is trusted in the IDE but untrusted in the local Gemini CLI settings (or vice versa), the CLI would get stuck in an infinite restart loop prompting the user that trust has changed.

This fix introduces a check to ignore the initial trust mismatch upon the first connection, while still preserving the restart behavior for subsequent trust changes during an active session. It also optimizes IdeClient to only emit trust events when the value actually changes.

Related Issues

Fixes #25032

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

Changed files

  • packages/cli/src/ui/hooks/useIdeTrustListener.test.tsx (modified, +48/-0)
  • packages/cli/src/ui/hooks/useIdeTrustListener.ts (modified, +7/-3)
  • packages/core/src/ide/ide-client.ts (modified, +6/-1)

Code Example

> /about
# paste output here
RAW_BUFFERClick to expand / collapse

What happened?

In Gemini CLI version 0.36.0 with IDE companion extension for VSCode in version 0.20, if I open a folder as a workspace and that folder (or its parent) is marked as untrusted in trustedFolders.json, Gemini CLI gets stuck prompting me with Workspace trust has changed due to a change in the IDE connection.. If I do hit r, gemini cli reloads but hits the same issue. A lot of troubleshooting steps don't help, but updating trustedFolders.json so it matches the trust in the IDE unblocks things.

What did you expect to happen?

If there is a mismatch in a folder's trusted status between the IDE and gemini settings, it should be handled gracefully and not prevent starting gemini CLI

Client information

<details> <summary>Client Information</summary>

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

> /about
# paste output here
</details>

Login information

No response

Anything else we need to know?

No response

extent analysis

TL;DR

Updating the trustedFolders.json file to match the trust settings in the IDE may resolve the issue where Gemini CLI gets stuck due to a workspace trust change.

Guidance

  • Verify that the trustedFolders.json file is correctly formatted and updated to reflect the current trust settings in the IDE.
  • Check for any inconsistencies in trust settings between the IDE and Gemini CLI configurations.
  • If the issue persists, try removing and re-adding the workspace to ensure that the trust settings are properly synchronized.
  • Ensure that the Gemini CLI and IDE companion extension versions are compatible and consider updating to the latest versions if necessary.

Example

No specific code snippet is provided as the issue is related to configuration files and trust settings.

Notes

The provided information suggests that the issue is related to a mismatch in trust settings between the IDE and Gemini CLI. However, without more detailed information about the specific configurations and versions used, it is difficult to provide a more specific solution.

Recommendation

Apply workaround: Update the trustedFolders.json file to match the trust settings in the IDE, as this has been reported to unblock the issue in the given scenario.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING