Fix Stateful API Errors in Gemini CLI During Model Fallback

amelidev · ghdev · 2026-07-21

This PR fixes a blocking API error in Gemini CLI that occurred during permanent model fallbacks (e.g., downgrading to gemini-2.5-flash).

The core change introduces a rotateSessionId() method triggered before fallback activation. This forces the backend to treat retried requests as fresh and stateless by rotating the in-memory session ID, while preserving all local storage paths and CLI states.

Original post →

More from coding & agent

coding & agent channel →