refactor(core): replace manual syncPlanModeTools with declarative policy rules#20596
refactor(core): replace manual syncPlanModeTools with declarative policy rules#20596
Conversation
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 refactors the management of plan-related tool visibility by transitioning from an imperative, code-driven synchronization mechanism to a declarative, policy-based approach. This change centralizes tool visibility logic within the Policy Engine, making it more consistent and easier to manage across different operational modes. The primary impact is a cleaner, more robust system for controlling which tools are available to the model based on the current approval mode, enhancing maintainability and reducing potential for inconsistencies. Highlights
Changelog
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
|
76c386d to
da3ed4d
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the management of plan-related tools (enter_plan_mode and exit_plan_mode) by replacing the imperative syncPlanModeTools method with declarative policy rules. The logic for enabling or disabling these tools based on the current ApprovalMode is now handled by DENY rules in the plan.toml, write.toml, and yolo.toml policy files. The Config class is simplified by removing the manual synchronization logic, and tests have been updated to reflect this new declarative approach. The plan-related tools are now always registered if the feature is enabled, with their visibility controlled by the policy engine.
|
Size Change: -1.19 kB (0%) Total Size: 25.8 MB
ℹ️ View Unchanged
|
971148d to
926dabb
Compare
…icy rules Unified plan-related tool visibility management by leveraging the existing Policy Engine instead of imperative registration/unregistration. Key changes: - Removed syncPlanModeTools from Config class and its calls during initialization and mode transitions. - Added declarative DENY rules to plan.toml, write.toml, and yolo.toml to control enter_plan_mode and exit_plan_mode visibility based on the current ApprovalMode. - Updated Config.createToolRegistry to always register plan tools if the feature is enabled. - Refactored updateApprovalMode to refresh the model's toolset via geminiClient.setTools() when transitioning between modes. - Updated tests to reflect policy-based filtering and removed obsolete sync tests. Closes #20595
926dabb to
981d5c4
Compare
981d5c4 to
d2a0c6f
Compare
d2a0c6f to
0408daa
Compare
Unified plan-related tool visibility management by leveraging the existing Policy Engine instead of imperative registration/unregistration.
Key changes:
Closes #20595
Plan mode has
ExitPlanModetoolDefault mode has

EnterPlanModetoolAuto-Edit mode has

EnterPlanModetoolYOLO mode does not have

EnterPlanModeorEnterPlanModetools