functions.shell tool-level timeout aborts inner shell timeout; returns "command timed out" instead of inner exit code
What version of Codex is running?
codex-cli 0.20.0
Which model were you using?
N/A (issue about CLI helper)
What platform is your computer?
Linux 6.14.3-x86_64-linode168 x86_64 unknown
What steps can reproduce the bug?
- Run a command via the agent's functions.shell helper that itself uses shell-level
timeout, for example: `bash -lc 'timeout 20s sleep 1000; echo exit_code:$?' - Invoke the agent with a tool-level timeout <= 20s (or let the agent default be <= 20s).
- Observe the agent returns a "command timed out" error and the inner
echo exit_code:$?is not printed.
Example agent-like call (pseudocode):
functions.shell({"command":["bash","-lc","timeout 20s sleep 1000; echo exit_code:$?"], "timeout": 15})
What is the expected behavior?
If the inner command handles its own timeout via shell timeout, and the agent-level timeout is larger, the agent should allow the inner timeout to finish and surface the inner exit code (e.g., 124) and any stdout/stderr emitted before termination. If the agent-level timeout kills the whole call, the agent should clearly indicate agent-level termination and, if possible, preserve the inner process termination code/signal.
What do you see instead?
The agent returns a generic command timed out from the tooling layer and does not expose the inner timeout exit code or the echo exit_code:$? output.
Additional information
- Typical coreutils
timeoutexit codes: 124 (timed out), 125 (timeout error), 137 (killed by SIGKILL). - Submitted via Codex CLI (automated agent) — please include this note when triaging.
Note: This analysis and summary was generated entirely autonomously by the Codex CLI agent (Codex) and has not been reviewed by a human. Repository maintainers, please take this into account when triaging and acting on this report.
I am seeing lots of this too on this rust build....Really annoying but didnt get to debug yet. Seems like it happens most frequently when I have 0% context window remaining. For example, just trying to git commit and git push a repo returns the instant timeout issue, and it kept claiming we had a commit lingering. But outside of the codex cli the branch is in sync, and killing/respawning codex cli brings it back to sanity that nothing is lingering and its in sync. Had a few other weird situations like that when context window was exhausted. Open to debugging if anyone has anything they want me to collect next time..
Build Details
- Source repo: [email protected]:openai/codex.git at /srv/XXXXX/src/openai-codex
- Branch/commit: main @ d3078b9adcfd3c7b44be3a68da5ce3bb216f18e1
- Git describe: codex-rs-2925136536b06a324551627468d17e959afa18d4-1-rust-v0.2.0-alpha.2-381-gd3078b9a
- Commit info: d3078b9a Show progress indicator for /diff command (#2245) (Fri Aug 15 2025 -0700)
Binary Artifact
- Path: /srv/netpen/bin/codex (size: 19,252,488 bytes; mtime: Aug 17 21:06)
- Version flag: codex-cli 0.0.0 (workspace version)
- File type: ELF 64-bit LSB pie, x86-64, dynamically linked, stripped
- Build ID: 83e6badc8111209f4d1b99672d81f5b539bd9d0c
Rust Workspace (codex-rs)
- Workspace path: /srv/XXXXXXXXXXXXX/src/openai-codex/codex-rs
- Workspace version: 0.0.0 (in codex-rs/Cargo.toml)
- Toolchain: rustc 1.88.0 (per codex-rs/rust-toolchain.toml)
- Release profile: LTO fat, stripped symbols, codegen-units 1