gemini-cli PR caps grep_search output at 40K chars after one search sent ~41M tokens
paolo-perrone · ghdev · 2026-11-03
- PR #30109 fixes unbounded grepsearch output in gemini-cli: the old match cap limited lines but not size, so 100 default matches over long log/minified lines could build 150K characters, which the generic 64KB executor cap then cut mid-line, telling the model to read the full output from a file.
- The fix bounds output inside the tool at MAXGREPOUTPUTCHARS (40,000 chars), cutting on whole lines, adding a (limited) summary with match counts, and nudging the model toward narrower patterns, includepattern, dirpath, or namesonly.
- Context lines are dropped first to preserve matches; the threshold aligns with the default truncation and distillation thresholds (10K tokens × 4). Results under budget are byte-for-byte identical, existing tests pass, and it complements #29822's totalmaxmatches cap. The extreme case from issue #17448 — one search sending 41M tokens — can no longer happen on main.
More from coding & agent
- How LangChain optimized browser use for Deep Agents with Stagehand — LangChain · 2026-11-04
- Plane AI scores 165/165 on real workspace eval: 18s median latency, $0.10 per answer — JosephJacks_ · 2026-11-04
- SurrealDB 4 launches with SurrealDB Earth: serverless agent database on Cloudflare — ritakozlov · 2026-11-04
- Karpathy's "vibe coding" post hailed as a shoo-in for the test-of-time award — MillionInt · 2026-11-04
- OpenAI SDK ships official WebSocket helpers for Responses, GPT-Live and Realtime APIs — craigsdennis · 2026-11-04
- Pydantic AI adds ConversationStore to prevent concurrent chat saves from overwriting each other — samuelcolvin · 2026-11-04