exec_command shell commands hang the CLI for 30 seconds, even if the command finishes sooner.
What version of Codex is running?
0.58.0
What subscription do you have?
irrelevant (Plus)
Which model were you using?
irrelevant (gpt-5.1)
What platform is your computer?
irrelevant (Linux 6.17.7-arch1-1 x86_64 unknown)
What issue are you seeing?
Every time a command is executed with the unified_exec but stemming from a ToolCall: exec_command, OpenAI passes a yield_time_ms of 120000 (2 minutes; this is hard coded and never varies). The CLI clamps that to MAX_YIELD_TIME_MS (aka, 30 seconds). With this collect_output_until_deadline is called which never returns until that deadline has been reached: no output from the executed bash -lc 'command' is made available, at all, until 30 seconds have passed.
What steps can reproduce the bug?
Turn on unified_exec (should be the default, or add:
[features]
unified_exec = true
to ~/.codex/config.toml
Make sure INFO lines are logged to .codex/log/codex-tui.log.
Ask the model to execute something that finishes immediately (eg: Please run: echo "yield_time_ms test").
This MIGHT*) produce in the logs:
2025-11-15T16:57:44.842744Z INFO ToolCall: exec_command {"cmd":"echo \"yield_time_ms test\"","yield_time_ms":120000,"max_output_tokens":2000}
While the command is executed instantly (as soon as you see the above line in the logs), it will take 30 seconds or more before the result appears on the screen and the model reacts to the output.
*) See 019a8913-b8c1-7383-9243-f984a010ad81 (this is from a /feedback and should link to a conversation I had?)
So, as per gpt-5.1's own suggestion:
“When the unified exec exec_command tool is invoked with yield_time_ms = 30000 and a fast command like echo hi, the response only arrives after ~30s, even though the process finishes immediately. Expected: response should return as soon as output is available, regardless of yield_time_ms.”
What is the expected behavior?
As soon as the child process (bash) finishes, the last chunk should be collected and sent off to the model and the CLI terminal.
Additional information
During another session with chatgpt it used 120000 (2 minutes) for EVERY command - no matter how quick they would finish. It claimed that it had no control over that and that it was something configured in the CLI. So I asked where that was (I was working on the codex CLI, after all). It searched and then said: it is not anywhere in the CLI - it is hard coded on the side of OpenAI. I totally lied to me. I had asked if it did add that to waste my time and it denied that, saying it had no control over it. Well, see the above conversation (019a8913-b8c1-7383-9243-f984a010ad81) clearly it DOES have control over it and consciously adds some value every time.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗