Add system proxy feature config surface

This commit is contained in:
canvrno-oai
2026-06-10 11:04:30 -07:00
parent 2704ecea9a
commit c4fb0bb922
11 changed files with 295 additions and 0 deletions
+29
View File
@@ -77,6 +77,35 @@ pub(crate) struct RemovedAppsMcpPathOverrideConfigToml {
path: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct SystemProxyFeatureConfigToml {
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mode: Option<SystemProxyFeatureModeToml>,
}
impl FeatureConfig for SystemProxyFeatureConfigToml {
fn enabled(&self) -> Option<bool> {
self.enabled
}
fn set_enabled(&mut self, enabled: bool) {
self.enabled = Some(enabled);
}
}
#[derive(Serialize, Deserialize, Debug, Default, Clone, Copy, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum SystemProxyFeatureModeToml {
#[default]
Auto,
Env,
System,
Direct,
}
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct NetworkProxyConfigToml {
+19
View File
@@ -23,6 +23,8 @@ pub use feature_configs::NetworkProxyDomainPermissionToml;
pub use feature_configs::NetworkProxyModeToml;
pub use feature_configs::NetworkProxyUnixSocketPermissionToml;
use feature_configs::RemovedAppsMcpPathOverrideConfigToml;
pub use feature_configs::SystemProxyFeatureConfigToml;
pub use feature_configs::SystemProxyFeatureModeToml;
use legacy::LegacyFeatureToggles;
pub use legacy::legacy_feature_keys;
@@ -133,6 +135,8 @@ pub enum Feature {
EnableRequestCompression,
/// Start the managed network proxy for sandboxed sessions.
NetworkProxy,
/// Use host system proxy settings for auth and startup HTTP clients.
SystemProxy,
/// Enable collab tools.
Collab,
/// Enable task-path-based multi-agent routing.
@@ -608,6 +612,9 @@ pub struct FeaturesToml {
#[serde(default, rename = "apps_mcp_path_override", skip_serializing)]
#[schemars(skip)]
removed_apps_mcp_path_override: Option<FeatureToml<RemovedAppsMcpPathOverrideConfigToml>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub system_proxy: Option<FeatureToml<SystemProxyFeatureConfigToml>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub network_proxy: Option<FeatureToml<NetworkProxyConfigToml>>,
/// Boolean feature toggles keyed by canonical or legacy feature name.
#[serde(flatten)]
@@ -637,6 +644,9 @@ impl FeaturesToml {
if let Some(enabled) = self.multi_agent_v2.as_ref().and_then(FeatureToml::enabled) {
entries.insert(Feature::MultiAgentV2.key().to_string(), enabled);
}
if let Some(enabled) = self.system_proxy.as_ref().and_then(FeatureToml::enabled) {
entries.insert(Feature::SystemProxy.key().to_string(), enabled);
}
if let Some(enabled) = self.network_proxy.as_ref().and_then(FeatureToml::enabled) {
entries.insert(Feature::NetworkProxy.key().to_string(), enabled);
}
@@ -649,6 +659,7 @@ impl FeaturesToml {
code_mode,
multi_agent_v2,
removed_apps_mcp_path_override: _,
system_proxy,
network_proxy,
entries,
} = self;
@@ -661,6 +672,8 @@ impl FeaturesToml {
materialize_resolved_feature_enabled(code_mode, enabled);
} else if spec.id == Feature::MultiAgentV2 {
materialize_resolved_feature_enabled(multi_agent_v2, enabled);
} else if spec.id == Feature::SystemProxy {
materialize_resolved_feature_enabled(system_proxy, enabled);
} else if spec.id == Feature::NetworkProxy {
materialize_resolved_feature_enabled(network_proxy, enabled);
} else {
@@ -954,6 +967,12 @@ pub const FEATURES: &[FeatureSpec] = &[
},
default_enabled: false,
},
FeatureSpec {
id: Feature::SystemProxy,
key: "system_proxy",
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::Collab,
key: "multi_agent",
+19
View File
@@ -199,6 +199,13 @@ fn network_proxy_is_experimental_and_disabled_by_default() {
assert_eq!(Feature::NetworkProxy.default_enabled(), false);
}
#[test]
fn system_proxy_is_under_development_and_disabled_by_default() {
assert_eq!(feature_for_key("system_proxy"), Some(Feature::SystemProxy));
assert_eq!(Feature::SystemProxy.stage(), Stage::UnderDevelopment);
assert_eq!(Feature::SystemProxy.default_enabled(), false);
}
#[test]
fn tool_search_is_removed_and_disabled_by_default() {
assert_eq!(Feature::ToolSearch.stage(), Stage::Removed);
@@ -640,6 +647,7 @@ fn materialize_resolved_enabled_writes_all_features_and_preserves_custom_config(
features.enable(Feature::CodeMode);
features.enable(Feature::MultiAgentV2);
features.enable(Feature::NetworkProxy);
features.enable(Feature::SystemProxy);
let mut features_toml = FeaturesToml {
multi_agent_v2: Some(FeatureToml::Config(crate::MultiAgentV2ConfigToml {
@@ -652,6 +660,10 @@ fn materialize_resolved_enabled_writes_all_features_and_preserves_custom_config(
proxy_url: Some("http://127.0.0.1:43128".to_string()),
..Default::default()
})),
system_proxy: Some(FeatureToml::Config(crate::SystemProxyFeatureConfigToml {
enabled: Some(false),
mode: Some(crate::SystemProxyFeatureModeToml::System),
})),
entries: BTreeMap::new(),
..Default::default()
};
@@ -683,6 +695,13 @@ fn materialize_resolved_enabled_writes_all_features_and_preserves_custom_config(
..Default::default()
}))
);
assert_eq!(
features_toml.system_proxy,
Some(FeatureToml::Config(crate::SystemProxyFeatureConfigToml {
enabled: Some(true),
mode: Some(crate::SystemProxyFeatureModeToml::System),
}))
);
let replayed = Features::from_sources(
FeatureConfigSource {
features: Some(&features_toml),