You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of the VS Code extension are you using?
0.4.58
What subscription do you have?
Enterprise
Which IDE are you using?
VS Code
What platform is your computer?
Darwin 24.4.0 arm64 arm
What issue are you seeing?
I have a rules file configured in my repo's rules folder as well as under $CODEX_HOME/rules, but none of them are being considered by the VSCode extension in the agent mode and it is still prompting me for the approved commands.
What steps can reproduce the bug?
Create ~/.codex/rules/gh.rules or <repo-root>/.codex/rules/gh.rules with
prefix_rule(
# The prefix to match.
pattern = ["gh", "pr", "view"],
# The action to take when Codex requests to run a matching command.
decision = "approve",
# Optional rationale for why this rule exists.
justification = "Viewing PRs is allowed with approval",
# `match` and `not_match` are optional "inline unit tests" where you can
# provide examples of commands that should (or should not) match this rule.
match = [
"gh pr view 7888",
"gh pr view --repo openai/codex",
"gh pr view 7888 --json title,body,comments",
],
not_match = [
# Does not match because the `pattern` must be an exact prefix.
"gh pr --repo openai/codex view 7888",
],
)
Invoke this command from the extension, but still it will be prompted for approval.
Rules need to be installed in the $CODEX_HOME/rules directory. If they're in your workspace directory, they will be ignored. Default sandbox policies allow the agent to write to your workspace, so supporting sandbox policy rules in that location is a security problem.
You mentioned that you've tried placing the rules in your $CODEX_HOME/rules directory and they didn't work. Did you restart the extension after installing them?
Activity
github-actions commentedon Jan 13, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
etraut-openai commentedon Jan 13, 2026
Rules need to be installed in the
$CODEX_HOME/rulesdirectory. If they're in your workspace directory, they will be ignored. Default sandbox policies allow the agent to write to your workspace, so supporting sandbox policy rules in that location is a security problem.You mentioned that you've tried placing the rules in your
$CODEX_HOME/rulesdirectory and they didn't work. Did you restart the extension after installing them?You can use the
codex execpolicy checkCLI command to test your rules.amit-mittal commentedon Jan 13, 2026
Thanks @etraut-openai! I had restarted the extension, but looks like restarting the
VS Codeitself finally fixed it for me.