Skip to content

Conversation

@dask-58
Copy link

@dask-58 dask-58 commented Jan 31, 2026

Summary

Adds ask_user as a valid decision type for hooks, enabling hooks to prompt users for confirmation before proceeding with an action. This aligns the hook system with the safety checker protocol which already supports ASK_USER.

Details

Problem: The hook system only documented and supported "allow" and "deny" (alias "block") for the decision field, but users needed ask_user to prompt for user confirmation.

Solution:

  • Added 'ask_user' to the HookDecision type in packages/core/src/hooks/types.ts.
  • Updated documentation in docs/hooks/reference.md
  • Added tests for ask_user decision handling

Behavior: When a hook returns { "decision": "ask_user", "reason": "explanation" }:

  • The decision is not treated as blocking (unlike deny/block)
  • The CLI will prompt the user for confirmation before proceeding
  • Blocking decisions (deny/block) take precedence when aggregating

Related Issues

Fixes #17872

How to Validate

  1. Run unit tests for hook types:

    npm test -w @google/gemini-cli-core -- src/hooks/types.test.ts
    • Verify ask_user tests pass for isBlockingDecision() returning false
  2. Run hook aggregator tests:

    npm test -w @google/gemini-cli-core -- src/hooks/hookAggregator.test.ts
    • Verify ask_user aggregation tests pass
  3. Run full test suite:

    npm run typecheck && npm test
    • All 4,363+ tests should pass
  4. Create a hook that returns ask_user:

    { "decision": "ask_user", "reason": "Confirm before proceeding" }
    • Verify the CLI prompts for user confirmation

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any) - None
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker
@dask-58 dask-58 requested review from a team as code owners January 31, 2026 12:09
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dask-58, 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 hook system by introducing a new decision type, ask_user, which allows hooks to prompt users for confirmation. This change aligns the hook system's capabilities with existing safety checker protocols, providing more granular control over automated processes by enabling interactive decision-making. The update ensures that user-facing prompts can be integrated seamlessly into the workflow without inherently blocking operations.

Highlights

  • New Hook Decision Type: The HookDecision type now includes 'ask_user', allowing hooks to explicitly request user confirmation before proceeding with an action.
  • Documentation Update: The docs/hooks/reference.md file has been updated to reflect the new 'ask_user' decision type and its behavior, clarifying that the CLI will prompt the user for confirmation.
  • Test Coverage for ask_user: New unit tests have been added to verify that 'ask_user' decisions are correctly identified as non-blocking and that the HookAggregator handles them appropriately, defaulting to 'allow' when no blocking decisions are present.
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.

@chrstnb
Copy link
Collaborator

chrstnb commented Jan 31, 2026

Build failed: Build process failed (no specific link errors found). Check logs for details.

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

This pull request adds support for the ask_user decision in hooks, aligning it with the safety checker protocol. However, a critical security vulnerability has been identified: the hook aggregation logic incorrectly treats ask_user as a standard 'allow' decision, leading to a security bypass where safety-critical user confirmations are ignored and actions are automatically permitted. The HookAggregator needs to be updated to correctly preserve and prioritize the ask_user state. Additionally, feedback includes improving documentation for the reason field's usage with ask_user and completing a new test case with a missing assertion for aggregated reasons.

@gemini-cli gemini-cli bot added priority/p1 Important and should be addressed in the near term. area/enterprise Issues related to Telemetry, Policy, Quota / Licensing labels Jan 31, 2026
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@chrstnb
Copy link
Collaborator

chrstnb commented Jan 31, 2026

Build failed: Build process failed (no specific link errors found). Check logs for details.

@chrstnb
Copy link
Collaborator

chrstnb commented Jan 31, 2026

Build failed: Build process failed (no specific link errors found). Check logs for details.

@chrstnb
Copy link
Collaborator

chrstnb commented Jan 31, 2026

Build failed: Build process failed (no specific link errors found). Check logs for details.

@dask-58
Copy link
Author

dask-58 commented Jan 31, 2026

@chrstnb @bdmorgan I’ve run formatting, scoped ESLint, and doc generators locally. The docs-pr-check is still failing, but I don’t have access to Cloud Build logs. Could you take a look or rerun the check?

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 priority/p1 Important and should be addressed in the near term.

2 participants