config: add cloud-managed layer provenance

This commit is contained in:
hefuc-oai
2026-07-07 22:09:22 +00:00
parent 2589f7a52d
commit 4ec0da7e88
23 changed files with 497 additions and 8 deletions
+20 -7
View File
@@ -309,6 +309,7 @@ fn render_non_file_layer_details(layer: &ConfigLayerEntry) -> Vec<Line<'static>>
ConfigLayerSource::SessionFlags => render_session_flag_details(&layer.config),
ConfigLayerSource::Mdm { .. }
| ConfigLayerSource::EnterpriseManaged { .. }
| ConfigLayerSource::CloudManaged { .. }
| ConfigLayerSource::LegacyManagedConfigTomlFromMdm => render_non_file_layer_value(layer),
ConfigLayerSource::System { .. }
| ConfigLayerSource::User { .. }
@@ -373,6 +374,7 @@ fn non_file_layer_value_label(source: &ConfigLayerSource) -> &'static str {
"MDM value"
}
ConfigLayerSource::EnterpriseManaged { .. } => "Enterprise-managed config value",
ConfigLayerSource::CloudManaged { .. } => "Cloud-managed config value",
ConfigLayerSource::SessionFlags
| ConfigLayerSource::System { .. }
| ConfigLayerSource::User { .. }
@@ -557,6 +559,7 @@ mod tests {
use super::session_all_proxy_url;
use crate::legacy_core::config::Permissions;
use codex_app_server_protocol::AskForApproval;
use codex_config::CloudManagedLayer;
use codex_config::ConfigLayerEntry;
use codex_config::ConfigLayerSource;
use codex_config::ConfigLayerStack;
@@ -800,13 +803,23 @@ mod tests {
absolute_path("/home/alice/.codex/config.toml")
};
let stack = ConfigLayerStack::new(
vec![ConfigLayerEntry::new(
ConfigLayerSource::User {
file: user_file,
profile: None,
},
empty_toml_table(),
)],
vec![
ConfigLayerEntry::new(
ConfigLayerSource::CloudManaged {
layer: CloudManagedLayer::Baseline,
id: "policy-1".to_string(),
name: "Baseline policy".to_string(),
},
TomlValue::Table(toml::toml! { model = "managed" }),
),
ConfigLayerEntry::new(
ConfigLayerSource::User {
file: user_file,
profile: None,
},
empty_toml_table(),
),
],
requirements,
requirements_toml,
)
@@ -5,7 +5,9 @@ expression: rendered.as_str()
/debug-config
Config layer stack (lowest precedence first):
1. user (/home/alice/.codex/config.toml) (enabled)
1. cloud-managed baseline (Baseline policy, policy-1) (enabled)
Cloud-managed config value: { model = "managed" }
2. user (/home/alice/.codex/config.toml) (enabled)
Requirements:
- allowed_approval_policies: on-request (source: MDM managed_config.toml (legacy))