google-gemini / google-gemini/gemini-cli

[Bug] Model generates a synthetic next user turn instead of answering after a denied tool call

Open
#28,621 6 comments 5 reactions 0 assignees View on GitHub
area/agent kind/bug priority/p2 status/bot-triaged
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

[gcli-request-1785630091176.json](https://github.com/user-attachments/files/30624976/gcli-request-1785630091176.json)

### What happened?
The model skips the assistant response and generates what appears to be a synthetic continuation of the user's intent — effectively predicting the next user turn.
After denying a `write_file` tool call, I submitted a clarification question:

> que era persistencia optimista? y (...)

The denied `functionResponse` and the new user question were correctly included in the same `role: "user"` turn.

However, instead of answering the question, the next `role: "model"` response generated a long instruction written from the user's perspective, starting with:

> quiero ponerle ese nombre al slice. no hagas nada todavía...

The generated text tells the assistant to rename slices, avoid tools, wait for confirmation, and reorganize the work. It reads like a plausible **next user message**, not an assistant response.

This is not only a TUI rendering issue: the incorrect text is already recorded in the conversation history as model output.

### What did you expect to happen?
The model should process the denied tool result and answer the accompanying clarification question.
For example, it should explain:

- what “optimistic persistence” means;
- whether the backend eligibility slice includes fetching the bottomsheet configuration.

### Client information

* **CLI Version:** 0.53.1
* **Git Commit:** 19a68016b
* **Session ID:** 82540b71-ed4d-40ac-a462-5951042c57bd
* **Operating System:** darwin v24.13.0
* **Sandbox Environment:** no sandbox
* **Model Version:** gemini-3.1-pro-preview
* **Auth Type:** vertex-ai
* **Memory Usage:** 221.4 MB
* **Terminal Name:** Unknown
* **Terminal Background:** #000000
* **Kitty Keyboard Protocol:** Unsupported

### Login information

_No response_

### Anything else we need to know?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the attached gcli-request-1785630091176.json and trace the CLI path that processes a denied write_file functionResponse followed by a user clarification. Reproduce the sequence using the listed CLI and model versions; done means the model answers the question and the conversation history records that answer rather than a synthetic user turn.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.