Gemini CLI patch strips leaked thought blocks from history turns
DavidAPierce · ghdev · 2026-07-23
This PR fixes a Gemini CLI bug where thought: true parts could leak into getHistoryTurns when context management is disabled.
What changed
- Filters out all monologue/thought parts from history turns for Gemini 2.x and modern models.
- Adjusts content compilation so Gemini 2.x models use the correct modern feature format and avoid API 400 errors.
- Adds unit tests covering both a mocked gemini-2.5-pro model and a mocked gemini-3.1-pro-preview model.
Why it matters
Without this scrub, leaked thought blocks could produce duplicate reasoning segments or confuse later turns in the conversation.
More from coding & agent
- Inspired by OpenAI's 10,000-agent run, dev open-sources a crowdsourced agent problem-solving platform — Benjaminsen · 2026-09-11
- Lucid: open-source Mac app keeps your laptop awake only while AI agents run — Pitiful_Hedgehog_600 · 2026-09-11
- banteg's snail project crowdsources AI agents to finish matching Snail Mail's 20 remaining functions — banteg · 2026-09-11
- Alex Townsend posts 200 open problems in numerical linear algebra for humans and AI agents — IgorCarron · 2026-09-11
- Kimi K2.8 Preview rolls out: near-K3 coding performance, 1M context for all tiers — teortaxesTex · 2026-09-11
- Looking for a classifier of software engineering task shapes to pick models per task — StewartalsopIII · 2026-09-11