Codex randomly wraps commands in `/bin/zsh -lc` which renders rules useless
What version of Codex CLI is running?
codex-cli 0.98.0 but it's been like this for a long time
What subscription do you have?
max (200$)
Which model were you using?
gpt-5.3
What platform is your computer?
Darwin 24.6.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
irrelevant, hapens in all of them (iterm, vscode, zed)
What issue are you seeing?
The way that codex runs commands is incredibly confusing (shells? login shells? background shell? single command?); and I still can't figure out if the /bin/zsh -lc that gets wrapped around some commands is part of the harness or explicitly invoked by the model - probably both, depending on the exact situation?
But the result is that the rules in execpolicy are rendered completely useless because the entire command is wrapped in /bin/zsh -lc '....' so it only matches against the /bin/zsh -lc prefix.
I've read that you normally parse this https://github.com/openai/codex/issues/9206 , but it doesn't appear to be working.
I've read that env vars before the command might break it - but that's not the case here.
What steps can reproduce the bug?
very random - sometimes it works, sometimes it starts using this weird way of invoking commands. When i tell it to stop it says things like "I didn't actually use /bin/zsh -lc for that command, but maybe the harness is adding it automatically...?".
What is the expected behavior?
_No response_
Additional information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗