Skip to content

Config option to set a minimum for the model's exec yield_time_ms #57604

Open

Description

@nsxdavid

What variant of Codex are you using?

CLI (codex exec), 0.160.0, Linux x86_64

What feature would you like to see?

A configuration option that sets a minimum (or a fixed override) for the
yield_time_ms the model passes to exec_command and to empty-input
write_stdin polls. For example:

[unified_exec]
min_yield_time_ms = 30000        # exec_command and empty write_stdin polls
# or: yield_time_ms_override = 30000

Both calls already return as soon as the process exits, so a minimum costs
nothing for commands that finish. It only stops the tool from handing control
back to the model while a short command is still running.

Why

The model often chooses yield_time_ms: 1000 for commands that take a few
seconds. exec_command then returns Process running with session ID N. The
model calls write_stdin with empty input to check again, often with
yield_time_ms: 1000 again. Each check is a full model request that re-sends
the whole conversation.

In one day of non-interactive codex exec sessions we measured 634 such polls,
which re-sent 95.6M input tokens, about 9% of all input. In a sample of 187
polled commands the median runtime was 1 s and p90 was 7.5 s. 186 of the 187
finished within 30 s, so a 30 s minimum would have avoided almost every poll.

Today there is no way to set this:

  • exec_command clamps yield_time_ms to 250–30,000 ms, and the model picks
    the value. There is no config key for a minimum or a default.
  • background_terminal_max_timeout only raises the maximum for empty polls.
  • A PreToolUse hook's updatedInput can only rewrite command, not
    yield_time_ms.
  • features.code_mode.default_exec_yield_time_ms applies only to code-mode
    exec cells, not to direct exec_command calls.
  • Instructions asking the model to use 30000 help but are not enforced.

Reproduction

  1. Run codex exec against any Responses endpoint, or a local stub that
    returns a function_call for exec_command with
    {"cmd": "sleep 4; echo done", "yield_time_ms": 1000}.
  2. The tool output is Wall time: 1.0 seconds /
    Process running with session ID N, and the next model request is sent
    after about 1 s.
  3. With {"yield_time_ms": 30000} the same command returns
    Process exited with code 0 / done after about 4 s in a single request.
    That is the behavior we want to be able to enforce from config.

Related

This request is narrower than those: a config value for the minimum (or an
override) of the wait the model already controls. Processes that never exit,
such as dev servers or watchers, would still return after the configured
minimum.

Activity

  1. added
    enhancement
    CLI
    exec
    config
    on Oct 28, 2026
  2. LoomDeBWiles commented on Nov 15, 2026

    @LoomDeBWiles

    Adding data from six long-running GPT-6.1-Sol (high) sessions on CLI 0.165, each told in AGENTS.md to block on one long wait (yield_time_ms 86400000, which background_terminal_max_timeout allows on this host):

    • Four sessions followed it. Each made 7 waits at 86400000 ms, and each wait blocked until the job finished, one of them for 2,243 s in a single call.
    • One session polled write_stdin with empty input 10 times at 300000 ms. That's the top of the "5000-300000 ms" range in the built-in write_stdin description, which seems to override the instruction file.
    • One session, in code mode, called wait 58 times at 60000 ms during a 6.5-hour run that used 113M tokens.

    So long waits work. The short polls come from the model's choice of yield, influenced by the default range in the tool description. A config minimum, as proposed here, would have stopped both failures. Please apply it to code-mode wait(cell_id) as well as exec_command and write_stdin, since one of the two failures went through that path.

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

    CLIconfigenhancementexec

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions