Skip to content

Make default shell tool output token limit configurable #20861

Closed as not planned

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

  1. added
    enhancementNew feature or request
    CLIIssues related to the Codex CLI
    configIssues involving config.toml, config keys, config merging, or config updates
    tool-callsIssues related to tool calling
    on May 3, 2026
  2. eddyaipt commented on May 3, 2026

    @eddyaipt

    A per-profile or per-job default would be especially useful here, not just a single global knob. The painful case is usually context hygiene in automation: one repo wants aggressively truncated shell output by default, while another temporarily needs larger windows for tests or log-driven debugging.

  3. etraut-openai commented on Jul 1, 2026

    @etraut-openai
    Contributor

    This feature request hasn't received enough upvotes, so it is being closed automatically. If you still feel this feature is needed, please open a new feature request with an updated title and description.

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