Skip to content

Add Smart Approvals guardian review across core, app-server, and TUI#13860

Merged
charley-oai merged 144 commits intomainfrom
guardian-assessment-ui
Mar 13, 2026
Merged

Add Smart Approvals guardian review across core, app-server, and TUI#13860
charley-oai merged 144 commits intomainfrom
guardian-assessment-ui

Conversation

@charley-oai
Copy link
Copy Markdown
Contributor

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

Summary

  • add approvals_reviewer = "user" | "guardian_subagent" as the runtime control for who reviews approval requests
  • route Smart Approvals guardian review through core for command execution, file changes, managed-network approvals, MCP approvals, and delegated/subagent approval flows
  • expose guardian review in app-server with temporary unstable item/autoApprovalReview/{started,completed} notifications carrying targetItemId, review, and action
  • update the TUI so Smart Approvals can be enabled from /experimental, aligned with the matching /approvals mode, and surfaced clearly while reviews are pending or resolved

Runtime model

This PR does not introduce a new approval_policy.

Instead:

  • approval_policy still controls when approval is needed
  • approvals_reviewer controls who reviewable approval requests are routed to:
    • user
    • guardian_subagent

guardian_subagent is a carefully prompted reviewer subagent that gathers relevant context and applies a risk-based decision framework before approving or denying the request.

The smart_approvals feature flag is a rollout/UI gate. Core runtime behavior keys off approvals_reviewer.

When Smart Approvals is enabled from the TUI, it also switches the current /approvals settings to the matching Smart Approvals mode so users immediately see guardian review in the active thread:

  • approval_policy = on-request
  • approvals_reviewer = guardian_subagent
  • sandbox_mode = workspace-write

Users can still change /approvals afterward.

Config-load behavior stays intentionally narrow:

  • plain smart_approvals = true in config.toml remains just the rollout/UI gate and does not auto-set approvals_reviewer
  • the deprecated guardian_approval = true alias migration does backfill approvals_reviewer = "guardian_subagent" in the same scope when that reviewer is not already configured there, so old configs preserve their original guardian-enabled behavior

ARC remains a separate safety check. For MCP tool approvals, ARC escalations now flow into the configured reviewer instead of always bypassing guardian and forcing manual review.

Config stability

The runtime reviewer override is stable, but the config-backed app-server protocol shape is still settling.

  • thread/start, thread/resume, and turn/start keep stable approvalsReviewer overrides
  • the config-backed approvals_reviewer exposure returned via config/read (including profile-level config) is now marked [UNSTABLE] / experimental in the app-server protocol until we are more confident in that config surface

App-server surface

This PR intentionally keeps the guardian app-server shape narrow and temporary.

It adds generic unstable lifecycle notifications:

  • item/autoApprovalReview/started
  • item/autoApprovalReview/completed

with payloads of the form:

  • { threadId, turnId, targetItemId, review, action? }

review is currently:

  • { status, riskScore?, riskLevel?, rationale? }
  • where status is one of inProgress, approved, denied, or aborted

action carries the guardian action summary payload from core when available. This lets clients render temporary standalone pending-review UI, including parallel reviews, even when the underlying tool item has not been emitted yet.

These notifications are explicitly documented as [UNSTABLE] and expected to change soon.

This PR does not persist guardian review state onto thread/read tool items. The intended follow-up is to attach guardian review state to the reviewed tool item lifecycle instead, which would improve consistency with manual approvals and allow thread history / reconnect flows to replay guardian review state directly.

TUI behavior

  • /experimental exposes the rollout gate as Smart Approvals
  • enabling it in the TUI enables the feature and switches the current session to the matching Smart Approvals /approvals mode
  • disabling it in the TUI clears the persisted approvals_reviewer override when appropriate and returns the session to default manual review when the effective reviewer changes
  • /approvals still exposes the reviewer choice directly
  • the TUI renders:
    • pending guardian review state in the live status footer, including parallel review aggregation
    • resolved approval/denial state in history

Scope notes

This PR includes the supporting core/runtime work needed to make Smart Approvals usable end-to-end:

  • shell / unified-exec / apply_patch / managed-network / MCP guardian review
  • delegated/subagent approval routing into guardian review
  • guardian review risk metadata and action summaries for app-server/TUI
  • config/profile/TUI handling for smart_approvals, guardian_approval alias migration, and approvals_reviewer
  • a small internal cleanup of delegated approval forwarding to dedupe fallback paths and simplify guardian-vs-parent approval waiting (no intended behavior change)

Out of scope for this PR:

  • redesigning the existing manual approval protocol shapes
  • persisting guardian review state onto app-server ThreadItems
  • delegated MCP elicitation auto-review (the current delegated MCP guardian shim only covers the legacy RequestUserInput path)

codex resume 019ce3ee-69e2-7d62-bb67-0bc5792ebc31

@charley-oai
Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ 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 charley-oai force-pushed the guardian-assessment-ui branch from 27cccec to 79dbe1c Compare March 7, 2026 14:40
@charley-oai charley-oai changed the base branch from main to app-server-experimental-enum-variants March 7, 2026 14:41
@charley-oai charley-oai force-pushed the guardian-assessment-ui branch from 358819f to 47ca29b Compare March 7, 2026 19:47
@charley-oai
Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Nice work!

ℹ️ 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 charley-oai force-pushed the guardian-assessment-ui branch from 05060d9 to 04f5f35 Compare March 8, 2026 00:19
@charley-oai charley-oai marked this pull request as draft March 8, 2026 00:25
@charley-oai charley-oai force-pushed the app-server-experimental-enum-variants branch from 3f70d55 to f2629ed Compare March 8, 2026 03:57
@charley-oai charley-oai force-pushed the guardian-assessment-ui branch from 04f5f35 to cc0c948 Compare March 8, 2026 03:57
@charley-oai charley-oai force-pushed the app-server-experimental-enum-variants branch from ac3a101 to e426c16 Compare March 9, 2026 00:22
@charley-oai charley-oai force-pushed the guardian-assessment-ui branch from 37d856f to 14e462a Compare March 9, 2026 03:26
@charley-oai charley-oai marked this pull request as ready for review March 9, 2026 15:45
@charley-oai charley-oai force-pushed the guardian-assessment-ui branch from 14e462a to 5d63cd8 Compare March 9, 2026 15:47
@charley-oai charley-oai changed the base branch from app-server-experimental-enum-variants to main March 9, 2026 15:47
@charley-oai charley-oai force-pushed the guardian-assessment-ui branch from 05bc7dd to c7cc802 Compare March 9, 2026 15:56
@charley-oai
Copy link
Copy Markdown
Contributor Author

@codex review this

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: c7cc80234b

ℹ️ 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 charley-oai force-pushed the guardian-assessment-ui branch from c7cc802 to 550cdc6 Compare March 9, 2026 16:27
@charley-oai
Copy link
Copy Markdown
Contributor Author

@codex review this

@charley-oai charley-oai force-pushed the guardian-assessment-ui branch from aa95be6 to 1a90b01 Compare March 9, 2026 19:38
@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Hooray!

ℹ️ 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
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ 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 and others added 26 commits March 13, 2026 15:17
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>
Remove the legacy guardian background-event footer path and rely on typed in-progress guardian assessments for the live TUI status. This keeps the branch aligned with the latest unshipped design instead of carrying compatibility code for an intermediate PR state.

Co-authored-by: Codex <noreply@openai.com>
Backfill approvals_reviewer when migrating the deprecated guardian_approval feature alias so legacy configs preserve their original guardian-enabled behavior without changing plain smart_approvals startup semantics.

Co-authored-by: Codex <noreply@openai.com>
Mark the config-backed approvals reviewer field as unstable in the app-server protocol and regenerate the stable schema artifacts. Simplify delegate event forwarding and approval handling by deduplicating fallback paths and wrapping guardian versus parent approval waits.

Co-authored-by: Codex <noreply@openai.com>
Remove the short-lived guardian and parent approval await wrappers in codex_delegate and call await_approval_with_cancel directly at the use sites.

Co-authored-by: Codex <noreply@openai.com>
Add the missing approvals_reviewer field to the remaining OverrideTurnContext test initializers so codex-core test builds match the current Op shape.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@charley-oai charley-oai force-pushed the guardian-assessment-ui branch from e88d969 to 22eeedf Compare March 13, 2026 22:17
@charley-oai charley-oai merged commit bc24017 into main Mar 13, 2026
22 of 31 checks passed
@charley-oai charley-oai deleted the guardian-assessment-ui branch March 13, 2026 22:27
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants