mirror of
https://github.com/openai/codex.git
synced 2026-11-16 06:54:36 +00:00
Read turn permissions from the current configuration (#36930)
## What changed - Remove the cached permission profile from `TurnContext` and derive the effective profile, filesystem policy, network policy, and legacy sandbox policy from `config.permissions`. - Update sandbox consumers and tests to use the current turn configuration. - Verify that role-based agent spawning reapplies runtime permissions and that cold-resumed agents retain their disabled permission profile. GitOrigin-RevId: d67c5d2bcbe6dc76f15b56defb485b155fd1f138
This commit is contained in:
1 parent
7ada37a15e
commit
90314a9207
14 files changed
+67
-40
No files matched your search
@@ -244,7 +244,7 @@ pub(crate) async fn build_guardian_prompt_items_with_parent_turn(
|
||||
fn parent_turn_denied_reads_context(turn: &TurnContext) -> Option<String> {
|
||||
#[allow(deprecated)]
|
||||
let cwd = &turn.cwd;
|
||||
let file_system_policy = turn.permission_profile.file_system_sandbox_policy();
|
||||
let file_system_policy = turn.file_system_sandbox_policy();
|
||||
let mut entries = file_system_policy
|
||||
.get_unreadable_roots_with_cwd(cwd)
|
||||
.into_iter()
|
||||
|
||||
@@ -467,7 +467,7 @@ async fn build_guardian_prompt_includes_parent_turn_denied_reads() -> anyhow::Re
|
||||
session.thread_id = fixed_guardian_parent_session_id();
|
||||
let denied_root = test_path_buf("/repo/private").abs();
|
||||
let denied_glob = test_path_buf("/repo/private/**").display().to_string();
|
||||
turn.permission_profile = PermissionProfile::from_runtime_permissions(
|
||||
let permission_profile = PermissionProfile::from_runtime_permissions(
|
||||
&FileSystemSandboxPolicy::restricted(vec![
|
||||
FileSystemSandboxEntry {
|
||||
path: FileSystemPath::Special {
|
||||
@@ -493,6 +493,10 @@ async fn build_guardian_prompt_includes_parent_turn_denied_reads() -> anyhow::Re
|
||||
]),
|
||||
NetworkSandboxPolicy::Restricted,
|
||||
);
|
||||
Arc::make_mut(&mut turn.config)
|
||||
.permissions
|
||||
.set_permission_profile(permission_profile)
|
||||
.expect("test setup should allow updating permission profile");
|
||||
let session = Arc::new(session);
|
||||
let turn = Arc::new(turn);
|
||||
seed_guardian_parent_history(&session, &turn).await;
|
||||
|
||||
Reference in new issue
Block a user