feat(cli): add ACP host input requests#24664
feat(cli): add ACP host input requests#24664benjaminwestern wants to merge 4 commits intogoogle-gemini:mainfrom
Conversation
Summary of ChangesHello, 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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
packages/cli/src/acp/hostInput.ts
Outdated
| if (answer) { | ||
| return { | ||
| approved: false, | ||
| feedback: answer, | ||
| }; | ||
| } | ||
|
|
There was a problem hiding this comment.
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.
| if (answer) { | |
| return { | |
| approved: false, | |
| feedback: answer, | |
| }; | |
| } | |
| if (answer?.trim()) { | |
| return { | |
| approved: false, | |
| feedback: answer.trim(), | |
| }; | |
| } |
References
- When validating string parameters from tools, trim the string first and then check for emptiness to prevent whitespace-only values from being accepted.
|
Footnotes
|
|
This prevents whitespace-only feedback from being accepted as a valid response and adds tests to cover the expected behavior.
Summary
This adds an opt-in ACP host input path so an ACP client can answer
ask_userandexit_plan_modeitself.ask_userstays disabled in ACP unless the host explicitly opts in.Details
This PR fixes the concrete ACP gap tracked in #24663.
It does four things:
gemini/requestUserInputask_userexit_plan_modeIt also tightens a few implementation details that came up while reviewing the change:
ask_userdocsThis is intentionally narrow.
It does not add MCP.
It does not add a second app-server.
It does not turn
ask_userback 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
npm run preflight._meta.geminiCli.hostInput.requestUserInput = true.ask_userflow.exit_plan_modeflow.supportedKinds: ['exit_plan_mode'].Expected results:
gemini/requestUserInputfor supported kinds.ask_userstays excluded in ACP when the host does not opt in.Pre-Merge Checklist