mirror of
https://github.com/openai/codex.git
synced 2026-11-26 07:26:11 +00:00
Preserve executor path URIs in permission profile workspace roots (#45863)
## Why Executor profile roots can use path conventions that are not native to the current host. Converting them to host paths during configuration or turn reconstruction can reject or drop those roots, while case-insensitive comparison can hide Windows path spelling changes. ## What changed - Store profile roots as URI-backed `ProfileWorkspaceRoot` values throughout permission snapshots and thread settings, preserving spelling in equality and deduplication. - Keep effective workspace roots as `PathUri` values for permission materialization and status summaries. Convert Windows sandbox root hints to native paths only at native Windows sandbox boundaries, rejecting incompatible roots. - Omit the legacy rollout `workspace_roots` field when profile roots cannot be represented as host paths, retaining the compiled permission profile. ## Testing Add regression coverage for Windows and UNC root spelling changes, settings restoration and turn recording with foreign roots, executor-root status display, and backend-specific Windows root conversion. GitOrigin-RevId: 903c068fd74959bdd10e7cb1141aa42b953a59a4
This commit is contained in:
1 parent
04581f9604
commit
83dc7d11e8
27 files changed
+408
-105
No files matched your search
@@ -1,6 +1,7 @@
|
||||
use super::*;
|
||||
#[cfg(target_os = "windows")]
|
||||
use anyhow::Context as _;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct WindowsSandboxRequestProcessor {
|
||||
@@ -113,6 +114,19 @@ impl WindowsSandboxRequestProcessor {
|
||||
params.mode,
|
||||
)?;
|
||||
|
||||
// Provisioning installs native Windows filesystem permissions. Validate
|
||||
// this boundary before acknowledging that setup has started.
|
||||
let workspace_roots = config
|
||||
.effective_workspace_roots()
|
||||
.iter()
|
||||
.map(PathUri::to_abs_path)
|
||||
.collect::<std::io::Result<Vec<_>>>()
|
||||
.map_err(|err| {
|
||||
invalid_request(format!(
|
||||
"workspace roots are not native to this host: {err}"
|
||||
))
|
||||
})?;
|
||||
|
||||
self.outgoing
|
||||
.send_response(
|
||||
request_id.clone(),
|
||||
@@ -127,7 +141,7 @@ impl WindowsSandboxRequestProcessor {
|
||||
let setup_request = WindowsSandboxSetupRequest {
|
||||
mode: setup_mode,
|
||||
permission_profile: config.permissions.effective_permission_profile(),
|
||||
workspace_roots: config.effective_workspace_roots(),
|
||||
workspace_roots,
|
||||
command_cwd,
|
||||
env_map: std::env::vars().collect(),
|
||||
codex_home: config.codex_home.to_path_buf(),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
use super::ConfigManager;
|
||||
use super::load_setup_config;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[tokio::test]
|
||||
@@ -32,7 +33,10 @@ async fn explicit_cwd_remains_the_setup_workspace() -> anyhow::Result<()> {
|
||||
|
||||
assert_eq!(
|
||||
(command_cwd, config.effective_workspace_roots()),
|
||||
(project.path().to_path_buf(), vec![expected]),
|
||||
(
|
||||
project.path().to_path_buf(),
|
||||
vec![PathUri::from_abs_path(&expected)],
|
||||
),
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user