Use configured rules for VSCode extensions
Resolved 💬 3 comments Opened Jan 13, 2026 by amit-mittal Closed Jan 13, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
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.rulesor<repo-root>/.codex/rules/gh.ruleswith
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.
What is the expected behavior?
Not prompt and automatically run the command
Additional information
_No response_
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
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.Thanks @etraut-openai! I had restarted the extension, but looks like restarting the
VS Codeitself finally fixed it for me.