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
- Google Research open-sources PaperOrchestra, a multi-agent framework for writing AI papers — google-research · 2026-11-16
- ffmpeg-skill gives coding agents local video editing via 42 FFmpeg tools and MCP — kajisho5 · 2026-11-16
- Agents Now Reply to Slack Messages on Their Own, Resolving a Prod Incident Ghost-to-Ghost — iamrobotbear · 2026-11-16
- Engineer's Interview Prep Method: Use Claude to Find Which Answers Undersell Your AI Work — brandon_galang · 2026-11-16
- DeepSeek open-sources its app frontend "chat-demo", already at 3.9k stars — NielsRogge · 2026-11-16
- lemire: AI's real impact on coding is expanding the engineer's 'cognitive radius', not speed — lemire · 2026-11-16