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.
2 Comments
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
Binary Artifact
Rust Workspace (codex-rs)