mirror of
https://github.com/openai/codex.git
synced 2026-11-04 00:24:43 +00:00
Honor managed config during project discovery (#39306)
## What changed - Include legacy managed-file and MDM settings when resolving project root markers and project trust in both canonical and executor-local config loads. - Preserve the existing managed-layer precedence in the final config stack and resolve managed relative paths against the same bases used by the final loader. - Update explicit-untrusted warnings to describe the effective configuration and direct users to an administrator when the setting is managed. ## Testing - Cover managed root markers, managed trust overrides, MDM precedence, app-server config reads, and the remote TUI warning. GitOrigin-RevId: 9b5ddd54b4530f73589d6842a15cbab7e6d6bbb9
This commit is contained in:
1 parent
e51a91b2f4
commit
6ec012668b
8 files changed
+445
-4
No files matched your search
@@ -1,4 +1,5 @@
|
||||
use super::*;
|
||||
use crate::history_cell::HistoryCell;
|
||||
use crate::legacy_core::config::ConfigBuilder;
|
||||
use crate::legacy_core::config::ConfigOverrides;
|
||||
use codex_app_server_client::AppServerClient;
|
||||
@@ -108,6 +109,39 @@ async fn remote_project_trust_guards_thread_start_and_preserves_repository_decis
|
||||
None
|
||||
);
|
||||
|
||||
let response: JsonValue = app_server
|
||||
.request_typed(ClientRequest::ConfigRead {
|
||||
request_id: RequestId::String("untrusted-project-warning".to_string()),
|
||||
params: ConfigReadParams {
|
||||
include_layers: true,
|
||||
cwd: Some(project_cwd.to_string_lossy().into_owned()),
|
||||
},
|
||||
})
|
||||
.await?;
|
||||
let reason = response["layers"]
|
||||
.as_array()
|
||||
.expect("config layers")
|
||||
.iter()
|
||||
.find(|layer| layer["name"]["type"] == "project")
|
||||
.and_then(|layer| layer["disabledReason"].as_str())
|
||||
.expect("explicitly untrusted project warning");
|
||||
let warning = crate::history_cell::new_warning_event(
|
||||
reason.replace(&project_trust_key(&project_root), "<PROJECT>"),
|
||||
);
|
||||
insta::assert_snapshot!(
|
||||
warning
|
||||
.display_lines(/*width*/ 80)
|
||||
.iter()
|
||||
.map(ToString::to_string)
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n"),
|
||||
@r"
|
||||
⚠ <PROJECT> is marked as untrusted in the effective configuration. To load
|
||||
project-local config, hooks, and exec policies, update its trust setting. If
|
||||
that setting is managed by your organization, contact your administrator.
|
||||
"
|
||||
);
|
||||
|
||||
std::fs::remove_file(project_cwd.join(".codex/config.toml"))?;
|
||||
std::fs::remove_dir(project_cwd.join(".codex"))?;
|
||||
let canonical_project_cwd = PathBuf::from(project_trust_key(&project_root)).join("nested");
|
||||
|
||||
Reference in new issue
Block a user