mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
Add managed command checkpoints requiring fresh human approval (#58045)
## Why Managed command policies need to require a human decision independently of automatic review, hook allowances, and saved approvals. ## What changed - Support `decision = "prompt-user"` in managed `requirements.toml` prefix rules, requiring a fresh, one-time human decision for matching commands. - Add experimental `humanCommand` approval requests for clients advertising both `experimentalApi` and `requiredHumanApproval`. Accept only `accept`, `decline`, or `cancel`; reject commands when no capable client is available. - Restrict responses to capable clients that received the request, and replay pending prompts to compatible clients on reconnect. - Enable the capability in the TUI and update protocol schemas and client bindings. ## Testing Add coverage for fresh decisions overriding saved allowances, hook allowances, and automatic review, plus child-thread approval routing and rejection of responses from incompatible or unrelated clients. GitOrigin-RevId: 0b95ff6aab7f8a04b7298c8a4329d1fddf6a603e
This commit is contained in:
@@ -1743,7 +1743,8 @@ impl AnalyticsReducer {
|
||||
ServerRequest::CommandExecutionRequestApproval { request_id, params } => {
|
||||
let is_stdin_review = match params.kind {
|
||||
CommandExecutionApprovalKind::WriteStdin => true,
|
||||
CommandExecutionApprovalKind::Command => false,
|
||||
CommandExecutionApprovalKind::Command
|
||||
| CommandExecutionApprovalKind::HumanCommand => false,
|
||||
};
|
||||
let is_network_access_review = params.network_approval_context.is_some();
|
||||
let requested_network_access = is_network_access_review
|
||||
@@ -1760,7 +1761,9 @@ impl AnalyticsReducer {
|
||||
let requested_additional_permissions = params.additional_permissions.is_some();
|
||||
let trigger = if is_stdin_review {
|
||||
ReviewTrigger::Initial
|
||||
} else if params.approval_id.is_some() {
|
||||
} else if params.kind != CommandExecutionApprovalKind::HumanCommand
|
||||
&& params.approval_id.is_some()
|
||||
{
|
||||
ReviewTrigger::ExecveIntercept
|
||||
} else if requested_network_access {
|
||||
ReviewTrigger::NetworkPolicyDenial
|
||||
|
||||
@@ -258,6 +258,7 @@ async fn guardian_review_event_ingests_custom_fact_with_optional_target_item() {
|
||||
version: "1.0.0".to_string(),
|
||||
},
|
||||
capabilities: Some(InitializeCapabilities {
|
||||
required_human_approval: false,
|
||||
explicit_gateway_oauth: false,
|
||||
experimental_api: false,
|
||||
request_attestation: false,
|
||||
|
||||
@@ -217,6 +217,7 @@ async fn initialize_caches_client_and_thread_lifecycle_publishes_once_initialize
|
||||
version: "1.0.0".to_string(),
|
||||
},
|
||||
capabilities: Some(InitializeCapabilities {
|
||||
required_human_approval: false,
|
||||
explicit_gateway_oauth: false,
|
||||
experimental_api: false,
|
||||
request_attestation: false,
|
||||
|
||||
@@ -145,6 +145,7 @@ async fn compaction_events_keep_authoritative_voice_session_across_consecutive_c
|
||||
version: "1.0.0".to_string(),
|
||||
},
|
||||
capabilities: Some(InitializeCapabilities {
|
||||
required_human_approval: false,
|
||||
explicit_gateway_oauth: false,
|
||||
experimental_api: false,
|
||||
request_attestation: false,
|
||||
|
||||
@@ -592,6 +592,7 @@ pub(super) fn sample_initialize_fact(connection_id: u64) -> AnalyticsFact {
|
||||
version: "1.0.0".to_string(),
|
||||
},
|
||||
capabilities: Some(InitializeCapabilities {
|
||||
required_human_approval: false,
|
||||
explicit_gateway_oauth: false,
|
||||
experimental_api: false,
|
||||
request_attestation: false,
|
||||
|
||||
Reference in New Issue
Block a user