From 6996cde697b228fbf5695ce855b2498c5c668795 Mon Sep 17 00:00:00 2001 From: vishnu-oai Date: Wed, 30 Sep 2026 17:00:32 +0000 Subject: [PATCH] Add a managed feature gate for in-app voice (#49683) ## What changed Register `in_app_voice` as a stable, default-enabled feature and add it to the configuration schema. The gate is intended for managed requirements to control permission for voice in desktop apps; permission does not establish voice availability or provider support. ## Testing Add app-server coverage for reporting `in_app_voice = false` from `requirements.toml` in both requirements and feature-list responses. Extend the CLI feature-list test to verify that cloud-managed requirements disable the gate despite a user-configured `true` value, without rewriting the user configuration. GitOrigin-RevId: 6ec3bc0176fdb3e1714b0136bf812bd56591f6a1 --- .../suite/v2/experimental_feature_list.rs | 47 +++++++++++++++++++ codex-rs/cli/tests/features.rs | 12 ++++- codex-rs/core/config.schema.json | 6 +++ codex-rs/features/src/lib.rs | 11 +++++ 4 files changed, 74 insertions(+), 2 deletions(-) diff --git a/codex-rs/app-server/tests/suite/v2/experimental_feature_list.rs b/codex-rs/app-server/tests/suite/v2/experimental_feature_list.rs index 9399a885bf..14f6122fde 100644 --- a/codex-rs/app-server/tests/suite/v2/experimental_feature_list.rs +++ b/codex-rs/app-server/tests/suite/v2/experimental_feature_list.rs @@ -6,6 +6,7 @@ use app_test_support::TestAppServer; use app_test_support::create_mock_responses_server_repeating_assistant; use codex_app_server_protocol::ConfigReadParams; use codex_app_server_protocol::ConfigReadResponse; +use codex_app_server_protocol::ConfigRequirementsReadResponse; use codex_app_server_protocol::ExperimentalFeature; use codex_app_server_protocol::ExperimentalFeatureEnablementSetParams; use codex_app_server_protocol::ExperimentalFeatureEnablementSetResponse; @@ -93,6 +94,52 @@ async fn experimental_feature_list_returns_feature_metadata_with_stage() -> Resu Ok(()) } +#[tokio::test] +async fn experimental_feature_list_reports_managed_in_app_voice() -> Result<()> { + let codex_home = TempDir::new()?; + std::fs::write( + codex_home.path().join("requirements.toml"), + "[features]\nin_app_voice = false\n", + )?; + let mut mcp = TestAppServer::builder() + .with_codex_home(codex_home.path()) + .build_initialized_with_timeout(DEFAULT_TIMEOUT) + .await?; + + let request_id = mcp.send_config_requirements_read_request().await?; + let requirements = + read_response::(&mut mcp, request_id).await?; + let request_id = mcp + .send_experimental_feature_list_request(ExperimentalFeatureListParams::default()) + .await?; + let features = read_response::(&mut mcp, request_id).await?; + + assert_eq!( + ( + requirements + .requirements + .and_then(|requirements| requirements.feature_requirements), + features + .data + .into_iter() + .find(|feature| feature.name == "in_app_voice"), + ), + ( + Some(BTreeMap::from([("in_app_voice".to_string(), false)])), + Some(ExperimentalFeature { + name: "in_app_voice".to_string(), + stage: ExperimentalFeatureStage::Stable, + display_name: None, + description: None, + announcement: None, + enabled: false, + default_enabled: true, + }), + ), + ); + Ok(()) +} + #[tokio::test] async fn experimental_feature_list_resolves_thread_project_config() -> Result<()> { let server = create_mock_responses_server_repeating_assistant("Done").await; diff --git a/codex-rs/cli/tests/features.rs b/codex-rs/cli/tests/features.rs index d55a3f4e77..b4e00afe96 100644 --- a/codex-rs/cli/tests/features.rs +++ b/codex-rs/cli/tests/features.rs @@ -218,7 +218,7 @@ async fn features_list_honors_cloud_managed_feature_requirements() -> Result<()> let chatgpt_base_url = format!("{}/backend-api", server.uri()); let codex_home = TempDir::new()?; let user_config = format!( - "cli_auth_credentials_store = \"file\"\nchatgpt_base_url = \"{chatgpt_base_url}\"\n\n[features]\nfast_mode = true\n" + "cli_auth_credentials_store = \"file\"\nchatgpt_base_url = \"{chatgpt_base_url}\"\n\n[features]\nfast_mode = true\nin_app_voice = true\n" ); std::fs::write(codex_home.path().join("config.toml"), &user_config)?; @@ -258,7 +258,7 @@ async fn features_list_honors_cloud_managed_feature_requirements() -> Result<()> "enterprise_managed": [{ "id": "managed-feature-requirements", "name": "Managed feature requirements", - "contents": "[features]\nfast_mode = false\n", + "contents": "[features]\nfast_mode = false\nin_app_voice = false\n", }], }, }))) @@ -290,6 +290,14 @@ async fn features_list_honors_cloud_managed_feature_requirements() -> Result<()> fast_mode.split_whitespace().collect::>(), ["fast_mode", "stable", "false"] ); + let in_app_voice = stdout + .lines() + .find(|line| line.starts_with("in_app_voice ")) + .context("feature list should include in_app_voice")?; + insta::assert_snapshot!( + in_app_voice.split_whitespace().collect::>().join(" "), + @"in_app_voice stable false" + ); assert_eq!( std::fs::read_to_string(codex_home.path().join("config.toml"))?, user_config diff --git a/codex-rs/core/config.schema.json b/codex-rs/core/config.schema.json index 43a322feac..7d0898ee2e 100644 --- a/codex-rs/core/config.schema.json +++ b/codex-rs/core/config.schema.json @@ -939,6 +939,9 @@ "in_app_updates": { "type": "boolean" }, + "in_app_voice": { + "type": "boolean" + }, "instant_interrupt": { "type": "boolean" }, @@ -6982,6 +6985,9 @@ "in_app_updates": { "type": "boolean" }, + "in_app_voice": { + "type": "boolean" + }, "instant_interrupt": { "type": "boolean" }, diff --git a/codex-rs/features/src/lib.rs b/codex-rs/features/src/lib.rs index a42a4b5db2..970c37bd9c 100644 --- a/codex-rs/features/src/lib.rs +++ b/codex-rs/features/src/lib.rs @@ -272,6 +272,11 @@ pub enum Feature { /// /// Requirements-only gate: this should be set from requirements, not user config. InAppDictation, + /// Allow in-app Voice in desktop apps. + /// + /// Requirements-only gate: this should be set from requirements, not user config. + /// Permission does not establish Voice availability or provider support. + InAppVoice, /// Allow desktop apps to run local automations. /// /// Requirements-only gate: this should be set from requirements, not user config. @@ -1524,6 +1529,12 @@ pub const FEATURES: &[FeatureSpec] = &[ stage: Stage::Stable, default_enabled: true, }, + FeatureSpec { + id: Feature::InAppVoice, + key: "in_app_voice", + stage: Stage::Stable, + default_enabled: true, + }, FeatureSpec { id: Feature::InAppLocalAutomation, key: "in_app_local_automation",