feat(plan): enforce read-only constraints in Plan Mode#19433
feat(plan): enforce read-only constraints in Plan Mode#19433mattKorwel merged 8 commits intomainfrom
Conversation
… in Plan Mode - Update Plan Mode policy to explicitly deny write_file and replace operations on source code. - Restrict ToolRegistry to only allow read-only tools and plan-related write operations when in Plan Mode. - Enhance tool schemas in Plan Mode with descriptions explicitly limiting write_file and replace to the designated plans directory. - Update Plan Mode system prompts to clarify behavioral rules and the requirement for approved plans before source code modifications. - Standardize formatting in strict-development-rules.md.
Summary of ChangesHello @mattKorwel, 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 significantly strengthens the read-only constraints within Plan Mode. It ensures that the agent cannot inadvertently modify source code by explicitly denying write operations, guiding the model through updated prompts, and dynamically filtering available tools. This change aims to improve the safety and predictability of the agent's behavior when operating in a planning context, preventing unintended direct code modifications. Highlights
Changelog
Ignored Files
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
|
|
Size Change: +1.43 kB (+0.01%) Total Size: 25.2 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request aims to enforce read-only constraints in Plan Mode. The changes to the system prompts and tool registry correctly implement the desired restrictions at the prompt and tool availability levels. However, there is a critical issue in the plan.toml policy file where an incorrect tool name (replace instead of edit) is used. This will cause the policy rules for editing files in Plan Mode to be ineffective, undermining the goal of this PR. The suggested fix also aligns with the repository's rule for consolidating policy rules for multiple tools into a single rule using an array for toolName.
|
I have updated the PR to address the intent of the review. Regarding the tool name suggestion: the canonical tool name in this codebase is 'replace' (as defined in coreTools.ts). I have verified that 'replace' is the correct name to use in policy files to match the model's tool calls. I've restored the explicit deny rules using the correct 'replace' name and re-applied the other improvements to tool schemas and prompts. |
…edback" This reverts commit ad35c74.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Jerop Kipruto <jerop@google.com>
This PR enforces strict read-only constraints when the agent is in Plan Mode.
Key changes: