fix(agent): prevent exit_plan_mode from being called via shell#26230
fix(agent): prevent exit_plan_mode from being called via shell#26230Abhijit-2592 merged 2 commits intomainfrom
Conversation
This commit updates the system prompt snippets to explicitly forbid the agent from calling the `exit_plan_mode` tool via `run_shell_command`. This addresses an issue where the model hallucinates the tool as a CLI command. Also adds a behavioral evaluation to verify the fix. Fixes #25047
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 an issue where the agent incorrectly attempts to call the exit_plan_mode tool as a shell command. By updating the system prompts to include explicit instructions against this behavior and adding a corresponding behavioral evaluation, the change ensures more reliable tool usage and prevents model hallucinations regarding CLI interactions. 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
|
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
|
Size Change: +279 B (0%) Total Size: 33.9 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request updates the documentation and prompt instructions to explicitly warn against calling the exit_plan_mode tool via run_shell_command, emphasizing that it must be used as a built-in tool. Additionally, a new behavioral test has been added to verify that the agent correctly invokes exit_plan_mode as a tool rather than a shell command. I have no feedback to provide as there are no review comments.
Summary
This PR prevents the agent from erroneously attempting to call the
exit_plan_modetool via therun_shell_commandtool when operating in Plan Mode.Details
In certain scenarios, the agent would hallucinate treating
exit_plan_modeas a CLI command because the system prompts allowed generic shell execution. The core system prompts (snippets.tsandsnippets.legacy.ts) have been updated with a strict, critical mandate explicitly forbidding the execution ofexit_plan_modeviarun_shell_command. Additionally, a behavioral evaluation was added to ensure the agent invokes the tool directly instead of using a shell subprocess.Related Issues
Fixes #25047
How to Validate
exit_plan_modetool directly and does not attempt to invoke it viarun_shell_command.Pre-Merge Checklist