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
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

## 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 ↗

3 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #14879
  • #16058
  • #16016
  • #16610

Powered by Codex Action

etraut-openai contributor · 4 months ago

By default, tool outputs are limited to 10K tokens. If you'd like, you can override this value using the tool_output_token_limit config key. For example: tool_output_token_limit = 50000. I don't recommend making it too small though, as you will see strange behaviors if the model receives truncated tool output.

khanhtd36arb · 4 months ago

Follow-up with regression boundary:

I can consistently reproduce heavy burn on >=0.117.x, while 0.116.0 behaves significantly better in the same workflow on my machine.

Regression signal:

  • 0.116.0: acceptable behavior
  • 0.117.0 / 0.118.0 / 0.119.0-alpha.6: aggressive burn when tool output is large or medium-large

This suggests a regression introduced between 0.116.0 and 0.117.0, not just user prompting style.

Possible related change (from release history):

  • 0.117.0 changelog includes "core: add a full-buffer exec capture policy" (#15254)

Please treat this as a versioned regression report. If helpful, I can provide additional A/B logs from 0.116.0 vs 0.117.0 for the same command patterns.