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.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗