Gemini CLI Fix: Preserve Empty Text Turns with Tool Calls or Media
DavidAPierce · ghdev · 2026-08-19
This PR refines chat history validation in isValidContent to preserve model turns containing empty text parts (text: '') when they carry crucial structured payloads like tool requests, responses, or multimodal media.
Context:
- Previously, any turn with an empty text part was stripped entirely. While filtering broken turns, this introduced a bug in tool execution flows.
- Tool calls (functionCall) and responses (functionResponse) often have empty text fields. Stripping these breaks the conversation graph and context flow.
Changes:
- Updated isValidContent to check for other valid properties (e.g., functionCall, functionResponse, inlineData) before invalidating an empty text part.
- Added unit tests to assert preservation of valid metadata turns while pruning truly empty ones.
More from coding & agent
- How Much Agent Swarm Hype Is Just Distributed Systems Rediscovered? — edgarpavlovsky · 2026-11-30
- Know PyTorch vs. Know What PyTorch Does: A 5-Step Learning Path — cneuralnetwork · 2026-11-30
- PAL adds E2EE multi-machine remote memory for Claude Code with BYO S3 — rchardkovacs · 2026-11-30
- Reddit asks: did anyone keep autoresearch agent loops in daily workflows? — Jumpy-Cobbler1020 · 2026-11-30
- Dev ports 4 Obsidian plugins to Antigravity native plugins, all open-sourced on GitHub — vista8 · 2026-11-30
- Tactile sensing remains fragmented across 18 sensors; year-long push for a ROS 2 standards working group finds no takers — kscottz · 2026-11-30