Skip to content

Add guardian approval MVP#13692

Merged
charley-oai merged 96 commits intomainfrom
guardian-approval-mvp
Mar 7, 2026
Merged

Add guardian approval MVP#13692
charley-oai merged 96 commits intomainfrom
guardian-approval-mvp

Conversation

@charley-oai
Copy link
Collaborator

@charley-oai charley-oai commented Mar 6, 2026

Summary

  • add the guardian reviewer flow for on-request approvals in command, patch, sandbox-retry, and managed-network approval paths
  • keep guardian behind features.guardian_approval instead of exposing a public approval_policy = guardian mode
  • route ordinary OnRequest approvals to the guardian subagent when the feature is enabled, without changing the public approval-mode surface

Public model

  • public approval modes stay unchanged
  • guardian is enabled via features.guardian_approval
  • when that feature is on, approval_policy = on-request keeps the same approval boundaries but sends those approval requests to the guardian reviewer instead of the user
  • /experimental only persists the feature flag; it does not rewrite approval_policy
  • CLI and app-server no longer expose a separate guardian approval mode in this PR

Guardian reviewer

  • the reviewer runs as a normal subagent and reuses the existing subagent/thread machinery
  • it is locked to a read-only sandbox and approval_policy = never
  • it does not inherit user/project exec-policy rules
  • it prefers gpt-5.4 when the current provider exposes it, otherwise falls back to the parent turn's active model
  • it fail-closes on timeout, startup failure, malformed output, or any other review error
  • it currently auto-approves only when risk_score < 80

Review context and policy

  • guardian mirrors OnRequest approval semantics rather than introducing a separate approval policy
  • explicit require_escalated requests follow the same approval surface as OnRequest; the difference is only who reviews them
  • managed-network allowlist misses that enter the approval flow are also reviewed by guardian
  • the review prompt includes bounded recent transcript history plus recent tool call/result evidence
  • transcript entries and planned-action strings are truncated with explicit <guardian_truncated ... /> markers so large payloads stay bounded
  • apply-patch reviews include the full patch content (without duplicating the structured changes payload)
  • the guardian request layout is snapshot-tested using the same model-visible Responses request formatter used elsewhere in core

Guardian network behavior

  • the guardian subagent inherits the parent session's managed-network allowlist when one exists, so it can use the same approved network surface while reviewing
  • exact session-scoped network approvals are copied into the guardian session with protocol/port scope preserved
  • those copied approvals are now seeded before the guardian's first turn is submitted, so inherited approvals are available during any immediate review-time checks

Out of scope / follow-ups

  • the sandbox-permission validation split was pulled into a separate PR and is not part of this diff
  • a future follow-up can enable serde_json preserve-order in codex-core and then simplify the guardian action rendering further

@charley-oai
Copy link
Collaborator Author

@codex review this

charley-oai added a commit that referenced this pull request Mar 6, 2026
Co-authored-by: Codex <noreply@openai.com>
Copy link
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: e4d044c3cf

ℹ️ 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".

charley-oai added a commit that referenced this pull request Mar 6, 2026
Co-authored-by: Codex <noreply@openai.com>
@charley-oai charley-oai force-pushed the guardian-approval-mvp branch from 6ca9bfc to 09f53a1 Compare March 6, 2026 07:44
@charley-oai
Copy link
Collaborator Author

Rebased this branch on top of #13703. That precursor PR isolates the helper semantics so the guardian-specific behavior change can be reviewed separately.

@charley-oai
Copy link
Collaborator Author

Rebased this branch on top of #13703. That precursor PR isolates the SandboxPermissions helper semantics so the guardian-specific behavior change can be reviewed separately.

charley-oai added a commit that referenced this pull request Mar 6, 2026
Co-authored-by: Codex <noreply@openai.com>
@charley-oai charley-oai force-pushed the guardian-approval-mvp branch from ce8dbdd to 4bb939f Compare March 6, 2026 08:32
@charley-oai charley-oai changed the base branch from main to clarify-sandbox-permission-semantics March 6, 2026 09:16
Base automatically changed from clarify-sandbox-permission-semantics to main March 6, 2026 17:57
charley-oai added a commit that referenced this pull request Mar 6, 2026
Co-authored-by: Codex <noreply@openai.com>
@charley-oai charley-oai force-pushed the guardian-approval-mvp branch from dc00757 to d70e046 Compare March 6, 2026 18:03
charley-oai added a commit that referenced this pull request Mar 6, 2026
Co-authored-by: Codex <noreply@openai.com>
@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 1904fe78ec

ℹ️ 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".

charley-oai added a commit that referenced this pull request Mar 6, 2026
Co-authored-by: Codex <noreply@openai.com>
charley-oai added a commit that referenced this pull request Mar 6, 2026
Co-authored-by: Codex <noreply@openai.com>
@charley-oai charley-oai force-pushed the guardian-approval-mvp branch from 2f6c83d to 282a21a Compare March 6, 2026 21:11
@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 5846ca060f

ℹ️ 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".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 7fdebc4f49

ℹ️ 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".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: fd70f82592

ℹ️ 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".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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

matches!(approval_policy, AskForApproval::OnRequest)
&& network_approval_context.is_some()

P1 Badge Allow guardian network retries after sandbox denial

allow_on_request_network_prompt only checks AskForApproval::OnRequest. In guardian mode, a sandbox-denied command with network_policy_decision is returned immediately instead of entering the approval/retry flow, so the guardian never reviews managed-network escalation. This breaks the stated "guardian mirrors OnRequest" behavior for blocked network access.

ℹ️ 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".

Copy link
Collaborator

@dylan-hurd-oai dylan-hurd-oai left a comment

Choose a reason for hiding this comment

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

Some non-blocking comments - overall this feels pretty reasonable. Excited to try it out!

charley-oai and others added 20 commits March 7, 2026 05:15
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@charley-oai charley-oai force-pushed the guardian-approval-mvp branch from b33441a to 125a5ea Compare March 7, 2026 13:16
@charley-oai
Copy link
Collaborator Author

@codex review this

@charley-oai charley-oai enabled auto-merge (squash) March 7, 2026 13:19
@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 125a5ea57c

ℹ️ 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".

Co-authored-by: Codex <noreply@openai.com>
@charley-oai charley-oai disabled auto-merge March 7, 2026 13:39
@charley-oai charley-oai merged commit e84ee33 into main Mar 7, 2026
21 of 30 checks passed
@charley-oai charley-oai deleted the guardian-approval-mvp branch March 7, 2026 13:40
@github-actions github-actions bot locked and limited conversation to collaborators Mar 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants