codex icon indicating copy to clipboard operation
codex copied to clipboard

Codex CLI does not execute cmd.exe /c build.bat under WSL

Open morganavr opened this issue 1 year ago • 8 comments

What version of Codex is running?

0.42.0

Which model were you using?

gpt-5-codex high

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

Launch codex cli under wsl in Windows 10, ask Codex to launch this command: cmd.exe /c build.bat

Codex fails with this error: Ran cmd.exe /c build.bat └ <3>WSL (931 - ) ERROR: UtilBindVsockAnyPort:307: socket failed 1

What is the expected behavior?

command is run

What do you see instead?

Ran cmd.exe /c build.bat └ <3>WSL (931 - ) ERROR: UtilBindVsockAnyPort:307: socket failed 1

Additional information

No response

morganavr avatar Sep 28 '25 10:09 morganavr

I noticed that when Codex CLI adjusted command timeout - command worked successfully. Maybe there is a way to setup command timeouts in config file?

morganavr avatar Sep 29 '25 13:09 morganavr

yeah I came across this issue too, and I also found that letting codex adjust bash tool timeout argument solved the problem, kind of weird

fallonou1999 avatar Oct 10 '25 04:10 fallonou1999

same issue

ekalchev avatar Oct 13 '25 14:10 ekalchev

I found that wrapping the actual command in double quotes fixes the issue cmd.exe /c "tasklist | findstr build"

ekalchev avatar Oct 13 '25 18:10 ekalchev

same issue for "git status" wsl2, codex 0.48

>> Code review started: changes against 'main' <<

• Ran git rev-parse --abbrev-ref 'main@{upstream}'
  └ <3>WSL (281170) ERROR: UtilBindVsockAnyPort:287: socket failed 1

• Ran git merge-base HEAD origin/main
  └ <3>WSL (281244) ERROR: UtilBindVsockAnyPort:287: socket failed 1

• Ran git merge-base HEAD main
  └ <3>WSL (281309) ERROR: UtilBindVsockAnyPort:287: socket failed 1

• Ran git show-ref
  └ <3>WSL (281485) ERROR: UtilBindVsockAnyPort:287: socket failed 1

• Ran git status
  └ <3>WSL (281517) ERROR: UtilBindVsockAnyPort:287: socket failed 1

$ which git
/usr/local/bin/git
$ ls -la /usr/local/bin/git
-rwxr-xr-x 1 root root 133 Aug 21  2023 /usr/local/bin/git
$ /usr/local/bin/git -v
git version 2.50.1.windows.1

seems in my case in my wsl i somehow (mobaxterm terminal) i've got git from windows not local wsl ubuntu git

when i use local ubuntu git it works

$ /usr/bin/git --version
git version 2.34.1
$ codex
› /review current branch against main all commited use /usr/bin/git
• Ran /usr/bin/git rev-parse --abbrev-ref HEAD # now works!
  └ TASK-157

jonny64 avatar Oct 24 '25 13:10 jonny64

We've made a bunch of improvements for WSL in recent versions. I think this issue may no longer be relevant. I'll keep it open until someone is able to confirm.

etraut-openai avatar Nov 12 '25 03:11 etraut-openai

As of v0.80.0 this problem still exists. I tried wrapping the command in double-quotes and without, same result.

KiaArmani avatar Jan 12 '26 14:01 KiaArmani

I encountered this problem, but solved changing permission to full access.

miyafujisosoru-dev avatar Apr 05 '26 07:04 miyafujisosoru-dev