Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Defer legacy filesystem policy projection (#39813)

chess67b2c8c6fb8b
diff --git a/codex-rs/core/src/session/session.rs b/codex-rs/core/src/session/session.rs
index c185a62455..8684fc4588 100644
--- a/codex-rs/core/src/session/session.rs
+++ b/codex-rs/core/src/session/session.rs
@@ -361,14 +361,6 @@ impl SessionConfiguration {
let current_file_system_sandbox_policy =
self.file_system_sandbox_policy(current_environments);
let current_network_sandbox_policy = self.network_sandbox_policy();
- let legacy_file_system_projection =
- FileSystemSandboxPolicy::from_legacy_sandbox_policy_preserving_deny_entries(
- &current_sandbox_policy,
- self.cwd(),
- &current_file_system_sandbox_policy,
- );
- let file_system_policy_matches_legacy = current_file_system_sandbox_policy
- .is_semantically_equivalent_to(&legacy_file_system_projection, self.cwd());
let file_system_policy_has_rebindable_project_root_write =
current_file_system_sandbox_policy
.entries
@@ -503,8 +495,15 @@ impl SessionConfiguration {
),
)?;
} else if cwd_changed
- && file_system_policy_matches_legacy
&& file_system_policy_has_rebindable_project_root_write
+ && current_file_system_sandbox_policy.is_semantically_equivalent_to(
+ &FileSystemSandboxPolicy::from_legacy_sandbox_policy_preserving_deny_entries(
+ &current_sandbox_policy,
+ self.cwd(),
+ &current_file_system_sandbox_policy,
+ ),
+ self.cwd(),
+ )
{
// Preserve richer split policies across cwd-only updates; only
// rederive when the session is already using a structurally