Gemini CLI PR fixes OOM in long agentic sessions with 64KB tool output budget and inlineData eviction
tadipavan · ghdev · 2026-11-06
A community PR (google-gemini/gemini-cli #30180) fixes a V8 heap out-of-memory crash (Reached heap limit Allocation failed) during long-running agentic sessions that repeatedly read many files or handle multimodal tool outputs like screenshots.
Key changes:
- Cumulative multi-part truncation: previously each array element was checked against the 64KB cap independently, then joined into multi-megabyte strings; ToolExecutor now enforces a cumulative 64KB budget across all elements.
- Multimodal inlineData accounting: history size calculation and ToolOutputMaskingService now count nested functionResponse.parts inlineData bytes (used by Gemini 3 multimodal tool responses).
- Eviction of old outputs: older function responses beyond the 3 protected recent turns get nested parts and inlineData stripped — previously masking kept a 3,000-token inlineData payload, making token savings negative and aborting compression. Exempt retrieval tool outputs (readfile, grep, etc.) are also bounded to a 64KB budget.
- Compression now triggers on a byte threshold, with turn ID stability fixes.
A useful reference for anyone building agent context management: byte accounting of tool outputs and evicting multimodal payloads are critical details for long-session stability.
More from coding & agent
- OpenCartridge adds local-first Image-to-VRM animation pipeline and UniMate Motion model — bdsqlsz · 2026-11-06
- 28,849 trials and $4,746 later: a leaderboard ranks coding-agent harnesses on open models — HankYeomans · 2026-11-06
- vibe42ai ships a Linux client; users ask for security scanning built in — sujingshen · 2026-11-06
- SEO teardown: Amp appears in 0 of 28 AI answers, gets 1/7 the search traffic of peers — iannuttall · 2026-11-06
- Qwen3.8-27B as local coding agent burns 16k tokens thinking, never calls tools — previaegg · 2026-11-06
- Attendee's personal AI OS builds a live web artifact to manage conference notes and contacts — every · 2026-11-06