Skip to content

fix: destructive actions from ambiguous user prompts - #782

Merged
henrypark133 merged 3 commits into
stagingfrom
fix/agent-destructive-actions
Mar 10, 2026
Merged

henrypark133 merged 3 commits into
stagingfrom
fix/agent-destructive-actions

Conversation

@nickpismenkov

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions Bot added scope: tool/builtin Built-in tools size: M 50-199 changed lines risk: medium Business logic, config, or moderate-risk modules contributor: experienced 6-19 merged PRs labels Mar 9, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Enhanced User Prompts for Destructive Actions: The descriptions for both ToolRemoveTool and SkillRemoveTool have been updated to explicitly warn users about the permanent and irreversible nature of these operations, emphasizing that data and configuration files will be deleted.
  • Mandatory Approval for Destructive Operations: The requires_approval method for ToolRemoveTool and SkillRemoveTool has been changed from UnlessAutoApproved to Always, ensuring that these potentially destructive actions always require explicit user approval.
  • New Unit Tests for Approval Requirements: New tests were added for both ToolRemoveTool and SkillRemoveTool to verify that they consistently require approval, regardless of auto-approval settings or specific parameters, reinforcing the safety measures.
Changelog
  • src/tools/builtin/extension_tools.rs
    • Updated the description of the ToolRemoveTool to clearly state its permanent and irreversible nature.
    • Modified the requires_approval method for ToolRemoveTool to always demand explicit approval.
    • Added new tests to validate that ToolRemoveTool consistently requires approval.
  • src/tools/builtin/skill_tools.rs
    • Updated the description of the SkillRemoveTool to clearly state its permanent and irreversible nature.
    • Modified the requires_approval method for SkillRemoveTool to always demand explicit approval.
    • Added new tests to validate that SkillRemoveTool consistently requires approval.
Activity
  • No specific activity has been recorded for this pull request yet.
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. ↩

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

Copy link
Copy Markdown
Contributor

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 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.

Comment thread src/tools/builtin/extension_tools.rs Outdated
Comment thread src/tools/builtin/skill_tools.rs Outdated
@nickpismenkov nickpismenkov linked an issue Mar 9, 2026 that may be closed by this pull request
@github-actions github-actions Bot added the scope: agent Agent core (agent loop, router, scheduler) label Mar 9, 2026

@zmanian zmanian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@henrypark133
henrypark133 merged commit 7d8576a into staging Mar 10, 2026
22 checks passed
@henrypark133
henrypark133 deleted the fix/agent-destructive-actions branch March 10, 2026 01:03
xiaocan66 pushed a commit to xiaocan66/ironclaw that referenced this pull request Mar 10, 2026
* fix: destructive actions from ambiguous user prompts

* review fixes

* review fixes
xiaocan66 pushed a commit to xiaocan66/ironclaw that referenced this pull request Mar 10, 2026
* fix: destructive actions from ambiguous user prompts

* review fixes

* review fixes
pikaxinge pushed a commit to pikaxinge/ironclaw that referenced this pull request Mar 10, 2026
* fix: destructive actions from ambiguous user prompts

* review fixes

* review fixes
@zmanian zmanian mentioned this pull request Mar 11, 2026
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
* fix: destructive actions from ambiguous user prompts

* review fixes

* review fixes
drchirag1991 pushed a commit to drchirag1991/ironclaw that referenced this pull request Apr 8, 2026
* fix: destructive actions from ambiguous user prompts

* review fixes

* review fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: experienced 6-19 merged PRs risk: medium Business logic, config, or moderate-risk modules scope: agent Agent core (agent loop, router, scheduler) scope: tool/builtin Built-in tools size: M 50-199 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent: destructive actions from ambiguous user prompts

3 participants