Repository navigation
Description
What variant of Codex are you using?
CLI
What feature would you like to see?
Currently the rules only support prefix_rule which is very limiting because it only matches the whole literal. There were multiple issues before and the solution would be to improve the rules engine (say, #11298, #8537, #13175 and probably more)
Personally, I am using codex to handle some ops command calls. And in lot of cases (>80% of the time), the commands are just differed from each other a little bit. Let's say, cat xxx | head -5 and cat xxx | head -6. However, due to how the prefix_rule is implemented, codex will ask for approval for each of these variants.
( I need to approve for different file and message each time :-( )
For projects that requires mixed use of kubectl and bash, it is very typical for user to review and approve 5-10 very similar commands for each message that the user sends. The non-stop approval steps are actually not safe (or dangerous) because people will get tired and approve something that should not be approved.
Since the rules are using Starlark syntax. I would propose to create another kind of rule, called general_rule(), which accepts a custom Starlark function to approve / reject. For example,
def my_rules(args):
return args[0] == "super-cli"
def is_inline_shell_script(func):
def _inner(args):
return args[0] in ("bash", "zsh") and args[1] == "-c" and func(args[2:])
return _inner
general_rule(predicate=my_rules, decision="allow")
general_rule(predicate=is_inline_shell_script(my_rules), decision="allow")
This can allow user to leverage the community (or AI) to build better rule handling system. Let's say, people can implement rules to handle && and || shell conditions - by implementing a shell script parser and intersection of nested rules.
Additional information
No response
Activity
github-actions commentedon Mar 19, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
ehendrix23 commentedon Apr 8, 2026
Just in further support, I regulary have it wanting to run items like:
But the only way for me currently to auto-approve running of uv run pytest like that is a rule allowing "/bin/zsh -lc".
alexander-zuev commentedon Jul 10, 2026
Please support positional wildcards in rules. Monorepos need to allow
pnpm --filter <any-package> test|build|lintwithout also allowing deploy or migration scripts, e.g.["pnpm", "--filter", ANY, one_of("test", "build", "lint")].benglewis commentedon Oct 11, 2026
I had Codex implement a version of this in my fork branch. It adds
general_rule(predicate=...)with retained Starlark functions, boolean results, best-effort evaluation limits, and rejection on predicate errors. It also preserves restrictive rule precedence and checks shell wrappers without letting an outer allow approve unrelated inner commands.The combined implementation passed 43 execpolicy tests and 101 focused core tests locally. Given the policy on external PRs, I'm sharing it as a reference in case the upstream team would consider implementing something similar.
hktonylee commentedon Oct 16, 2026
This issue may become obsoleted now because the new auto approval system can automate custom rules in most cases.