Sitelet https://github.com/google-gemini/gemini-cli/pull/29022
Skip to content

feat(tool): retain ask_user question in text history - #29022

Open
RaphaelDDL wants to merge 2 commits into
google-gemini:mainfrom
RaphaelDDL:main
Open

feat(tool): retain ask_user question in text history#29022
RaphaelDDL wants to merge 2 commits into
google-gemini:mainfrom
RaphaelDDL:main

Conversation

@RaphaelDDL

@RaphaelDDL RaphaelDDL commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Implements ui.keepAskUserQuestionsInHistory settings option.

Details

When ask_user tool is used, we have a nice question GUI, but after answering, the question is lost and if/when we resume a session or simply want to remember what were our choices during a session, it's impossible as there's no question visible. Gemini might still have it in it's context, but the human context is completely lost.

Related Issues

Closes #29021

How to Validate

Set the following in .gemini/settings.json

  "ui": {
    "keepAskUserQuestionsInHistory": true
  }

Prompt gemini to ask you a random question using ask_user tool, examples:

  • ask me a random question using ask_user tool
  • use ask_user tool to ask me 3 questions at once so I can see the multiple question flow

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

Examples

Current behavior/keepAskUserQuestionsInHistory=false or not set

image image

keepAskUserQuestionsInHistory=true

image image

@RaphaelDDL
RaphaelDDL requested review from a team as code owners August 24, 2026 18:51
@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 adds a new configuration setting, ui.keepAskUserQuestionsInHistory, which improves session transparency by ensuring that questions posed via the ask_user tool remain visible in the chat history after being answered. This addresses the issue where the context of user choices was lost in the conversation flow, making it easier for users to review past interactions.

Highlights

  • New Configuration Option: Introduced ui.keepAskUserQuestionsInHistory to allow users to retain questions from the ask_user tool in the chat history.
  • Enhanced UI Feedback: Updated the ask_user tool to display both the question and the user's answer in the chat history when the new setting is enabled.
  • Testing and Documentation: Added comprehensive unit tests for the new configuration and updated the CLI documentation to reflect the new setting.
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 the 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 counterproductive. 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.

@google-cla

google-cla Bot commented Aug 24, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the size/l A large sized PR label Aug 24, 2026
@github-actions

Copy link
Copy Markdown

📊 PR Size: size/L

  • Lines changed: 292
  • Additions: +276
  • Deletions: -16
  • Files changed: 10

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

🛑 Action Required: Evaluation Approval

Steering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged.

Maintainers:

  1. Go to the Workflow Run Summary.
  2. Click the yellow 'Review deployments' button.
  3. Select the 'eval-gate' environment and click 'Approve'.

Once approved, the evaluation results will be posted here automatically.

@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

This pull request introduces a new configuration option, ui.keepAskUserQuestionsInHistory, which allows users to keep questions from the ask_user tool visible in their chat history. The changes span documentation, CLI settings schema, configuration loading, tool invocation logic, and comprehensive unit tests. The reviewer's feedback correctly points out that the optional chaining and nullish coalescing operator used when loading this setting in packages/cli/src/config/config.ts are redundant, as the configuration schema already guarantees the default value is populated.

Note: Security Review did not run due to the size of the PR.

Comment on lines +978 to +979
keepAskUserQuestionsInHistory:
settings.ui?.keepAskUserQuestionsInHistory ?? false,

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

According to the repository guidelines, we should rely on the schema as the single source of truth for configuration defaults and avoid redundant nullish coalescing operators. Since settings is a MergedSettings object, all properties defined in the schema (including settings.ui.keepAskUserQuestionsInHistory) are guaranteed to be populated with their default values. Therefore, the optional chaining and nullish coalescing operator are redundant here.

    keepAskUserQuestionsInHistory: settings.ui.keepAskUserQuestionsInHistory,
References
  1. Rely on the schema as the single source of truth for configuration defaults, avoiding redundant nullish coalescing operators.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gemini-code-assist I followed the other pre-existing options such as toolSandboxing, loadMemoryFromIncludeDirectories and others which either have || false or ?? false. Should I change nevertheless?

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.

Consistency with the existing codebase is important. If the current pattern in packages/cli/src/config/config.ts relies on these defensive checks, it is acceptable to follow that pattern for now to maintain consistency. While relying solely on the schema is the ideal state, refactoring existing patterns should ideally be done as a separate, codebase-wide improvement rather than within a feature PR. Please feel free to align with the existing style.

@gemini-cli gemini-cli Bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Aug 24, 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 size/l A large sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ask_user tool should retain question in chat history for human context purposes

1 participant