fix: destructive actions from ambiguous user prompts - #782
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 enhances the safety of destructive operations within the system by making user prompts more explicit about the consequences of removing extensions or skills. It also enforces a mandatory approval process for these actions, preventing accidental data loss and improving the overall robustness of the system against unintended user input. Highlights
Changelog
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
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a critical safety issue by ensuring that destructive actions (tool_remove and skill_remove) always require explicit user approval. The changes are well-implemented: the tool descriptions are now more explicit about the permanent nature of the removal, and the approval requirement is rightly set to Always. The addition of tests to enforce this behavior is a great improvement. I've included a couple of minor suggestions to consolidate the new tests for better maintainability, aligning with good test practices, but overall, this is an excellent and important fix.
zmanian
left a comment
There was a problem hiding this comment.
Review
Changes tool_remove and skill_remove from ApprovalRequirement::UnlessAutoApproved to ApprovalRequirement::Always, and updates descriptions to emphasize permanence.
Analysis
- Correct change: Destructive tools that delete files from disk should always require explicit approval, even if previously auto-approved in a session. The old behavior allowed the LLM to auto-approve deletion after the first manual approval, which is a prompt injection risk -- a malicious prompt could trick the LLM into removing extensions/skills.
- Description updates ("Permanently remove... This action cannot be undone") are appropriate for tools that require Always approval.
Tests
Both new tests (tool_remove_always_requires_approval_regardless_of_params, skill_remove_always_requires_approval_regardless_of_params) exercise the approval requirement with multiple param combinations.
The dispatcher-level tests (test_always_approval_requirement_bypasses_session_auto_approve, test_always_approval_requirement_vs_unless_auto_approved) verify the approval logic at the session level -- good end-to-end coverage.
Clean, focused PR. LGTM.
* fix: destructive actions from ambiguous user prompts * review fixes * review fixes
* fix: destructive actions from ambiguous user prompts * review fixes * review fixes
* fix: destructive actions from ambiguous user prompts * review fixes * review fixes
* fix: destructive actions from ambiguous user prompts * review fixes * review fixes
* fix: destructive actions from ambiguous user prompts * review fixes * review fixes
No description provided.