Gemini CLI PR fixes 400 errors by auto-appending "Please continue" user turn
asieveking · ghdev · 2026-09-28
A community PR to gemini-cli (#29527) fixes 400 Bad Request errors caused by requests ending with a model turn.
- Root cause: the Gemini API requires strict user/model role alternation with the final turn always being user. After /rewind, stream interruptions, or aborted tool calls, contentsToUse could end with a model turn.
- Fix: enforce the invariant right before dispatching to generateContentStream — if the payload ends with a model turn, a continuation user turn ("Please continue.") is appended, preserving conversation semantics.
- Validated via the core unit test suite, with a dedicated test passing among all 113 tests.
More from coding & agent
- Swargs claims $50M+ transaction volume and 6,000+ listings on its AI agent marketplace — KyeGomezB · 2026-09-29
- Sonnet 5.5 effort settings make no difference in 15-task coding test: 9/15 at low, medium and high — every · 2026-09-29
- Claude Connectors: 7 essential integrations to stop copy-pasting between Claude and your apps — Aiden_Tech_Ai · 2026-09-29
- AI made building so cheap that 5 launches beat 5 months of thinking — alexmacgregor__ · 2026-09-29
- AI agent buys NBA tickets end-to-end, pivots on its own after seats sell out mid-checkout — armand_ruiz · 2026-09-29
- Embedded dev on Chinese models: DeepSeek and GLM are good enough, skip Codex/Claude — sven_ai · 2026-09-29