Skip to content

0.135: default.rules prompt for git push is ignored under danger-full-access / granular rules=true #25312

Open

Description

@kjendrzyca

What version of Codex are you using?

codex-cli 0.135.0

What platform are you using?

macOS arm64

What happened?

A default.rules prompt rule for git push was matched by codex execpolicy check, but the runtime allowed an agent-initiated git push origin main to run without an approval prompt.

This happened in a trusted project while using unrestricted filesystem/network access plus granular approval configuration with rules = true.

Relevant config

# ~/.codex/config.toml
sandbox_mode = "danger-full-access"
approval_policy = { granular = { sandbox_approval = false, rules = true, mcp_elicitations = false, request_permissions = false, skill_approval = false } }
approvals_reviewer = "user"
// ~/.codex/rules/default.rules
prefix_rule(
    pattern = ["git", "push"],
    decision = "prompt",
    justification = "Publishing changes requires approval"
)

Expected behavior

When the agent attempts to run:

git push origin main

Codex should show an approval prompt because default.rules says decision = "prompt" for git push and granular rules = true is enabled.

Actual behavior

The agent ran git push origin main and pushed successfully without an approval prompt.

The /permissions UI only showed coarse profiles: Default, Auto, and Full. It did not show whether ~/.codex/rules/default.rules was active, nor any custom/granular rules state.

Diagnostics

codex execpolicy check correctly reports prompt:

codex execpolicy check --pretty --rules ~/.codex/rules/default.rules -- git push origin main
{
  "matchedRules": [
    {
      "prefixRuleMatch": {
        "matchedPrefix": ["git", "push"],
        "decision": "prompt",
        "justification": "Publishing changes requires approval"
      }
    }
  ],
  "decision": "prompt"
}

codex doctor --summary --ascii reports:

Codex Doctor v0.135.0 · macos-aarch64
sandbox: filesystem unrestricted · network enabled
Configuration: sandbox unrestricted fs + enabled network · approval Granular(GranularApprovalConfig { sandbox_approval: false, rules: true, skill_approval: false, request_permissions: false, mcp_elicitations: false })

Notes

This looks related to the broader class of issues where execpolicy check, runtime command normalization, and the permissions UI do not fully agree, but I did not find an exact duplicate for the under-prompting case on macOS 0.135:

The direct rule appears valid; the issue is that the runtime path did not enforce the prompt despite execpolicy check returning prompt.

Activity

  1. added
    bug
    CLI
    sandbox
    config
    on May 30, 2026
  2. removed
    CLI
    on May 30, 2026
  3. Ram9199 commented on Jun 2, 2026

    @Ram9199

    Hi @kjendrzyca — your Codex git push rules issue is a very concrete runtime-policy mismatch: execpolicy check says prompt, but the actual agent-initiated command ran without approval.

    I maintain Agent_Sudo, a local MCP permission gateway. I’m not looking for architecture feedback, interoperability discussion, or a PR. I’m trying to validate whether a first-time evaluator can prove the current enforcement/audit loop in five minutes:

    blocked -> delegated once -> allowed once -> blocked again -> audit verified

    Guide:
    https://github.com/Kisyntra/Agent_Sudo/blob/main/docs/evaluate_5_minutes.md

    Could you run it once and reply with either:

    • “I ran it.”
    • “I tried and stopped at step X because Y.”

    That would directly help validate whether the evaluation path works for someone already testing prompt/approval enforcement boundaries.

  4. wsteenhu commented on Oct 1, 2026

    @wsteenhu

    Related observation on macOS with Codex CLI 0.158.0, using on-request rather than the granular approval configuration in the original report.

    The recorded turn context was:

    approval_policy=on-request
    approvals_reviewer=user
    sandbox_policy=danger-full-access
    

    The user rules contain prefix_rule(pattern=["git", "push"], decision="prompt"). The standalone codex execpolicy check reports prompt for git push origin main. The rules directory is a symlink to a versioned directory; the rules file itself is a regular file.

    On September 30, the agent invoked git push origin main with an explicit workdir and sandbox_permissions="require_escalated". No approval prompt was observed. Git executed and returned Everything up-to-date; no remote change was reported. No prefix approval was intentionally saved.

    An enabled and trusted diagnostic PermissionRequest Bash hook returned only a systemMessage, without an allow/deny decision. Its message was not observed either. That does not establish whether the hook ran internally. The recorded code_mode_host feature was enabled.

    This is a single observed invocation, not a controlled minimal reproduction. We cannot reconstruct the effective in-memory rules for that invocation, and have not established whether rule loading, execution dispatch or approval UI caused the discrepancy.

    Should an explicit matching prompt rule produce a human approval request with this configuration? Is there a supported way to inspect the effective loaded rules and approval decision without executing another live push?

    Separately, the missing command cwd in PermissionRequest is already covered by #48064. We have kept our repository-dependent approval hook inactive because of that limitation. We are not requesting a broad allow rule or weaker safeguards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfigsandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions