Skip to content

Fix duplicate info messages for extension updates#9760

Merged
jakemac53 merged 4 commits into
mainfrom
better-extension-update-checks
Sep 25, 2025
Merged

Fix duplicate info messages for extension updates#9760
jakemac53 merged 4 commits into
mainfrom
better-extension-update-checks

Conversation

@jakemac53

@jakemac53 jakemac53 commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

TLDR

Previously there was a race condition where you could get zero, one, or multiple possible notifications for updates to extensions. This fixes that so you just get one notification reliably.

I also combined all the info messages into one generic message like this:
image

Dive Deeper

The primary issue is this useExtensionState function being called many times on startup in quick succession, which was resulting in simultaneous ongoing calls to check the extension update states. These were all mutating the same extension state object and getting in race conditions.

I added a fix to ensure we only have one ongoing check at a time by adding an extra boolean state object to track if we have an ongoing update check already happening.

I also added a fix to not edit the original extension state object but instead return a new one from checkForAllExtensionUpdates, this was creating the situation where we would have no log at all sometimes due to the previous and new states being equal (the same object).

Reviewer Test Plan

Run the CLI with extensions installed that need updates, you should just see one message to update.

Testing Matrix

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

Linked issues / bugs

@jakemac53 jakemac53 requested a review from chrstnb September 25, 2025 16:51
@jakemac53 jakemac53 requested a review from a team as a code owner September 25, 2025 16:51
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jakemac53, 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 resolves a race condition that caused inconsistent and often duplicate notifications for extension updates during application startup. By serializing the update check process and refining state management within the update functions, it ensures that users receive a single, accurate notification when extensions require updates, significantly improving the user experience and system stability.

Highlights

  • Race Condition Fix: Addressed a race condition that previously led to zero, one, or multiple notifications for extension updates, ensuring a single, reliable notification.
  • Update Check Serialization: Introduced an isChecking boolean state in useExtensionUpdates to serialize extension update checks, preventing simultaneous calls and state mutation issues.
  • Improved State Management: Modified checkForAllExtensionUpdates to use a local newStates map for accumulating update states, avoiding direct, concurrent modifications to the global extensionsUpdateState.
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.

@github-actions

github-actions Bot commented Sep 25, 2025

Copy link
Copy Markdown

Size Change: +133 B (0%)

Total Size: 17.4 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 17.4 MB +133 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 830 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

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

Copy link
Copy Markdown
Contributor

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 aims to fix a race condition that caused duplicate notifications for extension updates. The approach involves adding a locking mechanism to prevent multiple update checks from running concurrently. While the intent is correct, the implementation in the useExtensionUpdates hook has a critical flaw that will cause an infinite render loop. Additionally, a related change in checkForAllExtensionUpdates introduces a bug that could lead to loss of state. I have provided detailed comments on both of these issues.

Comment thread packages/cli/src/config/extensions/update.ts Outdated
Comment thread packages/cli/src/ui/hooks/useExtensionUpdates.ts Outdated
extensionsUpdateState,
setExtensionsUpdateState,
);
let extensionsWithUpdatesCount = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just double-checking, how will this work if there are also some auto-updatable extensions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

They don't contribute to this count

@chrstnb chrstnb self-requested a review September 25, 2025 17:47
@jakemac53 jakemac53 added this pull request to the merge queue Sep 25, 2025
Merged via the queue into main with commit defda3a Sep 25, 2025
17 of 19 checks passed
@jakemac53 jakemac53 deleted the better-extension-update-checks branch September 25, 2025 18:07
geoffdowns pushed a commit to geoffdowns/gemini-cli that referenced this pull request Sep 26, 2025

(async () => {
if (isChecking) return;
setIsChecking(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

be very careful adding logic like this that unconditionally updates react state. This code causes us to render frames continuously causing flicker because we are continuously setting setIsChecking to true and then back to false.

thacio added a commit to thacio/auditaria that referenced this pull request Oct 4, 2025
giraffe-tree pushed a commit to giraffe-tree/gemini-cli that referenced this pull request Oct 10, 2025
@sripasg sripasg added the size/m A medium sized PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants