gemini-cli ACP mode skips tool output truncation, letting one command blow past the 1M token limit
barney-s · ghdev · 2026-10-16
The bug
Issue #29777 on google-gemini/gemini-cli reports that when gemini-cli runs as an ACP agent (gemini --acp), the tools.truncateToolOutputThreshold setting (default 40,000 characters) is never applied — tool output is sent to the model in full. A single shell command with large output can push the request past the model's input limit, failing with 400: input token count exceeds 1048576. In interactive and -p modes, the same command is truncated as documented.
Root cause
- The normal scheduler path calls truncateOutputIfNeeded in tool-executor.ts;
- The ACP path (acpSession.ts) calls invocation.execute() directly and records the untruncated llmContent as the function response;
- Auto chat compression can't catch it either: it checks the token count from the previous response, which excludes the new tool output, so a single huge output fires before compression runs.
Observed in practice
- One test command produced 1.2M characters, jumping context from 98k to 530k tokens in a single turn; compression only ran on the next turn;
- Another produced 2.7M characters, exceeding the 1,048,576 token limit and failing the turn.
Agent developers wiring gemini-cli into ACP clients with auto-approval (yolo) should avoid commands with large outputs until this is fixed.
More from coding & agent
- OpenJet claims Qwen3.8-27B coding runs 1.9x faster than llama.cpp on one RTX 3090 — JeremyCMorgan · 2026-10-23
- Building an autonomous SEO agent in Hermes with three skills: programmatic pages, Keywords Everywhere, DataForSEO — EXM7777 · 2026-10-23
- Building a sports betting AI agent with onchain execution and human approval by default: architecture and lessons — Dry-Comfortable-2678 · 2026-10-23
- Capy 0.5.0 lets Claude Pro/Max subscribers reuse their plan quota, adds OIDC cloud access — garrytan · 2026-10-23
- You.com CEO Richard Socher: legacy code is human slop, let AI clean it up — RichardSocher · 2026-10-23
- Let agents design a single-line glance component so you can track them from the sidebar — blixt · 2026-10-23