fix(cli): register extension lifecycle events in DebugProfiler#20101
Conversation
Summary of ChangesHello @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 Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
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>
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.
f169a27 to
329fbf8
Compare
- 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)
|
Hi @Adib234 — the failing 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. |
- 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)
…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.
Head branch was pushed to by a user without write access
46f0c65 to
69e14fc
Compare
| const extensionEvents = [ | ||
| 'extensionsStarting', | ||
| 'extensionsStopping', | ||
| ] as const; |
There was a problem hiding this comment.
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!
…e-gemini#20101) Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
…e-gemini#20101) Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
…e-gemini#20101) Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
…e-gemini#20101) Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
…e-gemini#20101) Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
…e-gemini#20101) Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
Summary
Registers extension lifecycle events (
extensionsStarting,extensionsStopping) inDebugProfilerto prevent false-positive idle frame warnings during extension loading.These events are emitted on
coreEventsbut are not part of theCoreEventenum, 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.