Skip to content

feat(cli): add ACP host input requests#24664

Open
benjaminwestern wants to merge 4 commits intogoogle-gemini:mainfrom
benjaminwestern:feat/acp-native-host-input
Open

feat(cli): add ACP host input requests#24664
benjaminwestern wants to merge 4 commits intogoogle-gemini:mainfrom
benjaminwestern:feat/acp-native-host-input

Conversation

@benjaminwestern
Copy link
Copy Markdown

@benjaminwestern benjaminwestern commented Apr 4, 2026

Summary

This adds an opt-in ACP host input path so an ACP client can answer
ask_user and exit_plan_mode itself.

ask_user stays disabled in ACP unless the host explicitly opts in.

Details

This PR fixes the concrete ACP gap tracked in #24663.

It does four things:

  • adds gemini/requestUserInput
  • lets an ACP host answer ask_user
  • lets an ACP host answer exit_plan_mode
  • keeps current ACP behavior unless the host advertises support

It also tightens a few implementation details that came up while reviewing the change:

  • validates submitted host-input payloads at the ACP boundary
  • handles missing plan files cleanly
  • uses typed ACP tool-call locations in the extension payload
  • uses the repo's standard exhaustive-check utility in the confirmation mapping
  • updates the ACP and ask_user docs
  • adds tests for the new flow and the disabled/fallback cases

This is intentionally narrow.
It does not add MCP.
It does not add a second app-server.
It does not turn ask_user back on globally in ACP.

Related ACP work:

Related Issues

Fixes #24663
Related to #23045
Related to #21783
Related to #17952
Related to #23818
Related to #23961
Related to #12042

How to Validate

  1. Run npm run preflight.
  2. Start Gemini CLI in ACP mode with a client that advertises _meta.geminiCli.hostInput.requestUserInput = true.
  3. Trigger an ask_user flow.
  4. Trigger an exit_plan_mode flow.
  5. Repeat with a client that only advertises supportedKinds: ['exit_plan_mode'].

Expected results:

  • Gemini CLI sends gemini/requestUserInput for supported kinds.
  • The host can return submitted answers or cancellation.
  • The blocked turn continues without falling back to terminal input.
  • ask_user stays excluded in ACP when the host does not opt in.

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
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@gemini-cli gemini-cli bot added the area/non-interactive Issues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automation label Apr 4, 2026
@benjaminwestern benjaminwestern marked this pull request as ready for review April 4, 2026 04:00
@benjaminwestern benjaminwestern requested review from a team as code owners April 4, 2026 04:00
@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 enables a more integrated experience for ACP clients by allowing them to surface user-facing input requests directly, rather than relying on terminal fallbacks. By introducing a structured opt-in mechanism, the changes ensure that Gemini CLI maintains its default security and interaction model while providing flexibility for clients that wish to own the user-facing input surface.

Highlights

  • ACP Host Input Extension: Introduced a new ACP extension, gemini/requestUserInput, allowing ACP clients to handle ask_user and exit_plan_mode interactions directly within their own UI.
  • Opt-in Mechanism: Implemented an explicit opt-in requirement for ACP hosts to support these new input requests, ensuring ask_user remains disabled by default in ACP mode to maintain existing behavior.
  • Validation and Robustness: Added payload validation at the ACP boundary, improved handling for missing plan files, and integrated exhaustive checks for confirmation mappings.
  • Documentation and Testing: Updated ACP and ask_user documentation and added comprehensive tests covering both the new flow and fallback scenarios.
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.

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
Copy Markdown
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 introduces a Gemini-specific ACP extension for structured host input, allowing ACP clients to surface interactive questions like ask_user tool requests and plan approvals in their own UI. The changes include comprehensive documentation, a new hostInput.ts utility for managing these requests, and logic updates to the GeminiAgent and Session classes to negotiate and execute these host-driven interactions. Feedback was provided to ensure that feedback strings from the host are trimmed before being processed to prevent whitespace-only values from being accepted.

Comment on lines +155 to +161
if (answer) {
return {
approved: false,
feedback: answer,
};
}

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.

high

The feedback string from the host is not trimmed before being checked for emptiness. This could lead to whitespace-only feedback being accepted and sent back to the model, which might cause confusion or unexpected behavior in the conversational flow. Per the general rules, string parameters from tools (or in this case, host input) should be trimmed first.

Suggested change
if (answer) {
return {
approved: false,
feedback: answer,
};
}
if (answer?.trim()) {
return {
approved: false,
feedback: answer.trim(),
};
}
References
  1. When validating string parameters from tools, trim the string first and then check for emptiness to prevent whitespace-only values from being accepted.

@wissamblue69-dotcom
Copy link
Copy Markdown

Summary

This adds an opt-in ACP host input path so an ACP client can answer
ask_user and exit_plan_mode itself.

ask_user stays disabled in ACP unless the host explicitly opts in.

Details

This PR fixes the concrete ACP gap tracked in #24663.

It does four things:

  • adds gemini/requestUserInput
  • lets an ACP host answer ask_user
  • lets an ACP host answer exit_plan_mode
  • keeps current ACP behavior unless the host advertises support

It also tightens a few implementation details that came up while reviewing the change:

  • validates submitted host-input payloads at the ACP boundary
  • handles missing plan files cleanly
  • uses typed ACP tool-call locations in the extension payload
  • uses the repo's standard exhaustive-check utility in the confirmation mapping
  • updates the ACP and ask_user docs
  • adds tests for the new flow and the disabled/fallback cases

This is intentionally narrow.
It does not add MCP.
It does not add a second app-server.
It does not turn ask_user back on globally in ACP.

Related ACP work:

Related Issues

Fixes #24663
Related to #23045
Related to #21783
Related to #17952
Related to #23818
Related to #23961
Related to #12042

How to Validate

  1. Run npm run preflight.
  2. Start Gemini CLI in ACP mode with a client that advertises _meta.geminiCli.hostInput.requestUserInput = true.
  3. Trigger an ask_user flow.
  4. Trigger an exit_plan_mode flow.
  5. Repeat with a client that only advertises supportedKinds: ['exit_plan_mode'].

Expected results:

  • Gemini CLI sends gemini/requestUserInput for supported kinds.
  • The host can return submitted answers or cancellation.
  • The blocked turn continues without falling back to terminal input.
  • ask_user stays excluded in ACP when the host does not opt in.

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
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@wissamblue69-dotcom
Copy link
Copy Markdown

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 enables a more integrated experience for ACP clients by allowing them to surface user-facing input requests directly, rather than relying on terminal fallbacks. By introducing a structured opt-in mechanism, the changes ensure that Gemini CLI maintains its default security and interaction model while providing flexibility for clients that wish to own the user-facing input surface.

Highlights

  • ACP Host Input Extension: Introduced a new ACP extension, gemini/requestUserInput, allowing ACP clients to handle ask_user and exit_plan_mode interactions directly within their own UI.
  • Opt-in Mechanism: Implemented an explicit opt-in requirement for ACP hosts to support these new input requests, ensuring ask_user remains disabled by default in ACP mode to maintain existing behavior.
  • Validation and Robustness: Added payload validation at the ACP boundary, improved handling for missing plan files, and integrated exhaustive checks for confirmation mappings.
  • Documentation and Testing: Updated ACP and ask_user documentation and added comprehensive tests covering both the new flow and fallback scenarios.
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.

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.

@wissamblue69-dotcom
Copy link
Copy Markdown

Code Review

This pull request introduces a Gemini-specific ACP extension for structured host input, allowing ACP clients to surface interactive questions like ask_user tool requests and plan approvals in their own UI. The changes include comprehensive documentation, a new hostInput.ts utility for managing these requests, and logic updates to the GeminiAgent and Session classes to negotiate and execute these host-driven interactions. Feedback was provided to ensure that feedback strings from the host are trimmed before being processed to prevent whitespace-only values from being accepted.

This prevents whitespace-only feedback from being accepted as a valid response and adds tests to cover the expected behavior.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP: let hosts answer ask_user and exit_plan_mode

2 participants