Skip to content

fix(cli): register extension lifecycle events in DebugProfiler#20101

Merged
Adib234 merged 4 commits intogoogle-gemini:mainfrom
fayerman-source:fix/debugprofiler-extension-events
Mar 4, 2026
Merged

fix(cli): register extension lifecycle events in DebugProfiler#20101
Adib234 merged 4 commits intogoogle-gemini:mainfrom
fayerman-source:fix/debugprofiler-extension-events

Conversation

@fayerman-source
Copy link
Contributor

Summary

Registers extension lifecycle events (extensionsStarting, extensionsStopping) in DebugProfiler to prevent false-positive idle frame warnings during extension loading.

These events are emitted on coreEvents but are not part of the CoreEvent enum, so the profiler was incorrectly treating them as unexpected renders.

Related

Extracted from #18499 as requested by @jacob314.

Testing

No new tests needed — this is a one-line event registration fix. Verified locally that the startup warnings no longer appear.

@fayerman-source fayerman-source requested a review from a team as a code owner February 24, 2026 00:05
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fayerman-source, 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 an issue in the DebugProfiler that led to incorrect idle frame warnings. By explicitly registering specific extension lifecycle events, the profiler now accurately accounts for these operations, preventing misleading diagnostic output and improving the reliability of performance monitoring during application startup.

Highlights

  • False-positive idle frame warnings: Addressed an issue where DebugProfiler was generating false-positive idle frame warnings during extension loading.
  • Extension lifecycle event registration: Registered extensionsStarting and extensionsStopping events with the DebugProfiler to correctly track their activity.
  • Event handling: Ensured that these specific extension lifecycle events, which are emitted on coreEvents but not part of the CoreEvent enum, are properly handled by the profiler.
Changelog
  • packages/cli/src/ui/components/DebugProfiler.tsx
    • Registered extensionsStarting and extensionsStopping events with coreEvents to prevent false-positive idle warnings.
    • Added corresponding cleanup for the newly registered event handlers.
Activity
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 registers extension lifecycle events in the DebugProfiler to prevent false-positive idle frame warnings. The change is straightforward and effective. I've added a couple of suggestions to refactor the event registration and cleanup logic to use a loop. This aligns with the existing coding patterns in the file, improves maintainability by reducing code duplication, and adheres to the repository's style guide.

@gemini-cli gemini-cli bot added priority/p2 Important but can be addressed in a future release. 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 Feb 24, 2026
fayerman-source added a commit to fayerman-source/gemini-cli that referenced this pull request Feb 24, 2026
Refactors extension event registration and cleanup into a for..of loop,
matching the existing pattern used for CoreEvent and AppEvent handlers.

Addresses code review feedback from gemini-code-assist on PR google-gemini#20101.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Adib234 Adib234 self-assigned this Feb 25, 2026
fayerman-source added a commit to fayerman-source/gemini-cli that referenced this pull request Feb 25, 2026
Refactors extension event registration and cleanup into a for..of loop,
matching the existing pattern used for CoreEvent and AppEvent handlers.

Addresses code review feedback from gemini-code-assist on PR google-gemini#20101.
@fayerman-source fayerman-source force-pushed the fix/debugprofiler-extension-events branch from f169a27 to 329fbf8 Compare February 25, 2026 20:23
@Adib234 Adib234 enabled auto-merge February 25, 2026 21:18
fayerman-source added a commit to fayerman-source/gemini-cli that referenced this pull request Feb 25, 2026
- Revert unrelated DebugProfiler hunk (extensionsStarting/Stopping
  listeners belong in PR google-gemini#20101, not voice PR)
- Remove showInDialog from parent voice object in settingsSchema
  (only child properties should have it)
- Escape key now calls cancelRecording() instead of toggleRecording()
  so it discards audio without transcribing; adds cancel() to
  VoiceBackend interface and both backends
- Move setImmediate yield out of GeminiRestBackend (core) into
  useVoiceInput (UI): onStateChange now returns Promise<void> so the
  UI layer can insert the yield after isTranscribing:true
- Replace LocalWhisperBackend stat polling loop with close event
  listener for cleaner process lifecycle handling
- /voice help now renders VoiceHelp component styled with theme
  colors matching /help (accent for commands, primary for labels)
- Fix 3 failing test files (log-volume, stress, replication): rewrite
  to mock @google/gemini-cli-core backends, use waitFor() from
  test-utils, fix afterEach spy cleanup to not reset module mocks
- Change debugLogger.log() to .debug() in useVoiceInput for internal
  tracing (prevents logSpy from catching them in tests)
@fayerman-source
Copy link
Contributor Author

Hi @Adib234 — the failing E2E (Chained) check appears to be unrelated to this PR. The failure is in hooks-agent-flow.test.ts on Windows (a BeforeTool hook returning "File writing blocked by security policy") alongside repeated AttachConsole failed errors. Neither is connected to the two coreEvents.on() registrations added here in DebugProfiler.tsx.

Could you re-run the E2E workflow or confirm whether this is a known flaky test? Happy to rebase if there's an upstream fix needed, but the code change itself should be clear.

@Adib234 Adib234 added this pull request to the merge queue Feb 27, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 27, 2026
fayerman-source added a commit to fayerman-source/gemini-cli that referenced this pull request Feb 28, 2026
- Revert unrelated DebugProfiler hunk (extensionsStarting/Stopping
  listeners belong in PR google-gemini#20101, not voice PR)
- Remove showInDialog from parent voice object in settingsSchema
  (only child properties should have it)
- Escape key now calls cancelRecording() instead of toggleRecording()
  so it discards audio without transcribing; adds cancel() to
  VoiceBackend interface and both backends
- Move setImmediate yield out of GeminiRestBackend (core) into
  useVoiceInput (UI): onStateChange now returns Promise<void> so the
  UI layer can insert the yield after isTranscribing:true
- Replace LocalWhisperBackend stat polling loop with close event
  listener for cleaner process lifecycle handling
- /voice help now renders VoiceHelp component styled with theme
  colors matching /help (accent for commands, primary for labels)
- Fix 3 failing test files (log-volume, stress, replication): rewrite
  to mock @google/gemini-cli-core backends, use waitFor() from
  test-utils, fix afterEach spy cleanup to not reset module mocks
- Change debugLogger.log() to .debug() in useVoiceInput for internal
  tracing (prevents logSpy from catching them in tests)
@Adib234 Adib234 added this pull request to the merge queue Mar 3, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 3, 2026
@Adib234 Adib234 enabled auto-merge March 3, 2026 16:27
…vent false-positive idle warnings

Extension events (extensionsStarting, extensionsStopping) are emitted on
coreEvents but not part of the CoreEvent enum, causing the DebugProfiler
to flag them as unexpected idle renders. Register handlers for these events
explicitly to suppress the spurious warnings.
Refactors extension event registration and cleanup into a for..of loop,
matching the existing pattern used for CoreEvent and AppEvent handlers.

Addresses code review feedback from gemini-code-assist on PR google-gemini#20101.
auto-merge was automatically disabled March 3, 2026 21:25

Head branch was pushed to by a user without write access

@fayerman-source fayerman-source force-pushed the fix/debugprofiler-extension-events branch from 46f0c65 to 69e14fc Compare March 3, 2026 21:25
Comment on lines +176 to +179
const extensionEvents = [
'extensionsStarting',
'extensionsStopping',
] as const;
Copy link
Contributor

Choose a reason for hiding this comment

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

One minor structural suggestion for DebugProfiler.tsx to consider for future
maintainability:

To make it easier to add new lifecycle events in the future without having to
update DebugProfiler, you might consider exporting a runtime constant array
alongside the ExtensionEvents interface definition (around line 247 in
packages/core/src/utils/extensionLoader.ts).

For example:

export const ExtensionLifecycleEvents = [
  'extensionsStarting',
  'extensionsStopping',
] as const;

export interface ExtensionEvents {
  // ...
}

If the profiler just imports and iterates over that core array instead, it will
automatically pick up any new extension events added to that list by future
developers. Just a thought for keeping the event strings centralized!

@Adib234 Adib234 enabled auto-merge March 4, 2026 02:39
@Adib234 Adib234 added this pull request to the merge queue Mar 4, 2026
Merged via the queue into google-gemini:main with commit 07d2187 Mar 4, 2026
27 checks passed
neeraj-par pushed a commit to neeraj-par/gemini-cli that referenced this pull request Mar 4, 2026
…e-gemini#20101)

Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
BryanBradfo pushed a commit to BryanBradfo/gemini-cli that referenced this pull request Mar 5, 2026
…e-gemini#20101)

Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
struckoff pushed a commit to struckoff/gemini-cli that referenced this pull request Mar 6, 2026
…e-gemini#20101)

Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 12, 2026
…e-gemini#20101)

Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
…e-gemini#20101)

Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
yashodipmore pushed a commit to yashodipmore/geemi-cli that referenced this pull request Mar 21, 2026
…e-gemini#20101)

Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
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! priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants