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
- Resin lets an agent build standalone LLM inference engines; vLLM and SGLang optimize DeepSeek kernels differently — AccBalanced · 2026-10-27
- How I let my cloud Grok Bot code on my Mac mini via Tailscale, no public ports — talkaboutdesign · 2026-10-27
- Context layout is a cost decision: one memory edit can bust your entire agent prompt cache — dscape · 2026-10-27
- Alchemy adds effect/Workflow support across Durable Objects, Workflows and Lambda Durable Functions — samgoodwin89 · 2026-10-27
- Alchemy's Lambda Web Functions run plain Node web servers on Lambda, no OpenNext needed — samgoodwin89 · 2026-10-27
- Alchemy makes all ~2,850 AWS bindings work from any cloud, not just S3/Lambda/DynamoDB — samgoodwin89 · 2026-10-27