Make default shell tool output token limit configurable

Resolved 💬 2 comments Opened May 3, 2026 by mgwals Closed Jul 1, 2026

What version of Codex CLI is running?

codex-cli 0.128.0

What platform is your computer?

Linux

What issue are you seeing?

Codex shell tool calls allow a per-call max_output_tokens, but when the model or client omits it, unified exec falls back to a fixed built-in default. In current builds this default is large enough that routine shell/log commands can add a lot of low-value output to the model context before the user has a chance to control it.

External output filters can help for some completed commands, but they are not a full substitute for a client-side default because:

  • not every shell result necessarily goes through the same post-processing path
  • background/running process chunks need to preserve process metadata
  • users may want a conservative global default while still allowing explicit larger caps for debugging

What steps can reproduce the issue?

  1. Start Codex CLI in a repository.
  2. Run or ask Codex to inspect a command that can produce verbose output, such as logs, broad search results, or test output.
  3. Do not specify max_output_tokens for that tool call.
  4. Observe that the built-in default output budget is used instead of a user-configurable default.

What is the expected behavior?

Codex CLI should expose a configuration option for the default shell tool output token cap, applied only when a tool call omits max_output_tokens.

For example:

[tools.unified_exec]
default_max_output_tokens = 5000

Suggested behavior:

  • preserve explicit per-call max_output_tokens
  • clamp to any model/session truncation policy as today
  • keep a reasonable upstream default for users who do not configure it
  • optionally allow separate defaults for completed one-shot commands and running/background process chunks

This would let users reduce accidental context growth without losing the ability to request larger outputs when they are useful.

Additional information

Related but not identical:

  • #19001 asks for first-class output filtering/RTK-style compression.
  • #13733 covers token waste from background process polling.

This request is narrower: make the existing fallback output cap configurable so users can choose a smaller default without patching Codex CLI or relying solely on external hooks.

View original on GitHub ↗

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