Codex commands timeout issue
Open 💬 19 comments Opened Nov 27, 2025 by LaurentEsingle
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.63.0
What subscription do you have?
"Plus"
Which model were you using?
gpt-5.1-codex
What platform is your computer?
Linux 6.8.0-1040-aws x86_64 x86_64
What issue are you seeing?
Her is an snippet of its thinking:
I'm puzzling over why every command times out, suspecting that shell initialization scripts like .bashrc might be hanging the shell by waiting for input or running indefinitely.
Since the harness likely runs commands via bash -lc, it may source those scripts and cause blocks. I'm considering ways to bypass this, like using env -i with bash --noprofile
--norc or setting BASH_ENV=/dev/null to avoid sourcing, but the first-level shell invocation might still trigger them. Other leads include possible issues with working directory
access, network mounts delaying cd, or environment hooks like pyenv or direnv interfering. Given the repeated 124 timeout status, I’m leaning toward needing to inform the user
commands can't run here or to escalate permissions, but I want to perform more diagnostics, maybe extend timeout to 120 seconds or trace command execution to gather clues before
concluding
It ends up saying something like:
Tried multiple simple commands (ls, pwd, cat instructions.md, even a tiny Python print) inside <path to my project>, but every attempt timed out—no output at all—so
I couldn’t read instructions.md. Looks like the workspace is currently unresponsive to shell commands. Could you check whether the directory is accessible on your end or share the
file contents another way?
What steps can reproduce the bug?
Uploaded thread: 019ac6a8-905d-76e0-b03b-f0e4502f0788
What is the expected behavior?
codex should be able to run simple unix commands like ls
Additional information
I have to specifically instruct it as follows in every prompt:
"Please escalate your commands or you will face hang issues due to sandbox"
Then everything works immediately.
19 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I am experiencing this exact same problem with the exact same codex version in WSL2 (Ubuntu 24.04) under Windows 10.
It can't even run 'ls' or read CLAUDE.md. The shell commands time out with exit code 124. The problem goes away when I run codex with --yolo.
Same "124" exit code issue that resolves if I run codex with --yolo. This is Debian 13 (6.12.57+deb13-amd64).
Same here, in Ubuntu 24.04
I've made progress diagnosing the problem. It happens when I have the following lines in my .profile file:
When you launch codex with the sandbox enabled, pyenv produces the following error:
pyenv: cannot rehash: /home/vlasky/.pyenv/shims/.pyenv-shim existsI asked codex to debug itself and it said:
This problem does not happen under claude or gemini so I am certain it is specific to codex's sandbox. This should give a big clue to codex's maintainers.
Commenting out the pyenv lines gets it working, but obviously this is not a solution.
I see this issue is not new:
This issue has been fixed in pyenv 2.6.16:
https://github.com/pyenv/pyenv/releases/tag/v2.6.16
Easiest way to update pyenv to the latest version is to run the following command from your terminal window:
pyenv updateFor more information on the cause and resolution of the issue, see:
Confirmed that these entries in my .bashrc were causing the timeout:
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
experiencing command timeout as well ... please read thread ID 019af6db-13ac-7340-9cf4-c7699df0e62f
I reproduced the issue on macOS but it wasn’t pyenv-related in my case. The default Codex shell tool kills commands after ~10s
unless I explicitly set a higher timeout_ms on the tool call. Once I pass timeout_ms (e.g., 180000), mvn clean install completes.
On this machine there’s no pyenv in shell init, so the root cause appears to be the tool’s built-in timeout rather than pyenv.
Suggest exposing/documenting the default timeout or allowing a user-level override to avoid confusion.
running CLI 0.65.0
>_ OpenAI Codex (v0.65.0)
Sandbox: danger-full-access
Model: gpt-5.1-codex-max (reasoning xhigh, summaries auto)
If you have
pyenvinstalled. The latest version, 2.6.16, includes a compatibility fix to work with Codex's sandbox mode. Update it to the latest version usingpyenv update. See the following issue for more information:https://github.com/openai/codex/issues/7353#issuecomment-3619122843
I asked codex what to do about this 😛
This actually fixed it though. Skip your fancy shell settings top of your .profile or ~/.bashrc (wherever your asdf/pyenv/fancy-shell goes)
[[ $- != *i* ]] && returnThank you @smith558
I confirm it works well once pyenv is updated.
Reopening the issue.
It was working fine when I updated pyenv.
Later on, I was prompted to update codex (went from 0.64.0 v0.77.0). As soon as I did, the following warnings started popping up
They do not prevent codex from completing the work but it's annoying.
I had to put "Use a default timeout of 300 seconds for commands." in the ~/.codex/AGENTS.md file. That seems to solve the issue.
This results in codex calling any commands with a
timeout 300swrapper.The downside of this is that it screws up execpolicy prefixes.
I asked the agent about this:
Again, I don't understand why the agent isn't given explicit control over its own timeouts. It's a massive pain point for any kind of serious work.
the thing is still VERY slow but it's not timing out just trying to use basic tools.
Looks like the new version of Codex has a workaround? Now it identifies the issue at the start then uses other approaches to access the files:
``
The command showed a pyenv error but confirmed file presence with ls; now I'll read the file contents using sed or ripgrep for clearer insight.``Read dashboard.md
After this initial notice, I get no complaints during the rest of the execution. Or maybe it is not related.
Nope, still facing the same issue.
This issue looks closure-ready if the current environment no longer reproduces it.
The failure boundary is:
command requested in sandbox
≠
shell initialization path is guaranteed to terminate
The report indicates that simple commands such as
ls,pwd, andcattimed out, while explicitly escalating commands made them work immediately.That suggests the root problem is not the command payload itself, but the execution environment selected for sandboxed shell startup.
Minimal closure check:
pwd
Closure boundary:
sandboxed shell startup must produce a terminal outcome for simple commands, or Codex should fail locally with a named diagnostic explaining the unsupported startup layer.
I'm no longer facing this issue with codex. Would love to know the 'yolo' mode of codex tho :)