core-agent-ide/codex-rs/app-server-protocol/schema/json
Charley Cunningham bc24017d64
Add Smart Approvals guardian review across core, app-server, and TUI (#13860)
## 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 `ThreadItem`s
- delegated MCP elicitation auto-review (the current delegated MCP
guardian shim only covers the legacy `RequestUserInput` path)

---------

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 15:27:00 -07:00
..
v1 app-server: Add platform os and family to init response (#14527) 2026-03-13 19:07:54 +00:00
v2 Add Smart Approvals guardian review across core, app-server, and TUI (#13860) 2026-03-13 15:27:00 -07:00
ApplyPatchApprovalParams.json chore: remove codex-core public protocol/shell re-exports (#12432) 2026-02-20 23:45:35 -08:00
ApplyPatchApprovalResponse.json feat: include available decisions in command approval requests (#12758) 2026-02-26 01:10:46 +00:00
ChatgptAuthTokensRefreshParams.json fix(app-server): for external auth, replace id_token with chatgpt_acc… (#11240) 2026-02-09 20:48:58 -08:00
ChatgptAuthTokensRefreshResponse.json fix(app-server): for external auth, replace id_token with chatgpt_acc… (#11240) 2026-02-09 20:48:58 -08:00
ClientNotification.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
ClientRequest.json Add Smart Approvals guardian review across core, app-server, and TUI (#13860) 2026-03-13 15:27:00 -07:00
codex_app_server_protocol.schemas.json Add Smart Approvals guardian review across core, app-server, and TUI (#13860) 2026-03-13 15:27:00 -07:00
codex_app_server_protocol.v2.schemas.json Add Smart Approvals guardian review across core, app-server, and TUI (#13860) 2026-03-13 15:27:00 -07:00
CommandExecutionRequestApprovalParams.json feat: Add additional macOS Sandbox Permissions for Launch Services, Contacts, Reminders (#14155) 2026-03-11 12:33:09 -07:00
CommandExecutionRequestApprovalResponse.json feat: include available decisions in command approval requests (#12758) 2026-02-26 01:10:46 +00:00
DynamicToolCallParams.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
DynamicToolCallResponse.json feat(app-server, core): allow text + image content items for dynamic tool outputs (#10567) 2026-02-04 16:12:47 -08:00
ExecCommandApprovalParams.json chore: remove codex-core public protocol/shell re-exports (#12432) 2026-02-20 23:45:35 -08:00
ExecCommandApprovalResponse.json feat: include available decisions in command approval requests (#12758) 2026-02-26 01:10:46 +00:00
FileChangeRequestApprovalParams.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
FileChangeRequestApprovalResponse.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
FuzzyFileSearchParams.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
FuzzyFileSearchResponse.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
FuzzyFileSearchSessionCompletedNotification.json [app-server] add fuzzyFileSearch/sessionCompleted (#11773) 2026-02-13 15:08:14 -08:00
FuzzyFileSearchSessionUpdatedNotification.json app-server: add fuzzy search sessions for streaming file search (#10268) 2026-02-12 10:49:44 -08:00
JSONRPCError.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
JSONRPCErrorError.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
JSONRPCMessage.json feat(app-server): add tracing to all app-server APIs (#13285) 2026-03-02 16:01:41 -08:00
JSONRPCNotification.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
JSONRPCRequest.json feat(app-server): add tracing to all app-server APIs (#13285) 2026-03-02 16:01:41 -08:00
JSONRPCResponse.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
McpServerElicitationRequestParams.json [elicitations] Switch to use MCP style elicitation payload for mcp tool approvals. (#13621) 2026-03-06 01:50:26 -08:00
McpServerElicitationRequestResponse.json [elicitations] Switch to use MCP style elicitation payload for mcp tool approvals. (#13621) 2026-03-06 01:50:26 -08:00
PermissionsRequestApprovalParams.json feat: Add additional macOS Sandbox Permissions for Launch Services, Contacts, Reminders (#14155) 2026-03-11 12:33:09 -07:00
PermissionsRequestApprovalResponse.json feat: Add additional macOS Sandbox Permissions for Launch Services, Contacts, Reminders (#14155) 2026-03-11 12:33:09 -07:00
RequestId.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
ServerNotification.json Add Smart Approvals guardian review across core, app-server, and TUI (#13860) 2026-03-13 15:27:00 -07:00
ServerRequest.json feat: Add additional macOS Sandbox Permissions for Launch Services, Contacts, Reminders (#14155) 2026-03-11 12:33:09 -07:00
ToolRequestUserInputParams.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
ToolRequestUserInputResponse.json feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00