Skip to content

feat(cli): add temporary flag to disable workspace policies#20523

Merged
Abhijit-2592 merged 1 commit into
mainfrom
abhijit-2592-disable-workspace-policies
Feb 27, 2026
Merged

feat(cli): add temporary flag to disable workspace policies#20523
Abhijit-2592 merged 1 commit into
mainfrom
abhijit-2592-disable-workspace-policies

Conversation

@Abhijit-2592

Copy link
Copy Markdown
Contributor

Summary

Introduces a temporary disableWorkspacePolicies flag to the policy resolution logic. This allows bypassing workspace-level policy resolution even when a folder is trusted, helping to reduce friction during the auto-acceptance phase.

Details

  • Added disableWorkspacePolicies (default false) and its setter setDisableWorkspacePolicies to packages/cli/src/config/policy.ts.
  • Updated resolveWorkspacePolicyState to respect this flag.
  • Added a comprehensive unit test in packages/cli/src/config/policy.test.ts to verify the new behavior.
  • This change is part of an effort to streamline workspace trust and policy management.

Related Issues

Closes #20522

How to Validate

Run the unit tests specifically for policy configuration:

npm test -w @google/gemini-cli -- src/config/policy.test.ts

Verify that the new test case "should return empty state if disableWorkspacePolicies is true even if folder is trusted" passes.

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
      • npx
      • Docker
      • Podman
      • Seatbelt

@Abhijit-2592 Abhijit-2592 requested a review from a team as a code owner February 27, 2026 00:57
@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 implements a temporary mechanism to disable workspace-level policy resolution within the CLI. This change aims to streamline the auto-acceptance phase of policy management by providing a way to bypass workspace policies, even in trusted folders, thereby reducing friction and improving workflow efficiency for specific scenarios.

Highlights

  • New Feature Flag: Introduced a temporary disableWorkspacePolicies flag and its corresponding setter function to control workspace policy resolution.
  • Policy Resolution Logic Update: Modified the resolveWorkspacePolicyState function to conditionally bypass workspace policy resolution when the disableWorkspacePolicies flag is active.
  • Unit Test Coverage: Added a new comprehensive unit test to verify that policy resolution correctly returns an empty state when disableWorkspacePolicies is set to true, even if the folder is trusted.
Changelog
  • packages/cli/src/config/policy.test.ts
    • Imported disableWorkspacePolicies and setDisableWorkspacePolicies for testing purposes.
    • Added a new test case to assert that policy resolution yields an empty state when disableWorkspacePolicies is enabled.
    • Updated the description of an existing test case for improved clarity.
  • packages/cli/src/config/policy.ts
    • Added a new let variable disableWorkspacePolicies initialized to false.
    • Introduced an exported function setDisableWorkspacePolicies to programmatically control the disableWorkspacePolicies flag.
    • Modified the resolveWorkspacePolicyState function to incorporate a conditional check for !disableWorkspacePolicies before proceeding with workspace policy evaluation.
Activity
  • No specific activity (comments, reviews, or progress updates) 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 introduces a temporary disableWorkspacePolicies flag to bypass workspace policy resolution, which is a useful feature for testing and reducing friction. The implementation is straightforward and includes a corresponding unit test. The existing feedback suggesting refactoring the new test case to use beforeEach/afterEach for state management is valid and aligns with repository testing conventions, so it has been kept.

Comment thread packages/cli/src/config/policy.test.ts
@github-actions

github-actions Bot commented Feb 27, 2026

Copy link
Copy Markdown

Size Change: +64 B (0%)

Total Size: 25.7 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.2 MB +64 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592-disable-workspace-policies branch from 52b1f89 to 206f192 Compare February 27, 2026 01:20
@gemini-cli gemini-cli Bot added the area/enterprise Issues related to Telemetry, Policy, Quota / Licensing label Feb 27, 2026
@Abhijit-2592 Abhijit-2592 added this pull request to the merge queue Feb 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 27, 2026
@Abhijit-2592 Abhijit-2592 added this pull request to the merge queue Feb 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 27, 2026
Introduces 'disableWorkspacePolicies' flag to bypass workspace policy
resolution even in trusted folders. This is a temporary measure to
reduce friction while auto-accepting policies.

The flag is enabled (true) by default. Tests have been updated to
explicitly manage the flag state where necessary.

Closes #20522
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592-disable-workspace-policies branch from 206f192 to b662ab6 Compare February 27, 2026 17:13
@Abhijit-2592 Abhijit-2592 added this pull request to the merge queue Feb 27, 2026
Merged via the queue into main with commit 59c0e73 Feb 27, 2026
27 checks passed
@Abhijit-2592 Abhijit-2592 deleted the abhijit-2592-disable-workspace-policies branch February 27, 2026 17:36
galz10 added a commit that referenced this pull request Feb 27, 2026
BryanBradfo pushed a commit to BryanBradfo/gemini-cli that referenced this pull request Mar 5, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
warrenzhu25 pushed a commit to warrenzhu25/gemini-cli that referenced this pull request Apr 9, 2026
@sripasg sripasg added the size/m A medium sized PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/enterprise Issues related to Telemetry, Policy, Quota / Licensing size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): add temporary flag to disable workspace policies

3 participants