Repository navigation
Description
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 mainCodex 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:
- default.rules is not honored for sandbox-escaping commands even when execpolicy returns allow #15298
- Desktop shell tool still prompts for sandbox approval even when default.rules allows the command #15292
- Windows PowerShell runtime approvals ignore execpolicy prefix_rule for external executables #20713
- Codex randomly wraps commands in
/bin/zsh -lcwhich renders rules useless #10920 - Regression: exec_command routes allowed TZ=... date command through forbidden zsh -lc shell wrapper #21571
- execpolicy check does not mirror runtime PowerShell wrapper unwrapping #24201
- Codex Fine-Grained Permissions #14399
The direct rule appears valid; the issue is that the runtime path did not enforce the prompt despite execpolicy check returning prompt.
Activity
Ram9199 commentedon Jun 2, 2026
Hi @kjendrzyca — your Codex
git pushrules issue is a very concrete runtime-policy mismatch:execpolicy checksays 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:
That would directly help validate whether the evaluation path works for someone already testing prompt/approval enforcement boundaries.
feat(codex): migrate to 0.134+ profile files, granular approvals, env…
wsteenhu commentedon Oct 1, 2026
Related observation on macOS with Codex CLI 0.158.0, using
on-requestrather than the granular approval configuration in the original report.The recorded turn context was:
The user rules contain
prefix_rule(pattern=["git", "push"], decision="prompt"). The standalonecodex execpolicy checkreportspromptforgit 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 mainwith an explicit workdir andsandbox_permissions="require_escalated". No approval prompt was observed. Git executed and returnedEverything up-to-date; no remote change was reported. No prefix approval was intentionally saved.An enabled and trusted diagnostic
PermissionRequestBash hook returned only asystemMessage, without an allow/deny decision. Its message was not observed either. That does not establish whether the hook ran internally. The recordedcode_mode_hostfeature 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
PermissionRequestis 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.