Skip to content

Bypass review for always-allow MCP tools in auto-review#20069

Merged
maja-openai merged 3 commits into
mainfrom
codex/auto-review-approve-bypasses-arc
Apr 30, 2026
Merged

Bypass review for always-allow MCP tools in auto-review#20069
maja-openai merged 3 commits into
mainfrom
codex/auto-review-approve-bypasses-arc

Conversation

@maja-openai
Copy link
Copy Markdown
Contributor

Why

When an MCP or app tool is configured with approval mode approve (always allow), users expect that decision to be authoritative. In guardian auto-review mode, ARC could still return ask-user, which then routed the approval question into guardian with the ARC reason as context. That meant a tool explicitly configured as always allowed still went through both safety monitors before running.

This change keeps the existing ARC behavior for non-auto-review sessions, but avoids the ARC-to-guardian sequence when approvals_reviewer = auto_review and the tool approval mode is approve.

What changed

  • Short-circuit MCP tool approval handling when approval_mode == approve and approvals_reviewer == auto_review.
  • Updated the MCP approval regression test so the auto-review case asserts neither ARC nor guardian is called.
  • Preserved existing tests that verify ARC can still block always-allow MCP tools outside guardian auto-review mode.

Verification

  • cargo test -p codex-core --lib mcp_tool_call
Comment thread codex-rs/core/src/mcp_tool_call.rs Outdated
@maja-openai maja-openai force-pushed the codex/auto-review-approve-bypasses-arc branch from 68c966f to 98778dd Compare April 29, 2026 23:19
@maja-openai maja-openai marked this pull request as ready for review April 30, 2026 01:26
@maja-openai maja-openai requested a review from a team as a code owner April 30, 2026 01:26
@maja-openai maja-openai changed the title Bypass ARC for always-allow MCP tools in auto-review Bypass review for always-allow MCP tools in auto-review Apr 30, 2026
Copy link
Copy Markdown
Contributor

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

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: 98778ddf41

ℹ️ 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 thread codex-rs/codex-mcp/src/mcp/mod.rs Outdated
if matches!(
approval_policy,
AskForApproval::OnRequest | AskForApproval::Granular(_)
) && context.approvals_reviewer == Some(ApprovalsReviewer::AutoReview)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmm do we need this line? && context.approvals_reviewer == Some(ApprovalsReviewer::AutoReview)

should approve in the tool context just mean approve whether it's a human or auto-reviewer? cc @mzeng-openai

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

oh, is it due to this behavior?

Preserved existing tests that verify ARC can still block always-allow MCP tools outside guardian auto-review mode.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That's my read as well. I'd get feedback from @fouad-openai and see if we can get rid of this as well as a follow up, but not blocking this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[codex] Yes, that guard is intentional for this PR scope. The requested behavior is to bypass ARC only for always-allow tools when approvals are routed to guardian auto-review; non-auto-review approval modes should preserve the existing ARC path so ARC can still block. I agree the broader policy could be revisited as a follow-up with @fouad-openai.

@maja-openai maja-openai force-pushed the codex/auto-review-approve-bypasses-arc branch from 706e57c to e568240 Compare April 30, 2026 21:59
@maja-openai maja-openai merged commit a5ebede into main Apr 30, 2026
25 checks passed
@maja-openai maja-openai deleted the codex/auto-review-approve-bypasses-arc branch April 30, 2026 23:44
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants