Skip to content

fix: register themes on extension load not start#22148

Merged
jackwotherspoon merged 4 commits intomainfrom
extension-themes-fix
Mar 12, 2026
Merged

fix: register themes on extension load not start#22148
jackwotherspoon merged 4 commits intomainfrom
extension-themes-fix

Conversation

@jackwotherspoon
Copy link
Collaborator

@jackwotherspoon jackwotherspoon commented Mar 12, 2026

Summary

This PR fixes an issue where extension-provided themes could not be used on launch, causing errors when a user had previously selected a custom extension theme in a previous session.

image

By registering themes earlier in the extension loading lifecycle, we ensure they are available before the application's configuration is fully initialized.

Details

  • Early Registration: Modified ExtensionManager.loadExtensions() and loadExtension() to register declarative
    theme data immediately after extensions are loaded. This decouples theme availability from MCP server initialization in
    startExtension().
  • Deduplication: Added ThemeManager.hasExtensionThemes() to track and prevent redundant theme registrations.

Related Issues

How to Validate

  1. Install or create an extension that provides a custom theme.
  2. Select that theme in your settings.
  3. Restart the CLI and verify it launches without errors and correctly applies the theme.
  4. Run the updated tests:
    npm test -w @google/gemini-cli -- src/config/extension-manager.test.ts src/ui/themes/theme-manager.test.ts

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

@jackwotherspoon jackwotherspoon requested a review from a team as a code owner March 12, 2026 10:28
@gemini-code-assist
Copy link
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 a critical issue where custom themes provided by extensions failed to load correctly on application startup, leading to errors and a degraded user experience. By shifting the theme registration process to an earlier stage in the extension loading sequence, themes are now available before the application's configuration is fully initialized. This ensures that users who have selected an extension theme will see it applied correctly and without errors immediately upon launching the application.

Highlights

  • Early Theme Registration: Implemented early registration of extension-provided themes during the extension loading lifecycle to ensure availability on startup.
  • Deduplication Mechanism: Introduced a deduplication mechanism using ThemeManager.hasExtensionThemes() to prevent redundant theme registrations.
  • Conditional Theme Registration: Updated startExtension() to conditionally register themes, skipping if already handled during the early load phase.
  • Enhanced Testing: Added comprehensive test cases to extension-manager.test.ts to validate early theme registration for active extensions and confirm inactive extensions do not register themes.
Changelog
  • packages/cli/src/config/extension-manager.test.ts
    • Imported themeManager and CustomTheme for theme-related testing.
    • Defined a testTheme object for use in new test cases.
    • Added themeManager.clearExtensionThemes() to the afterEach hook to ensure a clean state for theme tests.
    • Introduced a new test suite for "early theme registration" including tests for active and inactive extensions.
  • packages/cli/src/config/extension-manager.ts
    • Modified the startExtension method to include a check using themeManager.hasExtensionThemes() to prevent duplicate theme registration.
    • Added a new loop within loadExtensions to proactively register themes for active extensions before the full startExtension process.
    • Included early theme registration for dynamically loaded extensions within the loadExtension method.
  • packages/cli/src/ui/themes/theme-manager.ts
    • Added a new public method hasExtensionThemes(extensionName: string) to determine if themes for a specific extension have already been registered.
Activity
  • No human activity has been recorded on this pull request yet.
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.

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 correctly addresses an issue where extension themes were not available on startup by registering them earlier in the application lifecycle. The changes are logical and include corresponding tests. I've identified one opportunity to improve maintainability by refactoring duplicated code.

@jackwotherspoon jackwotherspoon changed the title fix: allow extension theme to be used on startup fix: register themes on extension load not startup Mar 12, 2026
@github-actions
Copy link

github-actions bot commented Mar 12, 2026

Size Change: +603 B (0%)

Total Size: 26.5 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 26.1 MB +603 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 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

compressed-size-action

@jackwotherspoon jackwotherspoon changed the title fix: register themes on extension load not startup fix: register themes on extension load not start Mar 12, 2026
@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Mar 12, 2026
@jackwotherspoon jackwotherspoon added this pull request to the merge queue Mar 12, 2026
Merged via the queue into main with commit 45faf4d Mar 12, 2026
27 checks passed
@jackwotherspoon jackwotherspoon deleted the extension-themes-fix branch March 12, 2026 13:51
@chrstnb
Copy link
Collaborator

chrstnb commented Mar 12, 2026

/patch preview

@github-actions
Copy link

🚀 [Step 1/4] Patch workflow(s) waiting for approval!

📋 Details:

  • Channels: preview
  • Commit: 45faf4d31b10792582cdce5ca693fc5a548d1edc
  • Workflows Created: 1

⏳ Status: The patch creation workflow has been triggered and is waiting for deployment approval. Please visit the specific workflow links below and approve the runs.

🔗 Track Progress:

github-actions bot pushed a commit that referenced this pull request Mar 12, 2026
# Conflicts:
#	packages/cli/src/config/extension-manager.test.ts
@github-actions
Copy link

🚀 [Step 2/4] Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. ⚠️ Resolve conflicts in the hotfix PR first: #22174
  2. Test your changes after resolving conflicts
  3. Once merged, the patch release will automatically trigger
  4. You'll receive updates here when the release completes

🔗 Track Progress:

@github-actions
Copy link

🚀 [Step 3/4] Patch Release Waiting for Approval!

📋 Release Details:

  • Environment: prod
  • Channel: preview → publishing to npm tag preview
  • Version: v0.34.0-preview.0
  • Hotfix PR: Merged ✅
  • Release Branch: release/v0.34.0-preview.0-pr-22148

⏳ Status: The patch release has been triggered and is waiting for deployment approval. Please visit the specific workflow run link below and approve the deployment. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions
Copy link

[Step 4/4] Patch Release Complete!

📦 Release Details:

🎉 Status: Your patch has been successfully released and published to npm!

📝 What's Available:

🔗 Links:

liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants