Codex CLI: oversized tool outputs are ingested into context and can drain 5h quota disproportionately

Resolved 💬 3 comments Opened Apr 3, 2026 by khanhtd36arb Closed Apr 3, 2026

## Summary
Codex CLI can consume extremely large tool outputs (for example broad rg -n) and feed them directly into model context, causing disproportionate 5-hour quota burn for otherwise simple tasks.

This feels like a harness inefficiency: tool output ingestion is effectively unbounded, and quota impact is amplified across subsequent turns as context grows.

Environment

  • Codex CLI: 0.118.0
  • OS: Windows 11
  • Model: gpt-5.3-codex
  • Reasoning effort: medium

Reproduction

  1. Start a normal coding session in a large repository.
  2. Run a broad search command through the CLI tool path, for example:
  • rg -n --hidden -S "IP Scan|scan ip|scanIP|IpScan|IPScan|Aux|Unknown|IV"
  1. Continue normal follow-up turns in the same session.

Observed behavior

  • A single tool output can be massive and appears to be forwarded directly into context.
  • In my logs, one function_call_output shows:
  • Original token count: 948372
  • Total output lines: 23781
  • Same day had additional very large outputs (300k+ tokens, 100k+ tokens).
  • After this, later turns become expensive due to bloated context, and the 5-hour usage limit is exhausted much faster than expected.

Expected behavior

  • Tool output ingestion should be token-budgeted and safe by default.
  • Very large tool outputs should be summarized/truncated before entering model context.
  • CLI should warn and require opt-in when predicted output is above a threshold.
  • Quota UX should clearly attribute high burn to oversized tool outputs.

Additional telemetry concerns

I also observed occasional inconsistent quota telemetry (for example used_percent = 0 with reset time near Unix epoch in some events), which may be a separate bug, but worsens user trust when quota drains quickly.

Suggested fixes

  • Hard cap on tool-output-to-context tokens.
  • Automatic extractive summarization for oversized outputs.
  • Safer defaults for broad commands (rg, git diff, large file dumps).
  • Per-turn token budget warning before executing high-risk commands.
  • More explicit meter diagnostics in UI/logs.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗