From c098f97e5305394c7f30a876c1393cf34a3eedca Mon Sep 17 00:00:00 2001 From: jif Date: Thu, 24 Sep 2026 09:43:24 +0000 Subject: [PATCH] Enable terminal input approval by default (#47799) ## What changed Promote `write_stdin_approval` to stable and enable it by default. ## Testing Update the stdin approval suite to rely on the default feature setting. Adjust the background network approval test to account for terminal input review before network access and explicitly wait for the network assessment. GitOrigin-RevId: 1bb449f6d9ecf4ee451e84f95f839a6744877e8b --- codex-rs/core/tests/suite/network_approval.rs | 15 +++++++++++++-- .../tests/suite/unified_exec_stdin_approval.rs | 1 - codex-rs/features/src/lib.rs | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/codex-rs/core/tests/suite/network_approval.rs b/codex-rs/core/tests/suite/network_approval.rs index 13a5dd8cbc..28d3dc1ab2 100644 --- a/codex-rs/core/tests/suite/network_approval.rs +++ b/codex-rs/core/tests/suite/network_approval.rs @@ -19,6 +19,7 @@ use codex_history::RolloutItem; use codex_network_proxy::NetworkProxyConfig; use codex_network_proxy::PROXY_ACTIVE_ENV_KEY; use codex_protocol::approvals::ExecApprovalKind; +use codex_protocol::approvals::GuardianAssessmentAction; use codex_protocol::approvals::NetworkApprovalContext; use codex_protocol::approvals::NetworkApprovalProtocol; use codex_protocol::approvals::NetworkPolicyAmendment; @@ -790,6 +791,15 @@ async fn background_network_approval_uses_current_review_settings_and_original_e ), ev_completed("resp-cross-turn-network-stdin"), ]), + // Strict review approves terminal input before the process can request network access. + sse(vec![ + ev_response_created("resp-cross-turn-stdin-guardian"), + ev_assistant_message( + "msg-cross-turn-stdin-guardian", + r#"{"risk_level":"low","user_authorization":"high","outcome":"allow","rationale":"Continue the existing terminal."}"#, + ), + ev_completed("resp-cross-turn-stdin-guardian"), + ]), sse(vec![ ev_response_created("resp-network-guardian-environment"), ev_function_call( @@ -920,6 +930,7 @@ async fn background_network_approval_uses_current_review_settings_and_original_e event, EventMsg::GuardianAssessment(assessment) if assessment.status == GuardianAssessmentStatus::Approved + && matches!(assessment.action, GuardianAssessmentAction::NetworkAccess { .. }) ) || matches!( event, EventMsg::ExecApprovalRequest(_) | EventMsg::TurnComplete(_) @@ -954,7 +965,7 @@ async fn background_network_approval_uses_current_review_settings_and_original_e .iter() .filter(|request| request.body_json()["client_metadata"]["x-openai-subagent"] == "guardian") .collect::>(); - assert_eq!(reviews.len(), 2); + assert_eq!(reviews.len(), 3); for review in &reviews { assert_eq!(review.body_json()["model"], "guardian-parent-b"); assert_eq!(review.body_json()["reasoning"]["effort"], "medium"); @@ -975,7 +986,7 @@ async fn background_network_approval_uses_current_review_settings_and_original_e )?; // Strict review does not change this field's policy-routing meaning. assert_eq!(metadata["auto_review_enabled"], false); - let pwd_output = reviews[1] + let pwd_output = reviews[2] .function_call_output_text("guardian-pwd") .context("Guardian pwd output")?; let original_cwd = test diff --git a/codex-rs/core/tests/suite/unified_exec_stdin_approval.rs b/codex-rs/core/tests/suite/unified_exec_stdin_approval.rs index d602b03a49..a8e769e1fd 100644 --- a/codex-rs/core/tests/suite/unified_exec_stdin_approval.rs +++ b/codex-rs/core/tests/suite/unified_exec_stdin_approval.rs @@ -49,7 +49,6 @@ fn tool_response(id: &str, tool: &str, args: Value) -> String { async fn harness(builder: TestCodexBuilder) -> Result { TestCodexHarness::with_auto_env_builder(builder.with_config(|config| { for feature in [ - Feature::WriteStdinApproval, Feature::ExecPermissionApprovals, Feature::RequestPermissionsTool, ] { diff --git a/codex-rs/features/src/lib.rs b/codex-rs/features/src/lib.rs index 029a7700ca..c27189e043 100644 --- a/codex-rs/features/src/lib.rs +++ b/codex-rs/features/src/lib.rs @@ -1196,8 +1196,8 @@ pub const FEATURES: &[FeatureSpec] = &[ FeatureSpec { id: Feature::WriteStdinApproval, key: "write_stdin_approval", - stage: Stage::UnderDevelopment, - default_enabled: false, + stage: Stage::Stable, + default_enabled: true, }, FeatureSpec { id: Feature::CodexHooks,