Gemini CLI PR fixes loop recovery dropping unsent tool results
codewithfourtix · ghdev · 2026-10-22
A PR to google-gemini/gemini-cli (#29871) fixes a subtle agent-loop bug: when the start-of-turn loop check triggered, recoverFromLoop sent only the loop feedback and dropped the pending request — usually the functionResponse of an already-executed tool — so the call was closed as "Response was lost or interrupted" and the model lost the tool's result.
The fix passes the unsent request into recoverFromLoop, sending request parts first followed by the feedback text in one user turn. isFunctionResponse now matches any turn containing a functionResponse part, so closeUnansweredToolCallsTurn no longer replaces the real result. The streaming-time loop check is unchanged (the request was already sent there), and the check is deliberately not postponed: late in a prompt a tool response is almost always pending, so the check would nearly never run. Includes a new test that fails on main, fixing #29815.
More from coding & agent
- Decisions API hits GA as agents automate cloud video editing via feedback loops — dkundel · 2026-10-23
- Swarms API changelog: 8 months of streaming, multi-agent orchestration, and dynamic model pricing — KyeGomezB · 2026-10-23
- A curated library of 50+ free AI agent resources: videos, repos, one Google Doc — ifioknkem · 2026-10-23
- Vercel adds no-account deploys: drag and drop a file to get a live URL — steren · 2026-10-23
- Dev runs 5 Claude Code sessions that coordinate via MCP Agent Mail to root his network cameras — doodlestein · 2026-10-23
- Vercel ships 'vercel deploy --temporary' for ephemeral agent-built deployments — cramforce · 2026-10-23