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?

  1. 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",
    ],
)
  1. 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_

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 7 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #4293

Powered by Codex Action

etraut-openai contributor · 7 months ago

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?

You can use the codex execpolicy check CLI command to test your rules.

amit-mittal · 7 months ago

Thanks @etraut-openai! I had restarted the extension, but looks like restarting the VS Code itself finally fixed it for me.