Skip to content

feat(cli): deprecate --allowed-tools and excludeTools in favor of policy engine#18508

Merged
Abhijit-2592 merged 6 commits intomainfrom
abhijit-2592/delete-tool-args
Feb 12, 2026
Merged

feat(cli): deprecate --allowed-tools and excludeTools in favor of policy engine#18508
Abhijit-2592 merged 6 commits intomainfrom
abhijit-2592/delete-tool-args

Conversation

@Abhijit-2592
Copy link
Contributor

@Abhijit-2592 Abhijit-2592 commented Feb 7, 2026

Summary

Deprecates the --allowed-tools CLI flag, tools.allowed, and tools.exclude configuration options in favor of the Policy Engine, unifying tool exclusion logic.

Details

This PR implements a two-phase deprecation plan for legacy tool permission flags, guiding users toward the Policy Engine.

1. Deprecate --allowed-tools / tools.allowed

  • CLI: Updated help description for --allowed-tools to indicate deprecation.
  • Runtime: Added a warning in gemini.tsx if allowedTools is used via CLI args or settings.
  • Core: Added @deprecated tags to allowedTools in Config properties.

2. Deprecate tools.exclude & Unify Exclusion Logic

  • Policy Engine: Implemented PolicyEngine.getExcludedTools() to expose effectively denied tools.
  • Config: Updated Config.getExcludeTools() to centrally aggregate exclusions from:
    • System defaults
    • Extensions
    • The Policy Engine
  • Runtime: Added a startup warning for tools.exclude usage in settings.json.
  • Core: Marked excludeTools as deprecated in Config parameters and class.
  • Compatibility: Maintained legacy exclude processing in Core's createPolicyEngineConfig while refactoring CLI usage to avoid redundancy.

Related Issues

Partial solution for #11302 as this only deprecates.

How to Validate

  1. Allowed Tools Warning:
    • Run gemini --allowed-tools="ShellTool".
    • Observe the warning: "The allowed-tools cli argument and tools.allowed setting are deprecated..."
  2. Exclude Tools Warning:
    • Add "tools": { "exclude": ["some_tool"] } to settings.json.
    • Run gemini.
    • Observe the warning about tools.exclude deprecation.
  3. Clean Run:
    • Run gemini without these flags/settings.
    • Observe no warnings.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

@Abhijit-2592 Abhijit-2592 requested a review from a team as a code owner February 7, 2026 04:40
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Abhijit-2592, 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 initiates the deprecation process for the --allowed-tools CLI flag and the tools.allowed configuration setting, aiming to transition users towards the more robust Policy Engine for managing tool permissions. While the functionality of the deprecated options remains for now, users will receive warnings prompting them to migrate. Additionally, the Policy Engine has been enhanced to provide a consolidated list of excluded tools, which is now integrated into the main configuration's tool exclusion logic.

Highlights

  • Deprecation of --allowed-tools: The --allowed-tools CLI flag and tools.allowed configuration option are now deprecated in favor of the Policy Engine.
  • Deprecation Notices and Warnings: Deprecation notices have been added to the CLI help and JSDoc. Runtime warnings will now be displayed when deprecated options are used, guiding users to migrate to the Policy Engine.
  • Policy Engine Enhancements: The Policy Engine now includes a getExcludedTools method to aggregate and identify tools that are effectively denied by policy rules, considering priorities and non-interactive mode.
  • Centralized Tool Exclusion Logic: The Config.getExcludeTools() method has been updated to incorporate exclusions determined by the Policy Engine, centralizing the logic for tool exclusion.
Changelog
  • packages/cli/src/config/config.test.ts
    • Updated test to reflect that exclude is no longer passed directly to createPolicyEngineConfig, as exclusions are now aggregated via Config.getExcludeTools().
  • packages/cli/src/config/config.ts
    • Added a deprecation notice to the description of the --allowed-tools CLI argument, directing users to the Policy Engine documentation.
    • Modified loadCliConfig to pass an empty exclude array to the Policy Engine configuration, with a comment explaining that exclusions are now centrally aggregated.
  • packages/cli/src/gemini.tsx
    • Implemented runtime warnings for both argv.allowedTools and settings.merged.tools.allowed when they are used, advising migration to the Policy Engine.
    • Added a runtime warning for settings.merged.tools.exclude usage, also recommending migration to the Policy Engine.
  • packages/core/src/config/config.ts
    • Added JSDoc @deprecated tags to allowedTools and excludeTools properties in ConfigParameters and Config class, pointing to the Policy Engine.
    • Updated the getExcludeTools method to include exclusions determined by the Policy Engine, in addition to existing sources.
    • Added a comment to getExcludeTools clarifying its backward compatibility role for settings.json exclude.
  • packages/core/src/policy/policy-engine.test.ts
    • Added new test suite for the getExcludedTools method, covering cases like empty rules, DENY decisions, priority handling, non-interactive mode (ASK_USER becomes DENY), and ignoring rules with argsPattern.
  • packages/core/src/policy/policy-engine.ts
    • Introduced a new public method getExcludedTools() which identifies tools effectively denied by the policy rules, considering global rules, priority, and non-interactive mode.
Activity
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.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

The pull request correctly introduces deprecation notices for the --allowed-tools CLI flag and tools.allowed configuration, guiding users toward the Policy Engine. It also implements a mechanism to hide denied tools from the LLM's discovery process by aggregating exclusions from the Policy Engine. However, there are two significant issues: the new getExcludedTools method in the PolicyEngine does not account for rule modes, which can lead to incorrect tool discovery filtering, and the CLI configuration now clears the exclude list before passing it to the Policy Engine, which removes the execution-level blocking for those tools. Addressing these will ensure that the deprecation phase remains secure and provides a consistent user experience.

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

Size Change: +3.34 kB (+0.01%)

Total Size: 24.3 MB

Filename Size Change
./bundle/gemini.js 24.3 MB +3.34 kB (+0.01%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/delete-tool-args branch from 0d74d22 to ea4dc1d Compare February 7, 2026 04:54
@Abhijit-2592 Abhijit-2592 changed the title feat(cli): deprecate --allowed-tools in favor of policy engine feat(cli): deprecate --allowed-tools and excludeTools in favor of policy engine Feb 7, 2026
@gemini-cli gemini-cli bot added the 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. label Feb 7, 2026
@Abhijit-2592 Abhijit-2592 requested a review from a team as a code owner February 7, 2026 05:32
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/delete-tool-args branch 2 times, most recently from 6d2fc32 to d9349f6 Compare February 9, 2026 18:31
@allenhutchison allenhutchison self-assigned this Feb 9, 2026
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/delete-tool-args branch 6 times, most recently from ebb4f9f to ff6eaf3 Compare February 11, 2026 02:33
Copy link
Collaborator

@allenhutchison allenhutchison left a comment

Choose a reason for hiding this comment

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

This looks pretty good to me but there is this question about allowed tools.

| `--experimental-acp` | - | boolean | - | Start in ACP (Agent Code Pilot) mode. **Experimental feature.** |
| `--experimental-zed-integration` | - | boolean | - | Run in Zed editor integration mode. **Experimental feature.** |
| `--allowed-mcp-server-names` | - | array | - | Allowed MCP server names (comma-separated or multiple flags) |
| `--allowed-tools` | - | array | - | **Deprecated.** Use the [Policy Engine](../core/policy-engine.md) instead. Tools that are allowed to run without confirmation (comma-separated or multiple flags) |
Copy link
Collaborator

Choose a reason for hiding this comment

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

So in chatting with @NTaylorMullen I think he wants to keep allowed-tools have you synced with him on this?

Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm

- Implement PolicyEngine.getExcludedTools() to expose effectively denied tools.
- Update Config.getExcludeTools() to centrally aggregate exclusions from system defaults, extensions, and the Policy Engine.
- Deprecate tools.exclude in settings.json with a single startup warning in the CLI.
- Mark excludeTools as deprecated in Core Config parameters and class.
- Ensure backward compatibility by maintaining legacy exclude processing in Core's createPolicyEngineConfig while bypassing it in the CLI to avoid redundancy.
- Add comprehensive tests for unified tool exclusion logic.
Deprecates the --allowed-tools CLI flag and tools.allowed configuration option. Emits a runtime warning when used and guides users to the Policy Engine for tool permission management.
- Update PolicyEngine.getExcludedTools() to filter rules based on the current approval mode.
- Pass merged excluded tools to createPolicyEngineConfig in the CLI to ensure execution-level blocking via DENY rules.
- Update tests to reflect that excluded tools are now passed to the Policy Engine configuration.
…rd rules

Updates the PolicyEngine to correctly handle global rules (rules without a specific tool name) and ensure wildcard rules cover matching tools. Also corrects the handling of ASK_USER tools in non-interactive mode.
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/delete-tool-args branch from 3c7c5cc to 88cb82b Compare February 11, 2026 22:58
Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm

@Abhijit-2592 Abhijit-2592 added this pull request to the merge queue Feb 12, 2026
@Abhijit-2592 Abhijit-2592 removed this pull request from the merge queue due to a manual request Feb 12, 2026
@Abhijit-2592 Abhijit-2592 added this pull request to the merge queue Feb 12, 2026
@Abhijit-2592 Abhijit-2592 removed this pull request from the merge queue due to a manual request Feb 12, 2026
@Abhijit-2592 Abhijit-2592 added this pull request to the merge queue Feb 12, 2026
Merged via the queue into main with commit 0e85e02 Feb 12, 2026
26 of 27 checks passed
@Abhijit-2592 Abhijit-2592 deleted the abhijit-2592/delete-tool-args branch February 12, 2026 01:04
krsjenmt added a commit to krsjenmt/gemini-cli that referenced this pull request Feb 12, 2026
…ini/gemini-cli (#37)

* fix(cli): resolve double rendering in shpool and address vscode lint warnings (google-gemini#18704)

* feat(plan): document and validate Plan Mode policy overrides (google-gemini#18825)

* Fix pressing any key to exit select mode. (google-gemini#18421)

* fix(cli): update F12 behavior to only open drawer if browser fails (google-gemini#18829)

* feat(plan): allow skills to be enabled in plan mode (google-gemini#18817)

Co-authored-by: Jerop Kipruto <jerop@google.com>

* docs(plan): add documentation for plan mode tools (google-gemini#18827)

* Remove experimental note in extension settings docs (google-gemini#18822)

* Update prompt and grep tool definition to limit context size (google-gemini#18780)

* docs(plan): add `ask_user` tool documentation (google-gemini#18830)

* Revert unintended credentials exposure (google-gemini#18840)

* feat(core): update internal utility models to Gemini 3 (google-gemini#18773)

* feat(a2a): add value-resolver for auth credential resolution (google-gemini#18653)

* Removed getPlainTextLength (google-gemini#18848)

* More grep prompt tweaks (google-gemini#18846)

* refactor(cli): Reactive useSettingsStore hook (google-gemini#14915)

* fix(mcp): Ensure that stdio MCP server execution has the `GEMINI_CLI=1` env variable populated. (google-gemini#18832)

* fix(core): improve headless mode detection for flags and query args (google-gemini#18855)

* refactor(cli): simplify UI and remove legacy inline tool confirmation logic (google-gemini#18566)

* feat(cli): deprecate --allowed-tools and excludeTools in favor of policy engine (google-gemini#18508)

* fix(workflows): improve maintainer detection for automated PR actions (google-gemini#18869)

* refactor(cli): consolidate useToolScheduler and delete legacy implementation (google-gemini#18567)

* Update changelog for v0.28.0 and v0.29.0-preview0 (google-gemini#18819)

* fix(core): ensure sub-agents are registered regardless of tools.allowed (google-gemini#18870)

---------

Co-authored-by: Brad Dux <959674+braddux@users.noreply.github.com>
Co-authored-by: Jerop Kipruto <jerop@google.com>
Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Sandy Tao <sandytao520@icloud.com>
Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
Co-authored-by: christine betts <chrstn@uw.edu>
Co-authored-by: Christian Gunderman <gundermanc@gmail.com>
Co-authored-by: Adam Weidman <65992621+adamfweidman@users.noreply.github.com>
Co-authored-by: Dev Randalpura <devrandalpura@google.com>
Co-authored-by: Pyush Sinha <pyushsinha20@gmail.com>
Co-authored-by: Richie Foreman <richie.foreman@gmail.com>
Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
Co-authored-by: Abhijit Balaji <abhijitbalaji@google.com>
Co-authored-by: Bryan Morgan <bryanmorgan@google.com>
Co-authored-by: g-samroberts <158088236+g-samroberts@users.noreply.github.com>
Co-authored-by: matt korwel <matt.korwel@gmail.com>
@jerop jerop linked an issue Feb 12, 2026 that may be closed by this pull request
@jerop jerop mentioned this pull request Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔒 maintainer only ⛔ Do not contribute. Internal roadmap item.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tools] Agent should not attempt to call shell tool in plan mode

3 participants