Codex tries to run shell commands in single quotes
Resolved 💬 5 comments Opened Sep 19, 2025 by DenisGorbachev Closed Apr 18, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.39.0
Which model were you using?
gpt-5-codex high
What platform is your computer?
Darwin 24.6.0 arm64 arm
What steps can reproduce the bug?
• Ran 'fd mise.toml'
└ bash: fd mise.toml: command not found
• Ran 'ls'
• Ran 'rg "dx:build:web" mise.toml'
└ bash: rg "dx:build:web" mise.toml: command not found
Codex tries to run 'fd mise.toml' instead of fd mise.toml (without quotes).
I can't reproduce it with a specific prompt, but it happens sporadically quite often.
Maybe we can simply trim ' before executing the command?
What is the expected behavior?
Codex should execute the shell commands without wrapping them in single quotes.
What do you see instead?
_No response_
Additional information
_No response_
5 Comments
Yeah this is causing a load of grief here too where most external tooling isn't working anymore. I'm forced to write shims for codex.exe so that parameters are forwarded back to the real binary with proper quoting.
I think the latest models are much better about this. Are you still seeing this problem?
@etraut-openai I still see similar issues with latest models on remote command like
kubectl+pythonetc..Yes, unfortunately. I have adjusted a preamble AGENTS.md file for my projects that instruct the agent session to modify their handling of the
shell_commandhelper such that they escape or use POSIX-style quoting. The latest models are adhering to this explicit instruction reasonably well, but without it they still use poor quoting. A few versions of Codex CLI ago, we didn't require the PowerShell harness at all and it was issuing the commands directly. That behavior was preferred.Closing outdated bug.