Skip to content

fix: suppress duplicate extension warnings during startup#26208

Merged
cocosheng-g merged 2 commits intomainfrom
fix-duplicate-warnings-23172
Apr 30, 2026
Merged

fix: suppress duplicate extension warnings during startup#26208
cocosheng-g merged 2 commits intomainfrom
fix-duplicate-warnings-23172

Conversation

@cocosheng-g
Copy link
Copy Markdown
Contributor

Summary

This PR fixes an issue where extension-related warnings (missing settings, MCP server deprecations, etc.) were displayed twice during CLI startup.

Details

The CLI startup flow in gemini.tsx calls loadCliConfig twice—first to establish a minimal partialConfig for authentication/sandbox setup, and then for the full interactive session. Both calls were unconditionally loading all extensions.

I've added a skipExtensions option to loadCliConfig and set it to true for the first call. When skipped, a SimpleExtensionLoader([]) is used as a fallback to ensure the Config object remains valid and type-safe for downstream components.

Related Issues

Fixes #23172

How to Validate

  1. Install an extension that has missing settings or triggers an MCP deprecation warning.
  2. Run gemini.
  3. Verify that the warning bubble appears only once during startup.
  4. Verify that extensions are still correctly loaded and functional once the interactive session starts.

Alternatively, run the included unit test (manual steps if not using the repo's test runner):

# Create a test file in packages/cli/src/config/skipExtensions.test.ts
# and verify ExtensionManager is not instantiated when skipExtensions is true.

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

@cocosheng-g cocosheng-g requested a review from a team as a code owner April 29, 2026 17:18
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 addresses an issue where CLI startup triggered redundant extension-related warnings by initializing the extension manager multiple times. By introducing a skip mechanism for the initial configuration load, the system now ensures that extension processing occurs only when necessary, improving the user experience during startup without compromising configuration validity.

Highlights

  • Configuration Option: Added a 'skipExtensions' boolean option to 'loadCliConfig' to allow conditional loading of extensions.
  • Startup Optimization: Updated the CLI startup flow in 'gemini.tsx' to skip extension loading during the initial configuration phase, preventing duplicate warnings.
  • Type Safety: Introduced 'SimpleExtensionLoader' as a fallback mechanism to maintain configuration object integrity when extensions are skipped.
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.

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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

Size Change: +232 B (0%)

Total Size: 33.9 MB

Filename Size Change
./bundle/chunk-345IMGNW.js 0 B -49.2 kB (removed) 🏆
./bundle/chunk-3UWJOL7H.js 0 B -3.8 kB (removed) 🏆
./bundle/chunk-4OGFEWRV.js 0 B -19.5 kB (removed) 🏆
./bundle/chunk-CNR6EMNG.js 0 B -3.43 kB (removed) 🏆
./bundle/chunk-FXGDVKT5.js 0 B -2.72 MB (removed) 🏆
./bundle/chunk-KXP272RN.js 0 B -14.7 MB (removed) 🏆
./bundle/chunk-RKJJHQWI.js 0 B -655 kB (removed) 🏆
./bundle/chunk-ZDG23GIP.js 0 B -12.6 kB (removed) 🏆
./bundle/core-YAFZUNV4.js 0 B -48.2 kB (removed) 🏆
./bundle/devtoolsService-KPYYX4NY.js 0 B -28 kB (removed) 🏆
./bundle/gemini-RK4GQZCD.js 0 B -576 kB (removed) 🏆
./bundle/interactiveCli-IZHJL4UT.js 0 B -1.31 MB (removed) 🏆
./bundle/liteRtServerManager-B72SQ2RQ.js 0 B -2.11 kB (removed) 🏆
./bundle/oauth2-provider-4A3FMNCG.js 0 B -9.16 kB (removed) 🏆
./bundle/chunk-232CZ3C3.js 14.7 MB +14.7 MB (new file) 🆕
./bundle/chunk-4OKKVOQD.js 655 kB +655 kB (new file) 🆕
./bundle/chunk-KTEXJLJP.js 49.2 kB +49.2 kB (new file) 🆕
./bundle/chunk-NTPHAFGE.js 2.72 MB +2.72 MB (new file) 🆕
./bundle/chunk-VLNJVXRV.js 19.5 kB +19.5 kB (new file) 🆕
./bundle/chunk-WSXIE3RD.js 12.6 kB +12.6 kB (new file) 🆕
./bundle/chunk-WWUTMM6G.js 3.43 kB +3.43 kB (new file) 🆕
./bundle/chunk-ZSEZAWJJ.js 3.8 kB +3.8 kB (new file) 🆕
./bundle/core-MZ6HDWBZ.js 48.2 kB +48.2 kB (new file) 🆕
./bundle/devtoolsService-MIRSAF35.js 28 kB +28 kB (new file) 🆕
./bundle/gemini-G6WMAYOG.js 576 kB +576 kB (new file) 🆕
./bundle/interactiveCli-ZP6BDTR5.js 1.31 MB +1.31 MB (new file) 🆕
./bundle/liteRtServerManager-APVNGEOY.js 2.11 kB +2.11 kB (new file) 🆕
./bundle/oauth2-provider-QMGOOUAY.js 9.16 kB +9.16 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./bundle/bundled/third_party/index.js 8 MB 0 B
./bundle/chunk-34MYV7JD.js 2.45 kB 0 B
./bundle/chunk-5AUYMPVF.js 858 B 0 B
./bundle/chunk-5PS3AYFU.js 1.18 kB 0 B
./bundle/chunk-664ZODQF.js 124 kB 0 B
./bundle/chunk-DAHVX5MI.js 206 kB 0 B
./bundle/chunk-IUUIT4SU.js 56.5 kB 0 B
./bundle/chunk-RJTRUG2J.js 39.8 kB 0 B
./bundle/chunk-XRLFHCHC.js 1.97 MB 0 B
./bundle/cleanup-U63FXUEC.js 0 B -932 B (removed) 🏆
./bundle/devtools-36NN55EP.js 696 kB 0 B
./bundle/dist-T73EYRDX.js 356 B 0 B
./bundle/events-XB7DADIJ.js 418 B 0 B
./bundle/examples/hooks/scripts/on-start.js 188 B 0 B
./bundle/examples/mcp-server/example.js 1.43 kB 0 B
./bundle/gemini.js 5.1 kB 0 B
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB 0 B
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB 0 B
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB 0 B
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB 0 B
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB 0 B
./bundle/memoryDiscovery-FN3IAPBT.js 980 B 0 B
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 222 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 229 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 13.4 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 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-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B
./bundle/src-QVCVGIUX.js 47 kB 0 B
./bundle/start-P6Q5NJT4.js 0 B -652 B (removed) 🏆
./bundle/tree-sitter-7U6MW5PS.js 274 kB 0 B
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB 0 B
./bundle/cleanup-DPKQSYR5.js 932 B +932 B (new file) 🆕
./bundle/start-LVMSVTAM.js 652 B +652 B (new file) 🆕

compressed-size-action

Copy link
Copy Markdown
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 skipExtensions option to the CLI configuration loading process, allowing the CLI to bypass extension loading when necessary, such as in gemini.tsx. It refactors loadCliConfig to conditionally initialize the ExtensionManager and introduces a SimpleExtensionLoader as a fallback. Feedback was provided regarding the need for more robust handling of the potentially undefined extensionManager when accessing extension plan settings to ensure compliance with repository standards for optional properties.

Comment thread packages/cli/src/config/config.ts Outdated
@cocosheng-g cocosheng-g force-pushed the fix-duplicate-warnings-23172 branch from 452856e to baeccee Compare April 29, 2026 17:31
@gemini-cli gemini-cli Bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Apr 29, 2026
Comment thread pr_body.md Outdated
Copy link
Copy Markdown
Contributor

@devr0306 devr0306 left a comment

Choose a reason for hiding this comment

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

from /review-frontend

Code Review

This PR provides a clean and effective fix for the duplicate startup warnings issue (Fixes #23172). By introducing the skipExtensions flag to loadCliConfig and utilizing it for the initial partialConfig load in gemini.tsx, we avoid initializing the ExtensionManager twice. This not only cleanly suppresses the duplicate warnings but also directly addresses an existing TODO to avoid loading extensions during auth and sandbox setup, subtly improving startup performance.

Findings

  • Correctness: The logic is sound. Skipping extension loading in the pre-sandbox phase works perfectly because the CLI only needs a minimal configuration object at that stage. The optional chaining (extensionManager?.getExtensions()?.find(...)) is implemented safely.
  • Maintainability: The fallback mechanism (finalExtensionLoader = extensionManager ?? new SimpleExtensionLoader([])) cleanly guarantees that downstream properties like Config.extensionLoader are never undefined and remain strictly typed, preventing structural breakages elsewhere in the codebase.
  • Missing Test File: The PR description mentions an "included unit test" (packages/cli/src/config/skipExtensions.test.ts), but this file is missing from the commits.

The implementation is correct and works exactly as intended. However, please push the missing skipExtensions.test.ts file so we have proper regression coverage for this flag.

@cocosheng-g cocosheng-g force-pushed the fix-duplicate-warnings-23172 branch from baeccee to 9aae18d Compare April 29, 2026 18:35
Bojun-Vvibe added a commit to Bojun-Vvibe/oss-contributions that referenced this pull request Apr 29, 2026
…i-cli#26208+26207

- BerriAI/litellm#26793 feat(proxy): durable agent workflow run tracking (needs-discussion — sequence-number race + missing tenancy scoping + Prisma error leak)
- google-gemini/gemini-cli#26208 fix: suppress duplicate extension warnings (merge-after-nits)
- google-gemini/gemini-cli#26207 Add @ mention the gemini robot (request-changes — critique-semantics flip + comment-step if guard regression + PAT scope concern)
@cocosheng-g
Copy link
Copy Markdown
Contributor Author

addressed all!

@cocosheng-g cocosheng-g force-pushed the fix-duplicate-warnings-23172 branch from 9aae18d to 054b301 Compare April 29, 2026 18:43
Copy link
Copy Markdown
Contributor

@devr0306 devr0306 left a comment

Choose a reason for hiding this comment

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

LGTM

@cocosheng-g cocosheng-g added this pull request to the merge queue Apr 30, 2026
Merged via the queue into main with commit d743c6f Apr 30, 2026
27 checks passed
@cocosheng-g cocosheng-g deleted the fix-duplicate-warnings-23172 branch April 30, 2026 14:25
TirthNaik-99 pushed a commit to TirthNaik-99/gemini-cli that referenced this pull request May 4, 2026
kimjune01 pushed a commit to kimjune01/gemini-cli-claude that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate extension warnings in terminal UI during startup

2 participants