Skip to content

Comments

fix(core): clarify plan mode constraints and exit mechanism#19438

Merged
jerop merged 1 commit intomainfrom
fix/plan-mode-evals
Feb 18, 2026
Merged

fix(core): clarify plan mode constraints and exit mechanism#19438
jerop merged 1 commit intomainfrom
fix/plan-mode-evals

Conversation

@jerop
Copy link
Contributor

@jerop jerop commented Feb 18, 2026

Fixes #19437

  • Added explicit Rule 5 to system prompt to refuse direct code modification in Plan Mode and proactively explain the restriction.
  • Enhanced exit_plan_mode tool description to emphasize its role as the mandatory approval and exit mechanism, reducing "policy surprise" failures.
  • Improved test signal in plan_mode.eval.ts with explicit user approval to stabilize model behavior during transitions.

@jerop jerop requested a review from a team as a code owner February 18, 2026 15:46
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jerop, 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 clarifies the operational boundaries and exit procedures for the system's 'Plan Mode'. The changes aim to prevent the model from attempting direct code modifications when it should be planning, and to ensure a clear, user-approved transition from planning to implementation. This improves the model's adherence to its operational policies and enhances the user experience by making the workflow more predictable.

Highlights

  • Plan Mode Constraints: An explicit Rule 5 has been added to the system prompt, instructing the model to refuse direct code modification while in Plan Mode and to proactively explain this restriction to the user.
  • Exit Mechanism Clarity: The description of the exit_plan_mode tool has been enhanced to clearly state its mandatory role as the approval and exit mechanism for Plan Mode, aiming to reduce 'policy surprise' failures.
  • Improved Test Signal: The test signal in plan_mode.eval.ts has been improved by adding explicit user approval to the prompt, which helps stabilize model behavior during transitions from planning to implementation.
Changelog
  • evals/plan_mode.eval.ts
    • Updated the test prompt to explicitly include user approval for plan implementation.
  • packages/core/src/prompts/snippets.ts
    • Added Rule 5 to the system prompt, instructing the model to refuse direct code modification in Plan Mode and use the exit_plan_mode tool.
  • packages/core/src/tools/definitions/dynamic-declaration-helpers.ts
    • Enhanced the description of the exit_plan_mode tool to emphasize its mandatory use for exiting Plan Mode and enabling source code edits.
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.

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

  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.

@github-actions
Copy link

github-actions bot commented Feb 18, 2026

Size Change: +467 B (0%)

Total Size: 24.5 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 24.5 MB +467 B (0%)
./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

compressed-size-action

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 effectively clarifies the constraints and exit mechanism for the experimental 'Plan Mode'. The changes include updating the system prompt with a new rule to handle requests for direct code modification, enhancing the description of the exit_plan_mode tool to be more explicit about its purpose, and strengthening a test case to improve its reliability. These modifications are well-aligned with the goal of making the model's behavior more predictable and robust when operating in Plan Mode. The changes are clear, targeted, and represent a solid improvement.

@gemini-cli gemini-cli bot added area/core Issues related to User Interface, OS Support, Core Functionality area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Feb 18, 2026
@jerop jerop force-pushed the fix/plan-mode-evals branch 3 times, most recently from 3b9f36d to 8bb6b4b Compare February 18, 2026 18:30
Fixes #19437

- Added explicit Rule 5 to system prompt to refuse direct code modification in Plan Mode and proactively explain the restriction.
- Enhanced exit_plan_mode tool description to emphasize its role as the mandatory approval and exit mechanism, reducing "policy surprise" failures.
- Improved test signal in plan_mode.eval.ts with explicit user approval to stabilize model behavior during transitions.
@jerop jerop force-pushed the fix/plan-mode-evals branch from 8bb6b4b to 5e93694 Compare February 18, 2026 19:46
@jerop jerop enabled auto-merge February 18, 2026 19:47
@jerop jerop added this pull request to the merge queue Feb 18, 2026
Merged via the queue into main with commit 8f6a711 Feb 18, 2026
27 checks passed
@jerop jerop deleted the fix/plan-mode-evals branch February 18, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Agent] Reduce policy failures due to implicit constraints during planning

2 participants