Skip to content

Comments

Fix: Avoid tool confirmation timeout when no UI listeners are present#17955

Merged
skeshive merged 1 commit intogoogle-gemini:mainfrom
pdHaku0:fix/acp-confirmation-timeout
Feb 19, 2026
Merged

Fix: Avoid tool confirmation timeout when no UI listeners are present#17955
skeshive merged 1 commit intogoogle-gemini:mainfrom
pdHaku0:fix/acp-confirmation-timeout

Conversation

@pdHaku0
Copy link
Contributor

@pdHaku0 pdHaku0 commented Jan 30, 2026

Summary

Fixes an issue where tool execution hangs waiting for user confirmation in environments without an attached UI listener (e.g., initial ACP connection or headless mode).

Details

In packages/core/src/confirmation-bus/message-bus.ts, the ASK_USER policy decision logic has been updated.
It now checks if there are any active listeners for TOOL_CONFIRMATION_REQUEST.

  • If listeners exist: The request is emitted as usual.
  • If NO listeners exist: It immediately emits a TOOL_CONFIRMATION_RESPONSE with confirmed: false.

This prevents the system from waiting indefinitely (or until a long timeout) for a user confirmation that effectively cannot be given, improving responsiveness in automated or headless scenarios.

Related Issues

Fixes #17952

How to Validate

  1. Run the Gemini CLI in a headless mode or initiate an ACP connection without an interactive UI immediately available.
  2. Trigger an action that requires tool confirmation.
  3. Observe that the operation fails fast (or is handled) rather than hanging for a timeout duration.

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:
    • Linux
      • npm run (Verified locally)

@pdHaku0 pdHaku0 requested a review from a team as a code owner January 30, 2026 12:12
@google-cla
Copy link

google-cla bot commented Jan 30, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @pdHaku0, 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 addresses a critical issue where tool execution could hang indefinitely in headless or non-interactive environments when a user confirmation was required but no UI listener was available to provide it. The change ensures that in such scenarios, the system fails fast by automatically denying the confirmation, thereby preventing timeouts and improving system responsiveness.

Highlights

  • Tool Confirmation Logic: Modified the ASK_USER policy in MessageBus to check for active TOOL_CONFIRMATION_REQUEST listeners. If no listeners are present, it now immediately emits a TOOL_CONFIRMATION_RESPONSE with confirmed: false instead of waiting indefinitely.
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 effectively addresses the issue of tool execution hanging in headless or non-interactive environments by introducing a check for UI listeners before requesting user confirmation. If no listeners are present, it immediately responds with a TOOL_CONFIRMATION_RESPONSE indicating that confirmation was needed but could not be obtained. This is a robust solution that improves responsiveness and prevents indefinite waits, aligning well with the described problem and solution. The code is clear and the logic is sound.

@gemini-cli gemini-cli bot added area/non-interactive Issues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automation priority/p1 Important and should be addressed in the near term. help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Jan 30, 2026
@skeshive skeshive added this pull request to the merge queue Feb 19, 2026
Merged via the queue into google-gemini:main with commit 5d23595 Feb 19, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/non-interactive Issues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automation help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP mode tool confirmations are delayed by ~30s due to MessageBus timeout

2 participants