fix(acp): resolve agent mode disconnect and improve mode awareness#26332
fix(acp): resolve agent mode disconnect and improve mode awareness#26332
Conversation
|
Hi @sripasg, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
|
Size Change: +1.9 kB (+0.01%) Total Size: 33.9 MB
ℹ️ View Unchanged
|
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 synchronization issues between the ACP client and the agent regarding operational modes (Plan, Default, YOLO, Auto-Edit). By implementing a robust event-based notification system, the changes ensure that both the agent's internal state and the client's UI remain aligned. Additionally, the agent's system prompt has been enhanced to include the current mode, improving the agent's contextual awareness during task execution. 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 implements a mechanism to track and propagate changes to the approval mode across the application. It introduces a new ApprovalModeChanged event, updates the system prompt to reflect the current operating mode (Default, Plan, YOLO, or Auto-Edit), and ensures that both the GeminiClient and ACP sessions respond to these changes. Feedback is provided regarding a potential memory leak in acpSession.ts due to missing event listener cleanup and an optimization to prevent redundant event emissions in config.ts.
Note: Security Review is unavailable for this PR.
|
✅ 66 tests passed successfully on gemini-3-flash-preview. 🧠 Model Steering GuidanceThis PR modifies files that affect the model's behavior (prompts, tools, or instructions).
This is an automated guidance message triggered by steering logic signatures. |
Fixes the disconnect between JetBrains IDE UI and the agent regarding the agent mode (Plan, Default, YOLO, Auto-Edit). Addresses both the scenario where the agent ignores a mode change from the client, and the scenario where the UI is not updated after an internal mode change. Also improves prompt to make agent aware of current mode. - Added ApprovalModeChanged event to CoreEvent. - Emitted it in Config.setApprovalMode (only when mode actually changes). - Listened to it in GeminiClient to update system instructions. - Listened to it in Session to send sessionUpdate to client. - Included current mode in the preamble of the system prompt in snippets.ts and promptProvider.ts. - Updated snapshots and tests. - Fixed test failures in config.test.ts by updating mock. - Implemented dispose mechanism for Session to avoid memory leaks.
Summary
Fixes the disconnect between ACP Client ( such as JetBrains/Zed ) and the agent regarding the agent mode (
Plan,Default,YOLO,Auto-Edit). Addresses both the scenario where the agent ignores a mode change from the client, and the scenario where the UI is not updated after an internal mode change. Also improves prompt to make agent aware of current mode.Details
To resolve the issue :
ApprovalModeChangedevent toCoreEvent.Config.setApprovalMode().sessionUpdate()to client.snippets.tsandpromptProvider.ts.Related Issues
Fixes google-gemini/maintainers-gemini-cli#1647
How to Validate
Pre-Merge Checklist