Skip to content

Require human confirmation for delete_files - #7656

Open
sai5880 wants to merge 1 commit into
google:mainfrom
sai5880:fix/delete-files-confirmation-7655
Open

sai5880 wants to merge 1 commit into
google:mainfrom
sai5880:fix/delete-files-confirmation-7655

Conversation

@sai5880

@sai5880 sai5880 commented Oct 21, 2026

Copy link
Copy Markdown

Summary

Fixes #7655. delete_files had confirm_deletion: bool = True in its tool signature, so the model controlled the approval flag and the tool never used the framework human-in-the-loop confirmation gate. The flag has been removed and the tool now requires confirmation through the framework.

Changes

  • Removed the confirm_deletion parameter and the early-return block from src/google/adk/cli/built_in_agents/tools/delete_files.py.
  • Updated the docstring so it states that confirmation is collected by the framework, not supplied as an argument.
  • Registered the tool as FunctionTool(delete_files, require_confirmation=True) in src/google/adk/cli/built_in_agents/adk_agent_builder_assistant.py.
  • Removed the stale confirm_deletion=True argument from tests/unittests/cli/test_resolve_root_directory.py.
  • Added tests/unittests/cli/test_delete_files.py, which verifies that the registered tool requires confirmation, that a model-supplied confirm_deletion argument cannot bypass the gate, and that an approved call still deletes the file.
  • Checked the other tools on the same assistant. cleanup_unused_files only scans and does not delete, and no other write/delete tool used this flag.

Tests

uv run pytest tests/unittests/cli/test_delete_files.py tests/unittests/cli/test_resolve_root_directory.py tests/unittests/cli/test_adk_agent_builder_assistant.py -q

Result: 19 passed.

Fixes #7655

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

delete_files confirmation is a model-controlled tool argument

2 participants