mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
config: remove legacy enterprise bundle paths
This commit is contained in:
+1
-1
@@ -8140,7 +8140,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"description": "Enterprise-managed config layer delivered by the cloud config bundle.",
|
||||
"description": "Legacy cloud config source retained for v2 wire compatibility. New config stacks emit [`Self::CloudManaged`] instead.",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "Stable identifier for the delivered layer.",
|
||||
|
||||
+1
-1
@@ -4380,7 +4380,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"description": "Enterprise-managed config layer delivered by the cloud config bundle.",
|
||||
"description": "Legacy cloud config source retained for v2 wire compatibility. New config stacks emit [`Self::CloudManaged`] instead.",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "Stable identifier for the delivered layer.",
|
||||
|
||||
@@ -535,7 +535,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"description": "Enterprise-managed config layer delivered by the cloud config bundle.",
|
||||
"description": "Legacy cloud config source retained for v2 wire compatibility. New config stacks emit [`Self::CloudManaged`] instead.",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "Stable identifier for the delivered layer.",
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"description": "Enterprise-managed config layer delivered by the cloud config bundle.",
|
||||
"description": "Legacy cloud config source retained for v2 wire compatibility. New config stacks emit [`Self::CloudManaged`] instead.",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "Stable identifier for the delivered layer.",
|
||||
|
||||
@@ -61,7 +61,8 @@ pub enum ConfigLayerSource {
|
||||
file: AbsolutePathBuf,
|
||||
},
|
||||
|
||||
/// Enterprise-managed config layer delivered by the cloud config bundle.
|
||||
/// Legacy cloud config source retained for v2 wire compatibility. New
|
||||
/// config stacks emit [`Self::CloudManaged`] instead.
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase")]
|
||||
EnterpriseManaged {
|
||||
|
||||
@@ -255,7 +255,7 @@ Cloud-managed sources returned by `config/read` in `origins`, `layers`, or overr
|
||||
}
|
||||
```
|
||||
|
||||
`layer` is either `baseline` or `systemOverlay`. Legacy cloud fallback continues to use the `enterpriseManaged` source type.
|
||||
`layer` is either `baseline` or `systemOverlay`. The `enterpriseManaged` source type remains in the v2 schema for compatibility but is not emitted for new cloud config stacks.
|
||||
|
||||
### Example: Start or resume a thread
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use codex_app_server_protocol::CloudManagedLayer as ApiCloudManagedLayer;
|
||||
use codex_app_server_protocol::ConfigLayer as ApiConfigLayer;
|
||||
use codex_app_server_protocol::ConfigLayerMetadata as ApiConfigLayerMetadata;
|
||||
use codex_app_server_protocol::ConfigLayerSource as ApiConfigLayerSource;
|
||||
use codex_app_server_protocol::CloudManagedLayer as ApiCloudManagedLayer;
|
||||
use codex_config::CloudManagedLayer;
|
||||
use codex_config::ConfigLayer;
|
||||
use codex_config::ConfigLayerMetadata;
|
||||
|
||||
@@ -4,14 +4,33 @@ use codex_app_server_protocol::AppConfig;
|
||||
use codex_app_server_protocol::AppToolApproval;
|
||||
use codex_app_server_protocol::AppsConfig;
|
||||
use codex_app_server_protocol::AskForApproval;
|
||||
use codex_app_server_protocol::CloudManagedLayer as ApiCloudManagedLayer;
|
||||
use codex_app_server_protocol::ConfigLayerSource as ApiConfigLayerSource;
|
||||
use codex_config::CloudConfigBundleLoader;
|
||||
use codex_config::CloudManagedLayer;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::LoaderOverrides;
|
||||
use codex_config::test_support::CloudConfigBundleFixture;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
fn cloud_managed_source_maps_to_app_server_api() {
|
||||
assert_eq!(
|
||||
crate::config_layer::config_layer_source_to_api(ConfigLayerSource::CloudManaged {
|
||||
layer: CloudManagedLayer::Baseline,
|
||||
id: "policy-1".to_string(),
|
||||
name: "Baseline policy".to_string(),
|
||||
}),
|
||||
ApiConfigLayerSource::CloudManaged {
|
||||
layer: ApiCloudManagedLayer::Baseline,
|
||||
id: "policy-1".to_string(),
|
||||
name: "Baseline policy".to_string(),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn toml_value_to_item_handles_nested_config_tables() {
|
||||
let config = r#"
|
||||
@@ -708,7 +727,7 @@ async fn write_value_rejects_feature_requirement_conflict() {
|
||||
tmp.path().to_path_buf(),
|
||||
vec![],
|
||||
LoaderOverrides::without_managed_config_for_tests(),
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[features]
|
||||
personality = true
|
||||
|
||||
@@ -536,7 +536,10 @@ async fn get_bundle_skips_team_like_usage_based_plan() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn get_bundle_rejects_invalid_remote_buckets_before_cache_write() {
|
||||
for bundle in [invalid_config_bundle(), conflicting_managed_requirements_bundle()] {
|
||||
for bundle in [
|
||||
invalid_config_bundle(),
|
||||
conflicting_managed_requirements_bundle(),
|
||||
] {
|
||||
let codex_home = tempdir().expect("tempdir");
|
||||
let fetcher = Arc::new(StaticBundleClient::new(bundle));
|
||||
let service = CloudConfigBundleService::new(
|
||||
|
||||
@@ -23,7 +23,7 @@ use thiserror::Error;
|
||||
///
|
||||
/// The bundle orders fragments from highest precedence to lowest precedence.
|
||||
/// This module returns config layers in stack order, so callers can append the
|
||||
/// result between system and user config without re-sorting.
|
||||
/// result at the bucket's stack position without re-sorting.
|
||||
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||
pub struct CloudConfigFragment {
|
||||
pub id: String,
|
||||
@@ -66,30 +66,6 @@ pub enum CloudConfigLayerError {
|
||||
},
|
||||
}
|
||||
|
||||
pub fn cloud_config_layers_from_fragments(
|
||||
fragments: impl IntoIterator<Item = CloudConfigFragment>,
|
||||
base_dir: &AbsolutePathBuf,
|
||||
) -> Result<Vec<ConfigLayerEntry>, CloudConfigLayerError> {
|
||||
cloud_config_layers_from_fragments_impl(
|
||||
fragments,
|
||||
base_dir,
|
||||
|id, name| ConfigLayerSource::EnterpriseManaged { id, name },
|
||||
/*strict_config*/ false,
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn cloud_config_layers_from_fragments_strict(
|
||||
fragments: impl IntoIterator<Item = CloudConfigFragment>,
|
||||
base_dir: &AbsolutePathBuf,
|
||||
) -> Result<Vec<ConfigLayerEntry>, CloudConfigLayerError> {
|
||||
cloud_config_layers_from_fragments_impl(
|
||||
fragments,
|
||||
base_dir,
|
||||
|id, name| ConfigLayerSource::EnterpriseManaged { id, name },
|
||||
/*strict_config*/ true,
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn cloud_managed_config_layers_from_fragments(
|
||||
fragments: impl IntoIterator<Item = CloudConfigFragment>,
|
||||
base_dir: &AbsolutePathBuf,
|
||||
|
||||
@@ -31,12 +31,13 @@ fn base_dir() -> AbsolutePathBuf {
|
||||
#[test]
|
||||
fn layers_are_returned_in_stack_order() {
|
||||
let base_dir = base_dir();
|
||||
let layers = cloud_config_layers_from_fragments(
|
||||
let layers = cloud_managed_config_layers_from_fragments(
|
||||
vec![
|
||||
fragment("high", "High priority", "model = \"cloud-high\""),
|
||||
fragment("low", "Low priority", "model_provider = \"cloud-low\""),
|
||||
],
|
||||
&base_dir,
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
)
|
||||
.expect("cloud config layers should compose");
|
||||
|
||||
@@ -46,11 +47,13 @@ fn layers_are_returned_in_stack_order() {
|
||||
.map(|layer| layer.name.clone())
|
||||
.collect::<Vec<_>>(),
|
||||
vec![
|
||||
ConfigLayerSource::EnterpriseManaged {
|
||||
ConfigLayerSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "low".to_string(),
|
||||
name: "Low priority".to_string(),
|
||||
},
|
||||
ConfigLayerSource::EnterpriseManaged {
|
||||
ConfigLayerSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "high".to_string(),
|
||||
name: "High priority".to_string(),
|
||||
},
|
||||
@@ -61,9 +64,10 @@ fn layers_are_returned_in_stack_order() {
|
||||
#[test]
|
||||
fn strict_layers_reject_unknown_config_fields() {
|
||||
let base_dir = base_dir();
|
||||
let err = cloud_config_layers_from_fragments_strict(
|
||||
let err = cloud_managed_config_layers_from_fragments_strict(
|
||||
vec![fragment("strict", "Strict layer", "unknown_key = true")],
|
||||
&base_dir,
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
)
|
||||
.expect_err("strict config should reject unknown fields");
|
||||
|
||||
@@ -80,7 +84,7 @@ fn strict_layers_reject_unknown_config_fields() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enterprise_layers_precede_user_and_override_system() {
|
||||
fn system_overlay_layers_precede_user_and_override_system() {
|
||||
let base_dir = base_dir();
|
||||
let mut layers = vec![ConfigLayerEntry::new(
|
||||
ConfigLayerSource::System {
|
||||
@@ -95,12 +99,13 @@ review_model = "system-review"
|
||||
),
|
||||
)];
|
||||
layers.extend(
|
||||
cloud_config_layers_from_fragments(
|
||||
cloud_managed_config_layers_from_fragments(
|
||||
vec![
|
||||
fragment("high", "High priority", "model_provider = \"cloud-high\""),
|
||||
fragment("low", "Low priority", "review_model = \"cloud-low-review\""),
|
||||
],
|
||||
&base_dir,
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
)
|
||||
.expect("cloud config layers should compose"),
|
||||
);
|
||||
@@ -132,11 +137,13 @@ review_model = "system-review"
|
||||
ConfigLayerSource::System {
|
||||
file: test_path_buf("/etc/codex/config.toml").abs(),
|
||||
},
|
||||
ConfigLayerSource::EnterpriseManaged {
|
||||
ConfigLayerSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "low".to_string(),
|
||||
name: "Low priority".to_string(),
|
||||
},
|
||||
ConfigLayerSource::EnterpriseManaged {
|
||||
ConfigLayerSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "high".to_string(),
|
||||
name: "High priority".to_string(),
|
||||
},
|
||||
@@ -161,13 +168,14 @@ review_model = "cloud-low-review"
|
||||
#[test]
|
||||
fn relative_absolute_path_fields_resolve_against_base_dir() {
|
||||
let base_dir = base_dir();
|
||||
let layers = cloud_config_layers_from_fragments(
|
||||
let layers = cloud_managed_config_layers_from_fragments(
|
||||
vec![fragment(
|
||||
"cfg_123",
|
||||
"Base policy",
|
||||
"model_instructions_file = \"instructions.md\"",
|
||||
)],
|
||||
&base_dir,
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
)
|
||||
.expect("relative paths should match existing MDM semantics");
|
||||
|
||||
@@ -184,13 +192,14 @@ fn relative_absolute_path_fields_resolve_against_base_dir() {
|
||||
#[test]
|
||||
fn home_relative_path_fields_are_allowed_and_resolved() {
|
||||
let base_dir = base_dir();
|
||||
let layers = cloud_config_layers_from_fragments(
|
||||
let layers = cloud_managed_config_layers_from_fragments(
|
||||
vec![fragment(
|
||||
"cfg_123",
|
||||
"Base policy",
|
||||
"model_instructions_file = \"~/instructions.md\"",
|
||||
)],
|
||||
&base_dir,
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
)
|
||||
.expect("home-relative paths should be accepted");
|
||||
|
||||
@@ -205,15 +214,16 @@ fn home_relative_path_fields_are_allowed_and_resolved() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn raw_toml_diagnostics_use_enterprise_layer_name() {
|
||||
async fn raw_toml_diagnostics_use_cloud_managed_layer_name() {
|
||||
let base_dir = base_dir();
|
||||
let layers = cloud_config_layers_from_fragments(
|
||||
let layers = cloud_managed_config_layers_from_fragments(
|
||||
vec![fragment(
|
||||
"cfg_123",
|
||||
"Base policy",
|
||||
"model_instructions_file = \"instructions.md\"\nmodel = 1",
|
||||
)],
|
||||
&base_dir,
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
)
|
||||
.expect("cloud config layers should parse");
|
||||
|
||||
@@ -223,7 +233,7 @@ async fn raw_toml_diagnostics_use_enterprise_layer_name() {
|
||||
|
||||
assert_eq!(
|
||||
error.path,
|
||||
Path::new("enterprise-managed (Base policy, cfg_123)").to_path_buf()
|
||||
Path::new("cloud-managed system-overlay (Base policy, cfg_123)").to_path_buf()
|
||||
);
|
||||
assert_eq!(error.range.start.line, 2);
|
||||
assert_eq!(error.range.start.column, 9);
|
||||
|
||||
@@ -36,12 +36,6 @@ pub enum RequirementSource {
|
||||
Composite {
|
||||
sources: Vec<RequirementSource>,
|
||||
},
|
||||
/// A backend-delivered enterprise-managed layer. `id` is the stable backend
|
||||
/// identifier; `name` is the admin-facing display name.
|
||||
EnterpriseManaged {
|
||||
id: String,
|
||||
name: String,
|
||||
},
|
||||
/// A fragment delivered through the generic cloud-managed layer contract.
|
||||
CloudManaged {
|
||||
layer: CloudManagedLayer,
|
||||
@@ -104,9 +98,6 @@ impl fmt::Display for RequirementSource {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
RequirementSource::EnterpriseManaged { id, name } => {
|
||||
write!(f, "enterprise-managed requirements {name} ({id})")
|
||||
}
|
||||
RequirementSource::CloudManaged { layer, id, name } => {
|
||||
write!(f, "cloud-managed {layer} requirements {name} ({id})")
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ pub use cloud_config_bundle::CloudRequirementsTomlManagedLayers;
|
||||
pub use cloud_config_layers::CloudConfigFragment;
|
||||
pub use cloud_config_layers::CloudConfigFragmentSource;
|
||||
pub use cloud_config_layers::CloudConfigLayerError;
|
||||
pub use cloud_config_layers::cloud_config_layers_from_fragments;
|
||||
pub use codex_protocol::config_types::ProfileV2Name;
|
||||
pub use codex_protocol::config_types::ProfileV2NameParseError;
|
||||
pub use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
|
||||
@@ -31,8 +31,9 @@ Precedence is **top overrides bottom**:
|
||||
4. `Project` config (`.codex/config.toml`)
|
||||
5. `User` profile config, when present
|
||||
6. `User` config (`config.toml`)
|
||||
7. `EnterpriseManaged` cloud-managed config bundle layers
|
||||
7. `CloudManaged(SystemOverlay)` config bundle layers
|
||||
8. `System` config (`/etc/codex/config.toml` or the Windows system config path)
|
||||
9. `CloudManaged(Baseline)` config bundle layers
|
||||
|
||||
`ConfigLayerStack` stores layers in the opposite order internally: lowest
|
||||
precedence first, highest precedence last, so later layers override earlier
|
||||
|
||||
@@ -4,6 +4,7 @@ use super::RequirementsCompositionError;
|
||||
use super::compose_requirements_for_hostname;
|
||||
use super::compose_requirements_for_hostname_and_hook_directory;
|
||||
use super::compose_requirements_with_hostname_resolver;
|
||||
use crate::CloudManagedLayer;
|
||||
use crate::ConfigRequirementsToml;
|
||||
use crate::ConfigRequirementsWithSources;
|
||||
use crate::RequirementSource;
|
||||
@@ -17,7 +18,8 @@ use tempfile::TempDir;
|
||||
|
||||
fn layer(id: &str, name: &str, contents: &str) -> RequirementsLayerEntry {
|
||||
RequirementsLayerEntry::from_toml(
|
||||
RequirementSource::EnterpriseManaged {
|
||||
RequirementSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: id.to_string(),
|
||||
name: name.to_string(),
|
||||
},
|
||||
@@ -219,7 +221,7 @@ deny_read = [{high_path:?}, {low_path:?}]
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn single_regular_layer_keeps_enterprise_managed_source() {
|
||||
fn single_regular_layer_keeps_cloud_managed_source() {
|
||||
let composed = compose_requirements_for_hostname(
|
||||
vec![layer(
|
||||
"req_1",
|
||||
@@ -237,7 +239,8 @@ allow_managed_hooks_only = true
|
||||
composed.allow_managed_hooks_only,
|
||||
Some(Sourced::new(
|
||||
/*value*/ true,
|
||||
RequirementSource::EnterpriseManaged {
|
||||
RequirementSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "req_1".to_string(),
|
||||
name: "Security baseline".to_string(),
|
||||
},
|
||||
@@ -309,11 +312,13 @@ approval_mode = "approve"
|
||||
|
||||
#[test]
|
||||
fn merged_table_source_is_composite_in_priority_order() {
|
||||
let high_source = RequirementSource::EnterpriseManaged {
|
||||
let high_source = RequirementSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "req_high".to_string(),
|
||||
name: "High".to_string(),
|
||||
};
|
||||
let low_source = RequirementSource::EnterpriseManaged {
|
||||
let low_source = RequirementSource::CloudManaged {
|
||||
layer: CloudManagedLayer::Baseline,
|
||||
id: "req_low".to_string(),
|
||||
name: "Low".to_string(),
|
||||
};
|
||||
|
||||
@@ -14,25 +14,27 @@ pub struct CloudConfigBundleFixture {
|
||||
}
|
||||
|
||||
impl CloudConfigBundleFixture {
|
||||
pub fn enterprise_requirement(contents: impl Into<String>) -> Self {
|
||||
Self::default().add_enterprise_requirement(contents)
|
||||
pub fn system_overlay_requirement(contents: impl Into<String>) -> Self {
|
||||
Self::default().add_system_overlay_requirement(contents)
|
||||
}
|
||||
|
||||
pub fn enterprise_config(contents: impl Into<String>) -> Self {
|
||||
Self::default().add_enterprise_config(contents)
|
||||
pub fn system_overlay_config(contents: impl Into<String>) -> Self {
|
||||
Self::default().add_system_overlay_config(contents)
|
||||
}
|
||||
|
||||
pub fn loader_with_enterprise_requirement(
|
||||
pub fn loader_with_system_overlay_requirement(
|
||||
contents: impl Into<String>,
|
||||
) -> CloudConfigBundleLoader {
|
||||
Self::enterprise_requirement(contents).into_loader()
|
||||
Self::system_overlay_requirement(contents).into_loader()
|
||||
}
|
||||
|
||||
pub fn loader_with_enterprise_config(contents: impl Into<String>) -> CloudConfigBundleLoader {
|
||||
Self::enterprise_config(contents).into_loader()
|
||||
pub fn loader_with_system_overlay_config(
|
||||
contents: impl Into<String>,
|
||||
) -> CloudConfigBundleLoader {
|
||||
Self::system_overlay_config(contents).into_loader()
|
||||
}
|
||||
|
||||
pub fn add_enterprise_requirement(mut self, contents: impl Into<String>) -> Self {
|
||||
pub fn add_system_overlay_requirement(mut self, contents: impl Into<String>) -> Self {
|
||||
let index = self
|
||||
.bundle
|
||||
.requirements_toml
|
||||
@@ -56,7 +58,7 @@ impl CloudConfigBundleFixture {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn add_enterprise_config(mut self, contents: impl Into<String>) -> Self {
|
||||
pub fn add_system_overlay_config(mut self, contents: impl Into<String>) -> Self {
|
||||
let index = self.bundle.config_toml.managed_layers.system_overlay.len() + 1;
|
||||
self.bundle
|
||||
.config_toml
|
||||
@@ -86,8 +88,7 @@ impl CloudConfigBundleFixture {
|
||||
CloudManagedLayer::SystemOverlay => {
|
||||
&mut self.bundle.requirements_toml.managed_layers.system_overlay
|
||||
}
|
||||
}
|
||||
.get_or_insert_default();
|
||||
};
|
||||
let index = fragments.len() + 1;
|
||||
fragments.push(CloudRequirementsFragment {
|
||||
id: format!("managed_req_{index}"),
|
||||
@@ -107,8 +108,7 @@ impl CloudConfigBundleFixture {
|
||||
CloudManagedLayer::SystemOverlay => {
|
||||
&mut self.bundle.config_toml.managed_layers.system_overlay
|
||||
}
|
||||
}
|
||||
.get_or_insert_default();
|
||||
};
|
||||
let index = fragments.len() + 1;
|
||||
fragments.push(CloudConfigFragment {
|
||||
id: format!("managed_cfg_{index}"),
|
||||
|
||||
@@ -2,9 +2,9 @@ use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn adds_enterprise_requirements_in_order() {
|
||||
let bundle = CloudConfigBundleFixture::enterprise_requirement("first")
|
||||
.add_enterprise_requirement("second")
|
||||
fn adds_system_overlay_requirements_in_order() {
|
||||
let bundle = CloudConfigBundleFixture::system_overlay_requirement("first")
|
||||
.add_system_overlay_requirement("second")
|
||||
.into_bundle();
|
||||
|
||||
assert_eq!(
|
||||
|
||||
@@ -54,7 +54,8 @@ fn config_error_from_io(err: &std::io::Error) -> &ConfigError {
|
||||
}
|
||||
|
||||
fn cloud_config_bundle_requirement_source() -> RequirementSource {
|
||||
RequirementSource::EnterpriseManaged {
|
||||
RequirementSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "req_1".to_string(),
|
||||
name: "Base requirements".to_string(),
|
||||
}
|
||||
@@ -1091,7 +1092,7 @@ allowed_approval_policies = ["on-request"]
|
||||
&[] as &[(String, TomlValue)],
|
||||
ConfigLoadOptions {
|
||||
loader_overrides,
|
||||
cloud_config_bundle: CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
cloud_config_bundle: CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approval_policies = ["never"]"#,
|
||||
),
|
||||
..Default::default()
|
||||
@@ -1321,7 +1322,7 @@ async fn load_config_layers_includes_cloud_config_bundle() -> anyhow::Result<()>
|
||||
let requirements = r#"allowed_approval_policies = ["never"]"#;
|
||||
let expected: ConfigRequirementsToml = toml::from_str(requirements)?;
|
||||
let cloud_config_bundle =
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(requirements);
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(requirements);
|
||||
|
||||
let layers = load_config_layers_state(
|
||||
LOCAL_FS.as_ref(),
|
||||
@@ -1902,7 +1903,7 @@ extends = ":workspace"
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn load_config_layers_inserts_cloud_config_between_system_and_user() -> anyhow::Result<()> {
|
||||
async fn load_config_layers_inserts_system_overlay_between_system_and_user() -> anyhow::Result<()> {
|
||||
let tmp = tempdir()?;
|
||||
let codex_home = tmp.path().join("home");
|
||||
tokio::fs::create_dir_all(&codex_home).await?;
|
||||
@@ -1934,7 +1935,7 @@ review_model = "system-review"
|
||||
&[] as &[(String, TomlValue)],
|
||||
ConfigLoadOptions {
|
||||
loader_overrides: overrides,
|
||||
cloud_config_bundle: CloudConfigBundleFixture::loader_with_enterprise_config(
|
||||
cloud_config_bundle: CloudConfigBundleFixture::loader_with_system_overlay_config(
|
||||
r#"model = "cloud"
|
||||
model_provider = "cloud-provider"
|
||||
"#,
|
||||
@@ -1969,7 +1970,8 @@ model_provider = "cloud-provider"
|
||||
ConfigLayerSource::System {
|
||||
file: AbsolutePathBuf::from_absolute_path(&system_config_path)?,
|
||||
},
|
||||
ConfigLayerSource::EnterpriseManaged {
|
||||
ConfigLayerSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "cfg_1".to_string(),
|
||||
name: "Base config".to_string(),
|
||||
},
|
||||
@@ -1984,7 +1986,7 @@ model_provider = "cloud-provider"
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn load_config_layers_applies_managed_buckets_at_generic_precedence() -> anyhow::Result<()> {
|
||||
async fn load_config_layers_applies_managed_bucket_precedence() -> anyhow::Result<()> {
|
||||
let tmp = tempdir()?;
|
||||
let codex_home = tmp.path().join("home");
|
||||
tokio::fs::create_dir_all(&codex_home).await?;
|
||||
@@ -2014,32 +2016,31 @@ allowed_sandbox_modes = ["read-only"]
|
||||
LoaderOverrides::with_managed_config_path_for_tests(managed_config_path.clone());
|
||||
overrides.system_config_path = Some(system_config_path.clone());
|
||||
overrides.system_requirements_path = Some(system_requirements_path.clone());
|
||||
let cloud_config_bundle =
|
||||
CloudConfigBundleFixture::enterprise_config("model_provider = \"legacy-provider\"")
|
||||
.add_managed_config(
|
||||
CloudManagedLayer::Baseline,
|
||||
r#"model = "baseline"
|
||||
let cloud_config_bundle = CloudConfigBundleFixture::default()
|
||||
.add_managed_config(
|
||||
CloudManagedLayer::Baseline,
|
||||
r#"model = "baseline"
|
||||
model_provider = "baseline-provider"
|
||||
review_model = "baseline-review"
|
||||
"#,
|
||||
)
|
||||
.add_managed_config(
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
"model_provider = \"overlay-provider\"",
|
||||
)
|
||||
.add_managed_requirement(
|
||||
CloudManagedLayer::Baseline,
|
||||
r#"allowed_web_search_modes = ["live"]
|
||||
)
|
||||
.add_managed_config(
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
"model_provider = \"overlay-provider\"",
|
||||
)
|
||||
.add_managed_requirement(
|
||||
CloudManagedLayer::Baseline,
|
||||
r#"allowed_web_search_modes = ["live"]
|
||||
allow_remote_control = true
|
||||
"#,
|
||||
)
|
||||
.add_managed_requirement(
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
r#"allowed_sandbox_modes = ["read-only", "workspace-write"]
|
||||
)
|
||||
.add_managed_requirement(
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
r#"allowed_sandbox_modes = ["read-only", "workspace-write"]
|
||||
allowed_approval_policies = ["on-request"]
|
||||
"#,
|
||||
)
|
||||
.into_loader();
|
||||
)
|
||||
.into_loader();
|
||||
|
||||
let layers = load_config_layers_state(
|
||||
LOCAL_FS.as_ref(),
|
||||
@@ -2137,75 +2138,6 @@ allowed_approval_policies = ["on-request"]
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn explicit_empty_system_overlay_suppresses_legacy_cloud_fallback() -> anyhow::Result<()> {
|
||||
let tmp = tempdir()?;
|
||||
let codex_home = tmp.path().join("home");
|
||||
tokio::fs::create_dir_all(&codex_home).await?;
|
||||
let system_config_path = tmp.path().join("system_config.toml");
|
||||
tokio::fs::write(
|
||||
&system_config_path,
|
||||
"model_provider = \"system-provider\"\n",
|
||||
)
|
||||
.await?;
|
||||
let system_requirements_path = tmp.path().join("requirements.toml");
|
||||
tokio::fs::write(
|
||||
&system_requirements_path,
|
||||
r#"allowed_approval_policies = ["on-request"]"#,
|
||||
)
|
||||
.await?;
|
||||
|
||||
let mut bundle =
|
||||
CloudConfigBundleFixture::enterprise_config("model_provider = \"legacy-provider\"")
|
||||
.add_enterprise_requirement(r#"allowed_approval_policies = ["never"]"#)
|
||||
.into_bundle();
|
||||
bundle.config_toml.managed_layers.system_overlay = Some(Vec::new());
|
||||
bundle.requirements_toml.managed_layers.system_overlay = Some(Vec::new());
|
||||
let cloud_config_bundle = CloudConfigBundleLoader::new(async move { Ok(Some(bundle)) });
|
||||
let mut overrides = LoaderOverrides::without_managed_config_for_tests();
|
||||
overrides.system_config_path = Some(system_config_path);
|
||||
overrides.system_requirements_path = Some(system_requirements_path.clone());
|
||||
|
||||
let layers = load_config_layers_state(
|
||||
LOCAL_FS.as_ref(),
|
||||
&codex_home,
|
||||
Some(AbsolutePathBuf::from_absolute_path(tmp.path())?),
|
||||
&[] as &[(String, TomlValue)],
|
||||
ConfigLoadOptions {
|
||||
loader_overrides: overrides,
|
||||
cloud_config_bundle,
|
||||
..Default::default()
|
||||
},
|
||||
&codex_config::NoopThreadConfigLoader,
|
||||
)
|
||||
.await?;
|
||||
|
||||
assert_eq!(
|
||||
layers
|
||||
.effective_config()
|
||||
.get("model_provider")
|
||||
.and_then(TomlValue::as_str),
|
||||
Some("system-provider")
|
||||
);
|
||||
assert!(
|
||||
!layers
|
||||
.get_layers(
|
||||
ConfigLayerStackOrdering::LowestPrecedenceFirst,
|
||||
/*include_disabled*/ false,
|
||||
)
|
||||
.iter()
|
||||
.any(|layer| matches!(layer.name, ConfigLayerSource::EnterpriseManaged { .. }))
|
||||
);
|
||||
assert_eq!(
|
||||
layers.requirements().approval_policy.source,
|
||||
Some(RequirementSource::SystemRequirementsToml {
|
||||
file: AbsolutePathBuf::from_absolute_path(system_requirements_path)?,
|
||||
})
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn load_config_layers_can_ignore_managed_requirements() -> anyhow::Result<()> {
|
||||
let tmp = tempdir()?;
|
||||
@@ -2232,7 +2164,7 @@ async fn load_config_layers_can_ignore_managed_requirements() -> anyhow::Result<
|
||||
overrides.system_requirements_path = Some(system_requirements_path);
|
||||
overrides.ignore_managed_requirements = true;
|
||||
|
||||
let cloud_config_bundle = CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
let cloud_config_bundle = CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approval_policies = ["never"]"#,
|
||||
);
|
||||
|
||||
@@ -2289,7 +2221,7 @@ statusMessage = "checking"
|
||||
);
|
||||
let expected: ConfigRequirementsToml = toml::from_str(&requirements)?;
|
||||
let cloud_config_bundle =
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(requirements);
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(requirements);
|
||||
|
||||
let layers = load_config_layers_state(
|
||||
LOCAL_FS.as_ref(),
|
||||
@@ -2330,7 +2262,7 @@ async fn load_config_layers_resolves_relative_bundle_requirements_paths_against_
|
||||
deny_read = ["secrets/**"]
|
||||
"#;
|
||||
let cloud_config_bundle =
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(requirements);
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(requirements);
|
||||
|
||||
let layers = load_config_layers_state(
|
||||
LOCAL_FS.as_ref(),
|
||||
@@ -2383,7 +2315,7 @@ async fn strict_config_rejects_unknown_cloud_config_key() {
|
||||
ConfigLoadOptions {
|
||||
loader_overrides: LoaderOverrides::without_managed_config_for_tests(),
|
||||
strict_config: true,
|
||||
cloud_config_bundle: CloudConfigBundleFixture::loader_with_enterprise_config(
|
||||
cloud_config_bundle: CloudConfigBundleFixture::loader_with_system_overlay_config(
|
||||
"unknown_key = true",
|
||||
),
|
||||
},
|
||||
@@ -2414,7 +2346,7 @@ async fn load_config_layers_applies_matching_remote_sandbox_config() -> anyhow::
|
||||
allowed_sandbox_modes = ["read-only", "workspace-write"]
|
||||
"#;
|
||||
let cloud_config_bundle =
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(requirements);
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(requirements);
|
||||
let layers = load_config_layers_state(
|
||||
LOCAL_FS.as_ref(),
|
||||
&codex_home,
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::config::edit::ConfigEditsBuilder;
|
||||
use crate::config::edit::apply_blocking;
|
||||
use assert_matches::assert_matches;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::CloudManagedLayer;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
@@ -1672,7 +1673,7 @@ async fn experimental_network_requirements_enable_proxy_without_feature() -> std
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[experimental_network]
|
||||
enabled = true
|
||||
@@ -4774,7 +4775,7 @@ enabled = true
|
||||
let config = ConfigBuilder::default()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[plugins."sample@test".mcp_servers.sample.identity]
|
||||
url = "https://sample.example/mcp"
|
||||
@@ -4800,7 +4801,8 @@ url = "https://sample.example/mcp"
|
||||
Some((
|
||||
false,
|
||||
Some(McpServerDisabledReason::Requirements {
|
||||
source: RequirementSource::EnterpriseManaged {
|
||||
source: RequirementSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "req_1".to_string(),
|
||||
name: "Base requirements".to_string(),
|
||||
},
|
||||
@@ -4877,7 +4879,7 @@ enabled = true
|
||||
let config = ConfigBuilder::default()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[mcp_servers]
|
||||
"#,
|
||||
@@ -4896,7 +4898,8 @@ enabled = true
|
||||
Some((
|
||||
false,
|
||||
Some(McpServerDisabledReason::Requirements {
|
||||
source: RequirementSource::EnterpriseManaged {
|
||||
source: RequirementSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "req_1".to_string(),
|
||||
name: "Base requirements".to_string(),
|
||||
},
|
||||
@@ -9340,7 +9343,7 @@ async fn requirements_disallowing_default_sandbox_falls_back_to_required_default
|
||||
let config = ConfigBuilder::without_managed_config_for_tests()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_sandbox_modes = ["read-only"]"#,
|
||||
),
|
||||
)
|
||||
@@ -9366,7 +9369,7 @@ async fn explicit_sandbox_mode_falls_back_when_disallowed_by_requirements() -> s
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_sandbox_modes = ["read-only"]"#,
|
||||
),
|
||||
)
|
||||
@@ -9393,7 +9396,7 @@ sandbox = "unelevated"
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"[windows]
|
||||
allowed_sandbox_implementations = ["elevated"]
|
||||
"#,
|
||||
@@ -9430,7 +9433,7 @@ sandbox_mode = "danger-full-access"
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_sandbox_modes = ["read-only"]"#,
|
||||
),
|
||||
)
|
||||
@@ -9464,7 +9467,7 @@ default_permissions = "dev"
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_sandbox_modes = ["read-only"]"#,
|
||||
),
|
||||
)
|
||||
@@ -9492,7 +9495,7 @@ async fn permission_profile_override_falls_back_when_disallowed_by_requirements(
|
||||
..Default::default()
|
||||
})
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_sandbox_modes = ["read-only"]"#,
|
||||
),
|
||||
)
|
||||
@@ -9519,7 +9522,7 @@ async fn active_profile_is_cleared_when_requirements_force_fallback() -> std::io
|
||||
..Default::default()
|
||||
})
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_sandbox_modes = ["read-only"]"#,
|
||||
),
|
||||
)
|
||||
@@ -9633,7 +9636,7 @@ async fn requirements_web_search_mode_overrides_danger_full_access_default() ->
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_web_search_modes = ["cached"]"#,
|
||||
),
|
||||
)
|
||||
@@ -9671,7 +9674,7 @@ trust_level = "untrusted"
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(workspace.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approval_policies = ["on-request"]"#,
|
||||
),
|
||||
)
|
||||
@@ -9699,7 +9702,7 @@ async fn explicit_approval_policy_falls_back_when_disallowed_by_requirements() -
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approval_policies = ["on-request"]"#,
|
||||
),
|
||||
)
|
||||
@@ -9719,7 +9722,7 @@ async fn feature_requirements_normalize_effective_feature_values() -> std::io::R
|
||||
let config = ConfigBuilder::without_managed_config_for_tests()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[features]
|
||||
personality = true
|
||||
@@ -9751,7 +9754,7 @@ async fn feature_requirements_auto_review_disables_guardian_approval() -> std::i
|
||||
let config = ConfigBuilder::without_managed_config_for_tests()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[features]
|
||||
auto_review = false
|
||||
@@ -9773,7 +9776,7 @@ async fn browser_feature_requirements_are_valid() -> std::io::Result<()> {
|
||||
let config = ConfigBuilder::without_managed_config_for_tests()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[features]
|
||||
in_app_browser = false
|
||||
@@ -9879,7 +9882,7 @@ shell_tool = true
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[features]
|
||||
personality = true
|
||||
@@ -9997,7 +10000,7 @@ async fn requirements_disallowing_default_approvals_reviewer_falls_back_to_requi
|
||||
let config = ConfigBuilder::without_managed_config_for_tests()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approvals_reviewers = ["guardian_subagent"]"#,
|
||||
),
|
||||
)
|
||||
@@ -10022,7 +10025,7 @@ async fn root_approvals_reviewer_falls_back_when_disallowed_by_requirements() ->
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approvals_reviewers = ["guardian_subagent"]"#,
|
||||
),
|
||||
)
|
||||
@@ -10061,7 +10064,7 @@ async fn profile_approvals_reviewer_falls_back_when_disallowed_by_requirements()
|
||||
..LoaderOverrides::without_managed_config_for_tests()
|
||||
})
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approvals_reviewers = ["guardian_subagent"]"#,
|
||||
),
|
||||
)
|
||||
@@ -10086,7 +10089,7 @@ async fn approvals_reviewer_preserves_valid_user_choice_when_allowed_by_requirem
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approvals_reviewers = ["user", "guardian_subagent"]"#,
|
||||
),
|
||||
)
|
||||
@@ -10602,7 +10605,7 @@ async fn feature_requirements_normalize_runtime_feature_mutations() -> std::io::
|
||||
let mut config = ConfigBuilder::default()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[features]
|
||||
personality = true
|
||||
@@ -10636,7 +10639,7 @@ async fn feature_requirements_warn_on_collab_legacy_alias() -> std::io::Result<(
|
||||
let config = ConfigBuilder::without_managed_config_for_tests()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[features]
|
||||
collab = true
|
||||
@@ -10666,7 +10669,7 @@ async fn feature_requirements_warn_and_ignore_unknown_feature() -> std::io::Resu
|
||||
let config = ConfigBuilder::without_managed_config_for_tests()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[features]
|
||||
made_up_feature = true
|
||||
|
||||
@@ -405,7 +405,7 @@ approvals_reviewer = "user"
|
||||
let config = ConfigBuilder::default()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approvals_reviewers = ["auto_review"]"#,
|
||||
),
|
||||
)
|
||||
@@ -435,7 +435,7 @@ approvals_reviewer = "user"
|
||||
let config = ConfigBuilder::default()
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approvals_reviewers = ["auto_review"]"#,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -218,7 +218,7 @@ pub async fn load_default_config_for_test_with_cloud_config_bundle(
|
||||
}
|
||||
|
||||
pub fn managed_network_requirements_loader() -> CloudConfigBundleLoader {
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[experimental_network]
|
||||
enabled = true
|
||||
|
||||
@@ -47,7 +47,7 @@ async fn selected_plugin_servers_use_managed_requirements_for_the_selected_root_
|
||||
.codex_home(codex_home.path().to_path_buf())
|
||||
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||
.cloud_config_bundle(
|
||||
CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"
|
||||
[plugins."selected-root".mcp_servers.allowed.identity]
|
||||
command = "allowed-command"
|
||||
|
||||
@@ -284,13 +284,6 @@ fn fallback_managed_hooks_source_path(
|
||||
Some(RequirementSource::Composite { .. }) => {
|
||||
synthetic_layer_path("<requirements-composition>/requirements.toml")
|
||||
}
|
||||
Some(RequirementSource::EnterpriseManaged { id, name }) => {
|
||||
let name = escape_xml_text(name);
|
||||
let id = escape_xml_text(id);
|
||||
synthetic_layer_path(&format!(
|
||||
"<enterprise-managed:{name}:{id}>/requirements.toml"
|
||||
))
|
||||
}
|
||||
Some(RequirementSource::CloudManaged { layer, id, name }) => {
|
||||
let name = escape_xml_text(name);
|
||||
let id = escape_xml_text(id);
|
||||
@@ -657,7 +650,6 @@ fn hook_source_for_requirement_source(source: Option<&RequirementSource>) -> Hoo
|
||||
// available coarse attribution.
|
||||
hook_source_for_requirement_source(sources.first())
|
||||
}
|
||||
Some(RequirementSource::EnterpriseManaged { .. }) => HookSource::CloudRequirements,
|
||||
Some(RequirementSource::CloudManaged { .. }) => HookSource::CloudRequirements,
|
||||
Some(RequirementSource::Unknown) | None => HookSource::Unknown,
|
||||
}
|
||||
@@ -665,6 +657,7 @@ fn hook_source_for_requirement_source(source: Option<&RequirementSource>) -> Hoo
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use codex_config::CloudManagedLayer;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::HookEventsToml;
|
||||
@@ -732,7 +725,8 @@ mod tests {
|
||||
RequirementSource::SystemRequirementsToml {
|
||||
file: test_path_buf("/etc/codex/requirements.toml").abs(),
|
||||
},
|
||||
RequirementSource::EnterpriseManaged {
|
||||
RequirementSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "layer-1".to_string(),
|
||||
name: "Engineering".to_string(),
|
||||
},
|
||||
@@ -746,8 +740,9 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enterprise_managed_synthetic_path_escapes_display_fields() {
|
||||
let source = RequirementSource::EnterpriseManaged {
|
||||
fn cloud_managed_synthetic_path_escapes_display_fields() {
|
||||
let source = RequirementSource::CloudManaged {
|
||||
layer: CloudManagedLayer::SystemOverlay,
|
||||
id: "id<&>".to_string(),
|
||||
name: "Name <Admin> & \"Ops\"".to_string(),
|
||||
};
|
||||
|
||||
@@ -1134,7 +1134,7 @@ mod tests {
|
||||
let codex_home = tempdir()?;
|
||||
let required_policy = codex_protocol::protocol::AskForApproval::Never;
|
||||
let cloud_config_bundle =
|
||||
codex_config::test_support::CloudConfigBundleFixture::loader_with_enterprise_requirement(
|
||||
codex_config::test_support::CloudConfigBundleFixture::loader_with_system_overlay_requirement(
|
||||
r#"allowed_approval_policies = ["never"]"#,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user