Skip to content

feat: wire up AskUserTool with dialog - #17411

Merged
jacob314 merged 8 commits into
mainfrom
ask-user/integration
Jan 27, 2026
Merged

jacob314 merged 8 commits into
mainfrom
ask-user/integration

Conversation

@jackwotherspoon

Copy link
Copy Markdown
Collaborator

Summary

  • Wires up the AskUserTool to the AskUserDialog UI component via the message bus
  • Adds AskUserActionsContext to manage dialog state and provide submit/cancel handlers to child components
  • Integrates the dialog into DialogManager with appropriate priority ordering
  • Handles Ctrl+C gracefully when the dialog is open (uses Esc to cancel instead)

Details

The integration follows the existing message bus pattern used for tool confirmations:

  1. Tool → UI: AskUserTool publishes ASK_USER_REQUEST with questions and a correlationId
  2. UI State: AppContainer subscribes to requests and stores them in askUserRequest state
  3. UI Rendering: DialogManager renders AskUserDialog when a request is present
  4. UI → Tool: On submit/cancel, AppContainer publishes ASK_USER_RESPONSE with answers and the matching correlationId
  5. Tool Resolution: AskUserInvocation.execute() resolves its promise with formatted answers

Related Issues

Closes #17157

How to Validate

Ask a prompt like:

I am wanting to build a new Node web app, ask me some questions to help me come up with a design

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

@jackwotherspoon
jackwotherspoon requested a review from a team as a code owner January 23, 2026 22:12
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jackwotherspoon, 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 introduces a significant enhancement to the CLI's interactive capabilities by implementing a user-facing dialog for the AskUserTool. It establishes a robust communication channel between the backend tool and the frontend UI using a message bus, and provides a dedicated context for managing the dialog's state and actions. This change allows the CLI to dynamically prompt users for information, improving the overall interactivity and user experience, and correctly handles user cancellation of these prompts.

Highlights

  • Interactive User Questioning: The AskUserTool is now fully wired up to a new AskUserDialog UI component, enabling the CLI to ask users questions interactively.
  • State Management: A new AskUserActionsContext has been introduced to manage the state of the ask user dialog and provide submit/cancel handlers to its child components.
  • Dialog Integration: The AskUserDialog is integrated into the DialogManager, ensuring it appears with appropriate priority when a user prompt is required.
  • Graceful Cancellation: The system now gracefully handles Ctrl+C input when the AskUserDialog is open, allowing users to cancel the dialog using the Escape key instead.
  • Message Bus Communication: The interaction between the AskUserTool and the UI dialog follows an established message bus pattern, using ASK_USER_REQUEST and ASK_USER_RESPONSE messages for communication.
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. ↩

@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

The pull request effectively integrates the AskUserTool with the AskUserDialog UI component, establishing a clear communication flow via the message bus. The implementation correctly handles user input, navigation between questions, and cancellation, providing a robust and user-friendly experience. The use of React Context for managing dialog state and actions is well-applied, and the code adheres to good React practices. I did not identify any critical or high-severity issues in the changes.

@github-actions

github-actions Bot commented Jan 23, 2026 •

Copy link
Copy Markdown

Size Change: +40.6 kB (+0.17%)

Total Size: 23.4 MB

Filename Size Change
./bundle/gemini.js 23.4 MB +40.6 kB (+0.17%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

@gemini-cli gemini-cli Bot added area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Jan 23, 2026
@jerop

jerop commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Tested this locally and it works really well, exciting 🎉

Ran /review-frontend and got this feedback:

"""
Please add a test case in packages/cli/src/ui/AppContainer.test.tsx that simulates the ASK_USER_REQUEST message being published on the message bus and asserts that the AskUserDialog (or at least the state change) occurs.

it('should show ask user dialog when request is received', async () => {
  // ... setup ...
  act(() => {
    config.getMessageBus().publish({
      type: MessageBusType.ASK_USER_REQUEST,
      questions: [...],
      correlationId: 'test-id'
    });
  });
  // ... assert dialog is visible ...
});

"""

}

if (keyMatchers[Command.QUIT](key)) {
// Skip when ask_user dialog is open (use Esc to cancel instead)

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.

Now that bubbling event listeners are in we should be able to do better here. The ask_user dialog should be capturing the QUIT key so it doesn't get bubbled up here rather than this sort of inverted control logic

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

Great job. Only feedback is would be good to have more tests for the functionality added outside of ask-user.test.ts
E.g. add a test case covering the new functionality in ToolGroupMessage.
That can be added as a follow up.lgtm

@jacob314
jacob314 added this pull request to the merge queue Jan 27, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Jan 27, 2026
Merged via the queue into main with commit 36d618f Jan 27, 2026
25 checks passed
@jacob314
jacob314 deleted the ask-user/integration branch January 27, 2026 18:53
@jackwotherspoon jackwotherspoon mentioned this pull request Jan 28, 2026
2 of 18 tasks
sidwan02 pushed a commit to sidwan02/gemini-cli-gemma that referenced this pull request Feb 6, 2026
kuishou68 pushed a commit to iOfficeAI/gemini-cli-pro that referenced this pull request Feb 27, 2026
cocosheng-g pushed a commit that referenced this pull request May 6, 2026
@sripasg sripasg added the size/l A large sized PR label Jun 2, 2026
software-0ficial pushed a commit to software-0ficial/gemini-cli that referenced this pull request Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. size/l A large sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Register AskUser Tool and Wire End-to-End

4 participants