gemini-cli - 💡(How to fix) Fix [Bug] Raw thought block tokens (...94>thought) leaking into terminal output

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

...94>thought
CRITICAL INSTRUCTION 1: I must prioritize specific tools over generic shell commands.
CRITICAL INSTRUCTION 2: Before calling tools, I need to list related tools.
RAW_BUFFERClick to expand / collapse

What happened?

Bug Description

During a conversation in the Gemini CLI, the internal model reasoning/thought blocks are not being parsed or hidden correctly. Instead of hiding the model's internal thinking tags, the raw text is leaking directly into the standard terminal output.

Steps to Reproduce

  1. Start a conversation with Gemini CLI
  2. Ask any question that triggers the model's reasoning/thinking mode
  3. Observe the terminal output

Observed Behavior

Raw thought block tokens such as ...94>thought and <thought> XML/thinking tags are being printed directly to the terminal. The internal system instructions and model reasoning are visible to the user as raw unformatted text.

Example of what is visible in the terminal:

...94>thought
CRITICAL INSTRUCTION 1: I must prioritize specific tools over generic shell commands.
CRITICAL INSTRUCTION 2: Before calling tools, I need to list related tools.

Expected Behavior

The CLI should intercept <thought> tags or internal system instructions and either:

  • Hide them completely from the user, OR
  • Render them in a collapsed UI component (e.g., a "Thinking..." animation or collapsible box)

The raw thought block tokens should NEVER be printed directly to the terminal output.

Environment

  • Tool: Gemini CLI
  • Platform: Windows Terminal

Additional Context

This appears to be a UI parsing/rendering bug where the output stream parser is failing to intercept and handle <thought> XML tags before they reach the terminal output. Screenshot attached showing the raw thought tokens visible in the terminal.

<img width="1919" height="1012" alt="Image" src="https://github.com/user-attachments/assets/8018ba5d-027b-4e67-ba51-7f1ccadf6754" />

What did you expect to happen?

The Gemini CLI should intercept and handle all <thought> tags and internal model reasoning blocks before they reach the terminal output. Specifically:

  1. Hidden by default - The raw thought tokens (...94>thought, <thought>, etc.) should never be printed as plain text to the terminal.
  2. Collapsed UI component - Ideally, the thinking/reasoning phase should be displayed as a neat "Thinking..." animation or a collapsible section in the terminal UI similar to how other AI CLI tools handle chain-of-thought reasoning.
  3. Clean output - Only the final model response should be shown to the user, with no internal system instructions or XML tags leaking into the standard output stream.

Client information

OS: Window

Login information

No response

Anything else we need to know?

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING