Skip to content

Commit 1cfc611

Browse files
committed
Register browser requirements features
1 parent 34800d7 commit 1cfc611

3 files changed

Lines changed: 60 additions & 0 deletions

File tree

codex-rs/core/src/config/config_tests.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6340,6 +6340,32 @@ async fn feature_requirements_normalize_effective_feature_values() -> std::io::R
63406340
Ok(())
63416341
}
63426342

6343+
#[tokio::test]
6344+
async fn browser_feature_requirements_are_valid() -> std::io::Result<()> {
6345+
let codex_home = TempDir::new()?;
6346+
6347+
let config = ConfigBuilder::without_managed_config_for_tests()
6348+
.codex_home(codex_home.path().to_path_buf())
6349+
.cloud_requirements(CloudRequirementsLoader::new(async {
6350+
Ok(Some(crate::config_loader::ConfigRequirementsToml {
6351+
feature_requirements: Some(crate::config_loader::FeatureRequirementsToml {
6352+
entries: BTreeMap::from([
6353+
("in_app_browser".to_string(), false),
6354+
("browser_use".to_string(), false),
6355+
]),
6356+
}),
6357+
..Default::default()
6358+
}))
6359+
}))
6360+
.build()
6361+
.await?;
6362+
6363+
assert!(!config.features.enabled(Feature::InAppBrowser));
6364+
assert!(!config.features.enabled(Feature::BrowserUse));
6365+
6366+
Ok(())
6367+
}
6368+
63436369
#[tokio::test]
63446370
async fn explicit_feature_config_is_normalized_by_requirements() -> std::io::Result<()> {
63456371
let codex_home = TempDir::new()?;

codex-rs/features/src/lib.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ pub enum Feature {
156156
ToolSuggest,
157157
/// Enable plugins.
158158
Plugins,
159+
/// Allow the in-app browser pane in desktop apps.
160+
///
161+
/// Requirements-only gate: this should be set from requirements, not user config.
162+
InAppBrowser,
163+
/// Allow Browser Use agent integration in desktop apps.
164+
///
165+
/// Requirements-only gate: this should be set from requirements, not user config.
166+
BrowserUse,
159167
/// Temporary internal-only flag for PS-backed remote plugin catalog development.
160168
RemotePlugin,
161169
/// Show the startup prompt for migrating external agent config into Codex.
@@ -848,6 +856,18 @@ pub const FEATURES: &[FeatureSpec] = &[
848856
stage: Stage::Stable,
849857
default_enabled: true,
850858
},
859+
FeatureSpec {
860+
id: Feature::InAppBrowser,
861+
key: "in_app_browser",
862+
stage: Stage::Stable,
863+
default_enabled: true,
864+
},
865+
FeatureSpec {
866+
id: Feature::BrowserUse,
867+
key: "browser_use",
868+
stage: Stage::Stable,
869+
default_enabled: true,
870+
},
851871
FeatureSpec {
852872
id: Feature::RemotePlugin,
853873
key: "remote_plugin",

codex-rs/features/src/tests.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,20 @@ fn tool_search_is_stable_and_enabled_by_default() {
150150
assert_eq!(Feature::ToolSearch.default_enabled(), true);
151151
}
152152

153+
#[test]
154+
fn browser_controls_are_stable_and_enabled_by_default() {
155+
assert_eq!(Feature::InAppBrowser.stage(), Stage::Stable);
156+
assert_eq!(Feature::InAppBrowser.default_enabled(), true);
157+
assert_eq!(
158+
feature_for_key("in_app_browser"),
159+
Some(Feature::InAppBrowser)
160+
);
161+
162+
assert_eq!(Feature::BrowserUse.stage(), Stage::Stable);
163+
assert_eq!(Feature::BrowserUse.default_enabled(), true);
164+
assert_eq!(feature_for_key("browser_use"), Some(Feature::BrowserUse));
165+
}
166+
153167
#[test]
154168
fn unavailable_dummy_tools_is_under_development_and_disabled_by_default() {
155169
assert_eq!(

0 commit comments

Comments
 (0)