Skip to content

feat: improve Guardian denial recovery#26128

Closed
viyatb-oai wants to merge 1 commit into
mainfrom
codex/viyatb/guardian-improvements
Closed

feat: improve Guardian denial recovery#26128
viyatb-oai wants to merge 1 commit into
mainfrom
codex/viyatb/guardian-improvements

Conversation

@viyatb-oai

@viyatb-oai viyatb-oai commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Superseded

This combined PR has been split into independently reviewable changes:

Paired App PR: openai/openai#986632

The core behavior PRs target main independently. #26232 depends only on #26231.

Co-authored-by: Codex noreply@openai.com
@viyatb-oai viyatb-oai requested a review from a team as a code owner June 3, 2026 09:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: add5728ffd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +121 to +122
if denied_action.denial_kind != GuardianDenialKind::Soft
|| denied_action.action != event.action

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require full payloads for exact denial retries

For soft-denied MCP calls and patch applications, GuardianAssessmentAction only contains the server/tool or touched file list, not the MCP arguments or patch body that Guardian actually reviewed. This equality check therefore treats a later approval for the same tool/files as an exact match even when the payload differs, and the injected approval tells the model the user approved the “exact action”; in those connector/patch scenarios that can let a user approval for one denied payload be reused as authorization context for another. Include the reviewed payload in the stored/compared action, or disable explicit retry for action variants that are only summaries.

Useful? React with 👍 / 👎.

Comment on lines +118 to +119
let Some(denied_action) = self.actions.get(&event.id) else {
return false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Persist retryable denials across thread replay

When a soft denial is shown from replay or after reopening a thread, the TUI still offers /approve, but this registry is only populated in the live SessionServices for denials produced during the current process. A resumed/recreated session has the historical GuardianAssessmentEvent but no matching guardian_denied_actions entry, so the approval is silently ignored by core while the client reports it was recorded. Either reconstruct/persist these one-use entries from thread history, or avoid offering approval for replayed denials that cannot be claimed.

Useful? React with 👍 / 👎.

Comment on lines +150 to +153
return with_cached_approval(
&session.services,
"shell",
keys,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep auto-review cache separate from user approvals

This now stores Guardian ApprovedForSession decisions in the same tool_approvals cache that the manual approval path checks. In a session where the user switches between Auto Review and normal user approval, a low-risk Guardian approval can later bypass the user prompt in manual mode (and a prior manual session approval can bypass Guardian in Auto Review mode) for the same command key. Key the cache by reviewer/source or keep Guardian session approvals separate so changing review mode actually changes who reviews the next approval.

Useful? React with 👍 / 👎.

@viyatb-oai

Copy link
Copy Markdown
Collaborator Author

Superseded by the split stack: #26230, #26231, and #26232. Paired App PR: openai/openai#986632.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant