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_

View original on GitHub ↗

5 Comments

psouza4 · 9 months ago

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.

etraut-openai contributor · 7 months ago

I think the latest models are much better about this. Are you still seeing this problem?

bhack · 7 months ago

@etraut-openai I still see similar issues with latest models on remote command like kubectl + python etc..

psouza4 · 7 months ago
I think the latest models are much better about this. Are you still seeing this problem?

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_command helper 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.

etraut-openai contributor · 4 months ago

Closing outdated bug.