Skip to content

feat(cli): hide workspace policy update dialog and auto-accept by default#20351

Merged
Abhijit-2592 merged 2 commits into
mainfrom
abhijit-2592/hide-policy-dialogv2
Feb 26, 2026
Merged

feat(cli): hide workspace policy update dialog and auto-accept by default#20351
Abhijit-2592 merged 2 commits into
mainfrom
abhijit-2592/hide-policy-dialogv2

Conversation

@Abhijit-2592

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

Copy link
Copy Markdown
Contributor

Summary

Hide the workspace policy update dialog and automatically accept policy changes by default to improve user experience and reduce startup friction in interactive mode.

Details

  • Default Auto-Accept: Updated resolveWorkspacePolicyState in packages/cli/src/config/policy.ts to automatically accept and load policies by default in interactive mode. This matches existing non-interactive logic to reduce startup friction.
  • Configurable Flag: Introduced autoAcceptWorkspacePolicies (let) and a corresponding setAutoAcceptWorkspacePolicies setter in policy.ts to manage workspace policy behavior while maintaining testability.
  • CamelCase Naming: Refactored the flag from all-caps AUTO_ACCEPT_WORKSPACE_POLICIES to camelCase autoAcceptWorkspacePolicies to follow naming conventions for mutable variables.
  • Comprehensive Testing: Refactored policy.test.ts and workspace-policy-cli.test.ts to verify the new default behavior while maintaining coverage for the manual confirmation flow by toggling the flag via the setter in tests.

Related Issues

Fixes #20336

How to Validate

  1. Unit Tests: Run tests for policy logic:
    npm test -w @google/gemini-cli -- src/config/policy.test.ts
  2. Integration Tests: Verify CLI integration and manual confirmation flow:
    npm test -w @google/gemini-cli -- src/config/workspace-policy-cli.test.ts
  3. Full Validation: Run the workspace preflight script:
    npm run preflight

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 25, 2026 22:06
@gemini-code-assist

Copy link
Copy Markdown
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 streamlines the user experience for the CLI by automating the acceptance of workspace policy updates. It introduces a new configuration flag to control this behavior, defaulting to auto-acceptance, thereby reducing startup friction in interactive mode.

Highlights

  • Default Auto-Acceptance: Workspace policy updates are now automatically accepted by default, eliminating the need for manual confirmation in most interactive scenarios.
  • Configurable Behavior: A new AUTO_ACCEPT_WORKSPACE_POLICIES flag has been introduced, allowing the auto-acceptance behavior to be toggled, primarily for testing and specific use cases.
  • Improved Logging: Auto-acceptance in interactive mode is now logged silently using debugLogger, while non-interactive mode continues to issue a warning to stderr for transparency.
  • Enhanced Testability: A setAutoAcceptWorkspacePolicies function was added to facilitate testing of both auto-accept and manual confirmation flows.
  • Updated Test Coverage: Existing and new tests have been adjusted to validate the new default auto-acceptance behavior and ensure proper handling when auto-acceptance is disabled.
Changelog
  • packages/cli/src/config/policy.test.ts
    • Imported AUTO_ACCEPT_WORKSPACE_POLICIES and setAutoAcceptWorkspacePolicies for testing.
    • Modified existing test cases to reflect the new default auto-acceptance behavior.
    • Added a new test case to verify the confirmation request when AUTO_ACCEPT_WORKSPACE_POLICIES is explicitly set to false.
    • Added a new test case for non-interactive mode when AUTO_ACCEPT_WORKSPACE_POLICIES is false.
  • packages/cli/src/config/policy.ts
    • Introduced AUTO_ACCEPT_WORKSPACE_POLICIES (default true) and setAutoAcceptWorkspacePolicies function.
    • Updated resolveWorkspacePolicyState to use AUTO_ACCEPT_WORKSPACE_POLICIES to determine if a confirmation request should be generated or if policies should be auto-accepted.
    • Integrated debugLogger for silent logging of auto-acceptance in interactive mode and retained writeToStderr for non-interactive warnings.
  • packages/cli/src/config/workspace-policy-cli.test.ts
    • Imported the Policy module to access the new auto-accept flag and setter.
    • Updated test descriptions and assertions to reflect the new auto-acceptance default for integrity mismatches and new policies in interactive mode.
    • Added a new test case to specifically verify the manual confirmation flow when AUTO_ACCEPT_WORKSPACE_POLICIES is set to false.
Activity
  • No specific review comments, approvals, or other human activities have 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.

@github-actions

github-actions Bot commented Feb 25, 2026

Copy link
Copy Markdown

Size Change: +231 B (0%)

Total Size: 25.7 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.2 MB +231 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

@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 critical security vulnerability by defaulting to automatically accepting workspace policy updates, which could lead to the silent activation of malicious policies. It is strongly recommended to disable this feature by default, requiring explicit user approval, in line with 'fail-closed' security principles. Additionally, a high-severity concurrency issue has been identified in integrityManager.acceptIntegrity that could lead to data corruption due to a lack of file locking during read-modify-write operations.

Comment thread packages/cli/src/config/policy.ts Outdated
Comment thread packages/cli/src/config/policy.ts
Comment thread packages/cli/src/config/policy.ts Outdated

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

lgtm

@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/hide-policy-dialogv2 branch 2 times, most recently from f64da4a to 5b876cf Compare February 26, 2026 00:19
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/hide-policy-dialogv2 branch from 5b876cf to ff19004 Compare February 26, 2026 03:05

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

lgtm

@Abhijit-2592 Abhijit-2592 added this pull request to the merge queue Feb 26, 2026
@jacob314

Copy link
Copy Markdown
Contributor

I have reviewed this PR locally.

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 26, 2026
…ault

Introduce automatic acceptance of workspace policies to improve user
experience and reduce friction in interactive mode.

- Add AUTO_ACCEPT_WORKSPACE_POLICIES flag in policy.ts (defaulting to true).
- Update resolveWorkspacePolicyState to automatically accept and load
  policies when the flag is enabled, matching the existing non-interactive
  logic.
- Add setAutoAcceptWorkspacePolicies setter to allow tests to toggle
  the behavior.
- Update policy.test.ts and workspace-policy-cli.test.ts to verify
  the new default behavior while maintaining coverage for the manual
  confirmation flow.

This change ensures that users aren't interrupted by policy integrity
dialogs while keeping the underlying security infrastructure intact for
future use.
Rename AUTO_ACCEPT_WORKSPACE_POLICIES to autoAcceptWorkspacePolicies in
policy.ts and update corresponding tests. This aligns with naming
conventions for variables that are intended to be modified (e.g., during
tests).

- Rename variable and update setter in policy.ts.
- Update references in policy.test.ts and workspace-policy-cli.test.ts.
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/hide-policy-dialogv2 branch from ff19004 to a4b1fb9 Compare February 26, 2026 03:40
@Abhijit-2592 Abhijit-2592 added this pull request to the merge queue Feb 26, 2026
Merged via the queue into main with commit d128fb0 Feb 26, 2026
27 checks passed
@Abhijit-2592 Abhijit-2592 deleted the abhijit-2592/hide-policy-dialogv2 branch February 26, 2026 04:26
@Abhijit-2592

Copy link
Copy Markdown
Contributor Author

/patch preview

@github-actions

Copy link
Copy Markdown

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: preview
  • Commit: d128fb0f7b86bdc8f9a942ca2ba35d130129f7c6
  • Workflows Created: 1

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. Review and approve the hotfix PR: #20512
  2. Once merged, the patch release will automatically trigger
  3. You'll receive updates here when the release completes

🔗 Track Progress:

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

size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CLI] Hide workspace policy update dialog to reduce friction

3 participants