google-gemini / google-gemini/gemini-cli

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

Open
#29,021 2 comments 0 reactions 0 assignees View on GitHub
area/core effort/small status/bot-triaged
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

### What would you like to be added?

Tool `ask_user` should show the question(s) asked after answers are provided. Currently after answering, the only thing left in the history is the question's answer, without the question to give us the context of that shown answer. Gemini might still have it in it's context, but the human context is completely lost.

### Why is this needed?

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. So if you answered a Yes/No, you will only have minimal context. An example:

A subagent failed. I asked why it failed. It replied with an `ask_user` with the question being the explanation plus asking if I'd like to retry it. I answered yes. This is the only information in the chat history.

```
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Ask User │
│ │
│ User answered: │
│ Retry Subagent → Yes │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

In this scenario, I've lost the entire context of the failure, I only know I answered to retry. This is one of multiple times the human context was hidden.

### Additional context

I have code done to add a config option to settings.json where you can add the following and the questions stay (both single and multiple question versions), will create a PR next:

```
"ui": {
"keepAskUserQuestionsInHistory": true
}
```

Contributor guide

Open the contributing guide

Research direction

Start at the ask_user tool and the proposed settings.json option keepAskUserQuestionsInHistory. Check how single- and multiple-question answers are rendered in chat history, then verify that the question text remains visible alongside the answer when the option is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.