mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
permissions: expose reviewer override grant API
This commit is contained in:
+20
@@ -58,6 +58,15 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ApprovalsReviewer": {
|
||||
"description": "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.",
|
||||
"enum": [
|
||||
"user",
|
||||
"auto_review",
|
||||
"guardian_subagent"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"FileSystemAccessMode": {
|
||||
"enum": [
|
||||
"read",
|
||||
@@ -288,6 +297,17 @@
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"approvalsReviewer": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ApprovalsReviewer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Override who reviews later approval prompts for the rest of the current turn."
|
||||
},
|
||||
"permissions": {
|
||||
"$ref": "#/definitions/GrantedPermissionProfile"
|
||||
},
|
||||
|
||||
+11
@@ -3875,6 +3875,17 @@
|
||||
"PermissionsRequestApprovalResponse": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"approvalsReviewer": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ApprovalsReviewer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Override who reviews later approval prompts for the rest of the current turn."
|
||||
},
|
||||
"permissions": {
|
||||
"$ref": "#/definitions/GrantedPermissionProfile"
|
||||
},
|
||||
|
||||
+6
-1
@@ -1,6 +1,7 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ApprovalsReviewer } from "./ApprovalsReviewer";
|
||||
import type { GrantedPermissionProfile } from "./GrantedPermissionProfile";
|
||||
import type { PermissionGrantScope } from "./PermissionGrantScope";
|
||||
|
||||
@@ -8,4 +9,8 @@ export type PermissionsRequestApprovalResponse = { permissions: GrantedPermissio
|
||||
/**
|
||||
* Review every subsequent command in this turn before normal sandboxed execution.
|
||||
*/
|
||||
strictAutoReview?: boolean, };
|
||||
strictAutoReview?: boolean,
|
||||
/**
|
||||
* Override who reviews later approval prompts for the rest of the current turn.
|
||||
*/
|
||||
approvalsReviewer?: ApprovalsReviewer, };
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use super::shared::ApprovalsReviewer;
|
||||
use super::shared::v2_enum_from_core;
|
||||
use codex_protocol::approvals::ExecPolicyAmendment as CoreExecPolicyAmendment;
|
||||
use codex_protocol::approvals::NetworkApprovalContext as CoreNetworkApprovalContext;
|
||||
@@ -693,4 +694,8 @@ pub struct PermissionsRequestApprovalResponse {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub strict_auto_review: Option<bool>,
|
||||
/// Override who reviews later approval prompts for the rest of the current turn.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub approvals_reviewer: Option<ApprovalsReviewer>,
|
||||
}
|
||||
|
||||
@@ -708,6 +708,7 @@ fn permissions_request_approval_response_defaults_scope_to_turn() {
|
||||
|
||||
assert_eq!(response.scope, PermissionGrantScope::Turn);
|
||||
assert_eq!(response.strict_auto_review, None);
|
||||
assert_eq!(response.approvals_reviewer, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -721,6 +722,20 @@ fn permissions_request_approval_response_accepts_strict_auto_review() {
|
||||
assert_eq!(response.strict_auto_review, Some(true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn permissions_request_approval_response_accepts_approvals_reviewer() {
|
||||
let response = serde_json::from_value::<PermissionsRequestApprovalResponse>(json!({
|
||||
"permissions": {},
|
||||
"approvalsReviewer": "auto_review",
|
||||
}))
|
||||
.expect("response should deserialize");
|
||||
|
||||
assert_eq!(
|
||||
response.approvals_reviewer,
|
||||
Some(ApprovalsReviewer::AutoReview)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn permission_profile_selection_uses_id_string() {
|
||||
let start: ThreadStartParams = serde_json::from_value(json!({
|
||||
|
||||
Reference in New Issue
Block a user