Skip to content

Make default shell tool output token limit configurable #20861

Description

@mgwals

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:

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    configIssues involving config.toml, config keys, config merging, or config updatesenhancementNew feature or requesttool-callsIssues related to tool calling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions