gemini-cli fixes lost usage tracking when stream aborts

PranavMishra28 · ghdev · 2026-08-07

A PR merged into Google's gemini-cli fixes the issue where token usage already received was not recorded when a stream was aborted. Previously, usage was only flushed on the success path, and the abort path lost it entirely because logApiError early-returns for AbortError. The fix flushes captured usage via logApiResponse before rethrowing, without reclassifying cancellation as an error. If no usage metadata was received before abort, no event is emitted, avoiding fabricated zero-usage records. Tests cover both cases.

Original post →

More from coding & agent

coding & agent channel →