Skip to content

fix(cli): resolve missing F12 logs via global console store#24235

Merged
scidomino merged 2 commits into
mainfrom
tomm_log
Mar 30, 2026
Merged

fix(cli): resolve missing F12 logs via global console store#24235
scidomino merged 2 commits into
mainfrom
tomm_log

Conversation

@scidomino

@scidomino scidomino commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the "Detailed Error View" (F12) being empty when first opened.

Details

This PR resolves a regression introduced in PR #23080 where console message state was moved into the DetailedMessagesDisplay component. Because that component unmounts when the debug view is hidden, all logs emitted while the view was closed were lost.

Changes:

  • Global Module Store: Moved console message state and error counts into a global, module-level store in useConsoleMessages.ts. This ensures logs are captured from the moment the file is imported, regardless of component lifecycle.
  • Modern React State: Updated useConsoleMessages and useErrorCount to use React 18's useSyncExternalStore for optimized, decoupled updates that bypass unnecessary root-level re-renders.
  • Simplified API: Removed the unused clearConsoleMessages production function and updated the hook to return the message array directly.

Related Issues

Fixes #23815

How to Validate

Modify the workspace settings.json to set "devtools": false.
Open the CLI, perform actions that generate logs, then hit F12. The logs generated while the view was closed should now be visible immediately.

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

@scidomino

Copy link
Copy Markdown
Collaborator Author

/gemini review

@github-actions

github-actions Bot commented Mar 30, 2026

Copy link
Copy Markdown

Size Change: -1.56 kB (-0.01%)

Total Size: 26.5 MB

Filename Size Change
./bundle/chunk-DVPZ2ZXD.js 0 B -14.7 MB (removed) 🏆
./bundle/chunk-PYKNZK6Q.js 0 B -3.78 MB (removed) 🏆
./bundle/core-FG3CCXRJ.js 0 B -44.5 kB (removed) 🏆
./bundle/devtoolsService-PZADM62I.js 0 B -28.4 kB (removed) 🏆
./bundle/interactiveCli-SJ3YPM2E.js 0 B -1.63 MB (removed) 🏆
./bundle/oauth2-provider-HP3FVLBJ.js 0 B -9.16 kB (removed) 🏆
./bundle/chunk-H5646GTI.js 14.7 MB +14.7 MB (new file) 🆕
./bundle/chunk-OJSDYRXI.js 3.78 MB +3.78 MB (new file) 🆕
./bundle/core-VDJHOSA3.js 44.5 kB +44.5 kB (new file) 🆕
./bundle/devtoolsService-GW54LE7P.js 28.4 kB +28.4 kB (new file) 🆕
./bundle/interactiveCli-PV2NPHDQ.js 1.63 MB +1.63 MB (new file) 🆕
./bundle/oauth2-provider-CVCGPTKM.js 9.16 kB +9.16 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./bundle/chunk-34MYV7JD.js 2.45 kB 0 B
./bundle/chunk-5AUYMPVF.js 858 B 0 B
./bundle/chunk-664ZODQF.js 124 kB 0 B
./bundle/chunk-DAHVX5MI.js 206 kB 0 B
./bundle/chunk-IUUIT4SU.js 56.5 kB 0 B
./bundle/chunk-QGLNP2IW.js 1.96 MB 0 B
./bundle/chunk-RJTRUG2J.js 39.8 kB 0 B
./bundle/chunk-U4FACSVX.js 1.13 kB 0 B
./bundle/devtools-36NN55EP.js 696 kB 0 B
./bundle/dist-T73EYRDX.js 356 B 0 B
./bundle/events-CLX3JQHP.js 418 B 0 B
./bundle/gemini.js 532 kB +54 B (+0.01%)
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB 0 B
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB 0 B
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB 0 B
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB 0 B
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB 0 B
./bundle/memoryDiscovery-XKQPPGVK.js 922 B 0 B
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 222 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 229 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 13.4 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
./bundle/src-QVCVGIUX.js 47 kB 0 B
./bundle/tree-sitter-7U6MW5PS.js 274 kB 0 B
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB 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 refactors the console message management by moving the state from a component-local useReducer to a global store using useSyncExternalStore. This change ensures that console history is preserved even when UI components are unmounted. The event listeners for coreEvents are now registered at the module level. Corresponding updates were made to the DetailedMessagesDisplay component and the test suites to accommodate the change in the hook's return type and the global nature of the store. I have no feedback to provide.

@scidomino scidomino marked this pull request as ready for review March 30, 2026 17:48
@scidomino scidomino requested a review from a team as a code owner March 30, 2026 17:48
@gemini-code-assist

Copy link
Copy Markdown
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 regression where console logs were lost when the 'Detailed Error View' (F12) component was unmounted. By shifting the state management to a global module-level store, logs are now persisted continuously, ensuring they are available immediately upon opening the debug view.

Highlights

  • Global Console Store: Moved console message state and error counts into a module-level store to ensure logs are captured independently of component lifecycle.
  • React State Optimization: Migrated to React 18's useSyncExternalStore for optimized, decoupled state updates.
  • API Simplification: Removed the unused clearConsoleMessages function and updated the hook to return the message array directly.
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.

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.

@gemini-cli gemini-cli Bot added priority/p1 Important and should be addressed in the near term. area/core Issues related to User Interface, OS Support, Core Functionality labels Mar 30, 2026

@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 refactors the console message management by moving the state from a component-level useReducer to a global store. This change ensures that console logs and error counts are preserved even when the UI components are unmounted. The implementation now utilizes useSyncExternalStore for state subscriptions. Feedback is provided regarding the lack of explicit unit tests for the refactored useErrorCount hook and the requirement to call unmount in tests to prevent resource leaks.

Comment thread packages/cli/src/ui/hooks/useConsoleMessages.test.tsx
Comment thread packages/cli/src/ui/hooks/useConsoleMessages.ts Outdated
Comment thread packages/cli/src/ui/hooks/useConsoleMessages.test.tsx

@jacob314 jacob314 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.

lgtm

@scidomino scidomino enabled auto-merge March 30, 2026 18:26
@scidomino scidomino disabled auto-merge March 30, 2026 20:15
@scidomino scidomino merged commit 44cdb3e into main Mar 30, 2026
26 of 27 checks passed
@scidomino scidomino deleted the tomm_log branch March 30, 2026 20:15
@scidomino

Copy link
Copy Markdown
Collaborator Author

/patch preview

@github-actions

Copy link
Copy Markdown

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

📋 Details:

  • Channels: preview
  • Commit: 44cdb3e3768b505f4cb36d5211d701accb2c57c2
  • 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

Copy link
Copy Markdown

🚀 [Step 2/4] Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. Review and approve the hotfix PR: #24265
  2. Once merged, the patch release will automatically trigger
  3. You'll receive updates here when the release completes

🔗 Track Progress:

@scidomino scidomino mentioned this pull request Mar 30, 2026
kalenkevich pushed a commit to kalenkevich/gemini-cli that referenced this pull request Apr 3, 2026
warrenzhu25 pushed a commit to warrenzhu25/gemini-cli that referenced this pull request Apr 9, 2026
@sripasg sripasg added the size/l A large 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

area/core Issues related to User Interface, OS Support, Core Functionality priority/p1 Important and should be addressed in the near term. size/l A large sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detailed error view missing logs when first opened

3 participants