mirror of
https://github.com/openai/codex.git
synced 2026-11-17 22:10:37 +00:00
config: add cloud-managed layer provenance
This commit is contained in:
@@ -245,6 +245,19 @@ Example with notification opt-out:
|
||||
- `config/batchWrite` — apply multiple config edits atomically to the user's config.toml on disk, with optional `reloadUserConfig: true` to hot-reload loaded threads, including multiple `desktop.*` edits.
|
||||
- `configRequirements/read` — fetch loaded requirements constraints from `requirements.toml` and/or MDM (or `null` if none are configured), including allow-lists (`allowedApprovalPolicies`, `allowedSandboxModes`, `allowedWebSearchModes`), the layered permission-profile allow map (`allowedPermissionProfiles`), the managed permission-profile default (`defaultPermissions`), lifecycle hook lockdown (`allowManagedHooksOnly`), remote-control policy (`allowRemoteControl`; `false` force-disables remote control while `true` or `null` preserves existing behavior), computer use policy (`computerUse`), pinned feature values (`featureRequirements`), managed lifecycle hooks (`hooks`), `enforceResidency`, managed new-thread defaults (`models.newThread.model`, `models.newThread.modelReasoningEffort`, and `models.newThread.serviceTier`), and `network` constraints such as canonical domain/socket permissions plus `managedAllowedDomainsOnly` and `dangerFullAccessDenylistOnly`.
|
||||
|
||||
Cloud-managed sources in `config/read` identify the precedence tier and fragment that supplied a value:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "cloudManaged",
|
||||
"layer": "baseline",
|
||||
"id": "policy-1",
|
||||
"name": "Default model policy"
|
||||
}
|
||||
```
|
||||
|
||||
`layer` is either `baseline` or `systemOverlay`. The existing `enterpriseManaged` source remains supported.
|
||||
|
||||
### Example: Start or resume a thread
|
||||
|
||||
Start a fresh thread when you need a new Codex conversation.
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
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_config::CloudManagedLayer;
|
||||
use codex_config::ConfigLayer;
|
||||
use codex_config::ConfigLayerMetadata;
|
||||
use codex_config::ConfigLayerSource;
|
||||
@@ -18,6 +20,13 @@ pub(crate) fn config_layer_source_to_api(source: ConfigLayerSource) -> ApiConfig
|
||||
ConfigLayerSource::EnterpriseManaged { id, name } => {
|
||||
ApiConfigLayerSource::EnterpriseManaged { id, name }
|
||||
}
|
||||
ConfigLayerSource::CloudManaged { layer, id, name } => {
|
||||
let layer = match layer {
|
||||
CloudManagedLayer::Baseline => ApiCloudManagedLayer::Baseline,
|
||||
CloudManagedLayer::SystemOverlay => ApiCloudManagedLayer::SystemOverlay,
|
||||
};
|
||||
ApiConfigLayerSource::CloudManaged { layer, id, name }
|
||||
}
|
||||
ConfigLayerSource::User { file, profile } => ApiConfigLayerSource::User { file, profile },
|
||||
ConfigLayerSource::Project { dot_codex_folder } => {
|
||||
ApiConfigLayerSource::Project { dot_codex_folder }
|
||||
@@ -61,3 +70,7 @@ pub(crate) fn config_layer_to_api(layer: ConfigLayer) -> ApiConfigLayer {
|
||||
disabled_reason: layer.disabled_reason,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "config_layer_tests.rs"]
|
||||
mod tests;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::json;
|
||||
|
||||
#[test]
|
||||
fn cloud_managed_layers_map_to_complete_api_objects() {
|
||||
for (domain_layer, api_layer) in [
|
||||
(CloudManagedLayer::Baseline, ApiCloudManagedLayer::Baseline),
|
||||
(
|
||||
CloudManagedLayer::SystemOverlay,
|
||||
ApiCloudManagedLayer::SystemOverlay,
|
||||
),
|
||||
] {
|
||||
let layer = ConfigLayer {
|
||||
name: ConfigLayerSource::CloudManaged {
|
||||
layer: domain_layer,
|
||||
id: "policy-1".to_string(),
|
||||
name: "Workspace policy".to_string(),
|
||||
},
|
||||
version: "etag-1".to_string(),
|
||||
config: json!({"model": "gpt-5"}),
|
||||
disabled_reason: Some("conflicts with another managed fragment".to_string()),
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
config_layer_to_api(layer),
|
||||
ApiConfigLayer {
|
||||
name: ApiConfigLayerSource::CloudManaged {
|
||||
layer: api_layer,
|
||||
id: "policy-1".to_string(),
|
||||
name: "Workspace policy".to_string(),
|
||||
},
|
||||
version: "etag-1".to_string(),
|
||||
config: json!({"model": "gpt-5"}),
|
||||
disabled_reason: Some("conflicts with another managed fragment".to_string()),
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -633,6 +633,9 @@ fn override_message(layer: &ConfigLayerSource) -> String {
|
||||
ConfigLayerSource::EnterpriseManaged { id: _, name } => {
|
||||
format!("Overridden by enterprise-managed config: {name}")
|
||||
}
|
||||
ConfigLayerSource::CloudManaged { layer, id: _, name } => {
|
||||
format!("Overridden by cloud-managed {layer} config: {name}")
|
||||
}
|
||||
ConfigLayerSource::Project { dot_codex_folder } => format!(
|
||||
"Overridden by project config: {}/{CONFIG_TOML_FILE}",
|
||||
dot_codex_folder.display(),
|
||||
|
||||
Reference in New Issue
Block a user