Conversation
joshka-oai
approved these changes
Jan 5, 2026
Collaborator
joshka-oai
left a comment
There was a problem hiding this comment.
LGTM
I note that this doesn't have a UI snapshot test change.
This would make it clear how these messages end up being rendered by the TUI.
I'm assuming that we probably don't have that plumbed in yet, but likely should.
(not a blocker for this PR - but possibly worth a quick follow up)
codex-rs/execpolicy/README.md
Outdated
| - Policy engine and CLI built around `prefix_rule(pattern=[...], decision?, justification?, match?, not_match?)`. | ||
| - This release covers the prefix-rule subset of the execpolicy language; a richer language will follow. | ||
| - Tokens are matched in order; any `pattern` element may be a list to denote alternatives. `decision` defaults to `allow`; valid values: `allow`, `prompt`, `forbidden`. | ||
| - `justification` is an optional human-readable rationale for why a rule exists. It can be provided for any decision and may be surfaced in different contexts (for example, in approval prompts or rejection messages). |
Collaborator
There was a problem hiding this comment.
Add a note about how this can be used to present alternatives here (like mentioned in the doc comments).
etraut-openai
approved these changes
Jan 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional
justificationparameter to theprefix_rule()execpolicy DSL so policy authors can attach human-readable rationale to a rule. That justification is propagated through parsing/matching and can be surfaced to the model (or approval UI) when a command is blocked or requires approval.When a command is rejected (or gated behind approval) due to policy, a generic message makes it hard for the model/user to understand what went wrong and what to do instead. Allowing policy authors to supply a short justification improves debuggability and helps guide the model toward compliant alternatives.
Example:
If Codex tried to run
git push origin main, now the failure would include:whereas previously, all it was told was: