fix: systemMessage visibility in interactive mode#23395
fix: systemMessage visibility in interactive mode#23395dpavlin wants to merge 1 commit intogoogle-gemini:mainfrom
Conversation
1eb11e7 to
7fa39be
Compare
Summary of ChangesHello, 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 visibility issue where system messages generated by agent hooks ('BeforeAgent' and 'AfterAgent') were often ignored by the client and not displayed in the user interface. By introducing a first-class 'GeminiEventType.SystemMessage' and updating both the core client and the CLI, these important notifications are now consistently yielded and rendered in real-time, significantly improving the user experience by providing immediate feedback on agent activities. This ensures that users are informed about background processes, such as prompt expansions, as they happen. Highlights
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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the visibility of systemMessage from hooks by introducing a dedicated SystemMessage event type. The changes are well-implemented across the core client and the CLI's interactive UI, ensuring these messages are now rendered dynamically. The addition of comprehensive unit tests for both the client and UI hooks is a great way to verify the new behavior. I have one suggestion for the non-interactive CLI mode to improve consistency.
Note: Security Review did not run due to the size of the PR.
0d8e258 to
8898e07
Compare
8898e07 to
1d0528b
Compare
Description
Currently,
systemMessagenotifications returned by hooks (BeforeAgentandAfterAgent) are only rendered by the Gemini CLI terminal if the hook returnsdecision: 'deny'. For all other hook results (e.g., addingadditionalContext), any providedsystemMessageis silently ignored by the client and never reaches the UI.This PR introduces a first-class
GeminiEventType.SystemMessageto the protocol, ensuring that these notifications are yielded by theGeminiClientand rendered dynamically in the terminal UI during an active turn.Fixes #23427
Changes
packages/coreGeminiEventType.SystemMessageto theServerGeminiStreamEventunion.GeminiClientto yield aSystemMessageevent whenever a hook fires and returns asystemMessage, regardless of whether the execution is blocked.client.test.tsto verify event yielding for bothBeforeAgentandAfterAgent.packages/clipendingSystemMessagesstate inuseGeminiStreamto track notifications during an active turn.pendingHistoryItemslogic to include these messages, allowing them to render live above the Thinking block or model response.stderrwith an[INFO]prefix.useGeminiStream.test.tsxto verify correct handling and display of the new event type.