fix(agent): prevent silent scope expansion on task failure#28172
fix(agent): prevent silent scope expansion on task failure#28172Suryap-hub wants to merge 1 commit into
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 addresses an issue where the agent would silently expand its operational scope upon task failure. By updating the mandateConfirm function with stricter prompt guardrails, the agent is now explicitly instructed to seek user approval before changing strategies, reading beyond requested line ranges, or executing investigative shell commands. 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 the 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 counterproductive. 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
|
|
📊 PR Size: size/XS
|
🛑 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. |
|
Hey team! 👋 This is my first open source contribution. I noticed issue #28155 The fix adds 3 guardrails to the
Happy to make any changes based on your feedback! |
There was a problem hiding this comment.
Code Review
This pull request updates the mandateConfirm prompt helper in packages/core/src/prompts/snippets.ts to enforce stricter boundaries on agent behavior. It adds explicit instructions for both interactive and non-interactive modes to prevent silent approach changes, restrict file reading to requested boundaries, and require user confirmation before running shell commands or escalating investigations. I have no feedback to provide.
Fixes #28155
Problem
When asked to review a specific set of lines, the agent silently
expanded its scope — running scripts and reading the full file
without user approval.
Root Cause
The
mandateConfirmfunction insnippets.tslacked explicitinstructions to prevent silent strategy escalation.
Fix
Added 3 guardrails to
mandateConfirminpackages/core/src/prompts/snippets.ts:Testing
npm run build -w packages/core✅npm test -w packages/core✅