Skip to content

fix(cli): dismiss update banner when /clear runs#25981

Open
Anjaligarhwal wants to merge 2 commits intogoogle-gemini:mainfrom
Anjaligarhwal:fix/cli/clear-dismisses-update-banner
Open

fix(cli): dismiss update banner when /clear runs#25981
Anjaligarhwal wants to merge 2 commits intogoogle-gemini:mainfrom
Anjaligarhwal:fix/cli/clear-dismisses-update-banner

Conversation

@Anjaligarhwal
Copy link
Copy Markdown
Contributor

Summary

The "Gemini CLI update available!" banner could not be dismissed with /clear. This PR restores the dismissal: ui.clear() now resets the updateInfo state in addition to clearing history and the startup banner.

Details

Notifications.tsx renders the banner from the updateInfo state owned by AppContainer:

// packages/cli/src/ui/components/Notifications.tsx:148
{updateInfo && <UpdateNotification message={updateInfo.message} />}

updateInfo is set in AppContainer via setUpdateHandler (handleAutoUpdate.ts:170) when an update check fires. Until now it was only ever cleared by the 60-second timer in that handler or by the update-success / update-failed events. The ui.clear() callback in useSlashCommandProcessor did not touch it, so /clear (and /new) had no effect on the banner.

The banner used to render as a history item, so clearItems() cleared it implicitly. PR #5488 (885af07d) moved it into the live-area <Notifications> component, where it is now driven by updateInfo state in AppContainer. This PR adds the corresponding reset on the /clear path so the dismissal matches the new state ownership.

The fix threads setUpdateInfo through useSlashCommandProcessor the same way setBannerVisible is already threaded, and invokes it from ui.clear():

// packages/cli/src/ui/hooks/slashCommandProcessor.ts
clear: () => {
  clearItems();
  refreshStatic();
  setBannerVisible(false);
  setUpdateInfo(null);     // new
},

This restores the behavior referenced in the issue without altering the rest of the update-notification lifecycle (auto-update events still set/clear updateInfo exactly as before; the next update check on the following session will re-show the banner).

Why not use the updateEventEmitter?

setBannerVisible and the rest of the ui.clear() plumbing already use direct prop passing rather than events. Adding a new event for a single in-process consumer would be more indirect than threading the existing setter, and would not match the surrounding code style.

Related Issues

Fixes #25628

How to Validate

  1. npm install
  2. npm run build
  3. Run the CLI on a version older than latest so the update banner appears (or stub the response from latest-version to force one).
  4. Observe the rounded yellow Gemini CLI update available! ... banner above the prompt.
  5. Type /clear (or /new).
  6. Expected: history is wiped and the update banner disappears.
  7. Targeted unit suites:
    • npx vitest run packages/cli/src/ui/hooks/slashCommandProcessor.test.tsx → 36/36 pass (includes new Update banner dismissal case).
    • npx vitest run packages/cli/src/ui/commands/clearCommand.test.ts packages/cli/src/ui/components/Notifications.test.tsx packages/cli/src/ui/components/UpdateNotification.test.tsx packages/cli/src/utils/handleAutoUpdate.test.ts → 41/41 pass.
    • npx vitest run packages/cli/src/ui/AppContainer.test.tsx → 107/107 pass.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed) — not applicable, behavioural fix only.
  • Added/updated tests — new Update banner dismissal test in slashCommandProcessor.test.tsx.
  • Noted breaking changes — none. useSlashCommandProcessor gains one positional parameter; only AppContainer calls it in production code, and the test setup is updated in lockstep.
  • Validated on required platforms/methods:
    • MacOS
    • Windows — npm run start (Windows 11, Node 20)
    • Linux

The change is platform-independent (pure React state). Targeted unit suites pass under Vitest.

@Anjaligarhwal Anjaligarhwal requested a review from a team as a code owner April 25, 2026 18:55
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the summary. You can try again by commenting /gemini summary.

@Anjaligarhwal
Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-cli gemini-cli Bot added area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Apr 25, 2026
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 implements the dismissal of the update banner when the UI is cleared. It modifies the useSlashCommandProcessor hook to include a setUpdateInfo parameter, which is now called with null during the clear action. Additionally, the changes include updated test coverage to ensure the update information is correctly reset. I have no feedback to provide.

@SHARABUMANOJKUMAR
Copy link
Copy Markdown

Hi, I would like to work on this issue. I have been contributing to Gemini CLI and would like to take this up. Can I proceed?

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 help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gemini CLI update available message is sticky message and cannot get cleared

2 participants