Move workspace roots onto thread/session state and stop using active permission profile modifications as an overlay for writable roots. Existing app-server threads now preserve their persisted PermissionProfile value across resume, fork, and turn updates; permissions requests on existing threads only update the active named profile after validating it exists. Workspace roots can be updated independently, and SandboxPolicy::WorkspaceWrite no longer stores its own writable_roots.

This commit is contained in:
Michael Bolin
2026-05-11 15:23:15 -07:00
parent 3e10e09e24
commit 6579ec2f9d
141 changed files with 2384 additions and 2210 deletions

View File

@@ -762,6 +762,16 @@ mod tests {
Ok(())
}
fn workspace_write_policy_for_codex_home(
codex_home: &TempDir,
) -> codex_protocol::permissions::FileSystemSandboxPolicy {
let memories_root = AbsolutePathBuf::try_from(codex_home.path().join("memories"))
.expect("codex home tempdir should be absolute");
codex_protocol::models::PermissionProfile::workspace_write()
.file_system_sandbox_policy()
.with_additional_legacy_workspace_writable_roots(std::slice::from_ref(&memories_root))
}
#[tokio::test]
async fn debug_sandbox_honors_active_permission_profiles() -> anyhow::Result<()> {
let codex_home = TempDir::new()?;
@@ -940,8 +950,7 @@ mod tests {
assert_eq!(
config.permissions.file_system_sandbox_policy(),
codex_protocol::models::PermissionProfile::workspace_write()
.file_system_sandbox_policy()
workspace_write_policy_for_codex_home(&codex_home)
);
Ok(())
@@ -973,8 +982,7 @@ mod tests {
assert_eq!(
config.permissions.file_system_sandbox_policy(),
codex_protocol::models::PermissionProfile::workspace_write()
.file_system_sandbox_policy()
workspace_write_policy_for_codex_home(&codex_home)
);
Ok(())