mirror of
https://github.com/openai/codex.git
synced 2026-11-30 00:10:49 +00:00
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
This commit is contained in:
@@ -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::<ConfigRequirementsReadResponse>(&mut mcp, request_id).await?;
|
||||
let request_id = mcp
|
||||
.send_experimental_feature_list_request(ExperimentalFeatureListParams::default())
|
||||
.await?;
|
||||
let features = read_response::<ExperimentalFeatureListResponse>(&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;
|
||||
|
||||
@@ -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::<Vec<_>>(),
|
||||
["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::<Vec<_>>().join(" "),
|
||||
@"in_app_voice stable false"
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(codex_home.path().join("config.toml"))?,
|
||||
user_config
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user