Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

context: remove legacy permissions instructions helper (#22790)

Michael Bolinaeca1cba6f30
diff --git a/codex-rs/core/src/context/permissions_instructions.rs b/codex-rs/core/src/context/permissions_instructions.rs
index cd5a8ac338..e982ca17d2 100644
--- a/codex-rs/core/src/context/permissions_instructions.rs
+++ b/codex-rs/core/src/context/permissions_instructions.rs
@@ -8,7 +8,6 @@ use codex_protocol::permissions::NetworkSandboxPolicy;
use codex_protocol::protocol::AskForApproval;
use codex_protocol::protocol::GranularApprovalConfig;
use codex_protocol::protocol::NetworkAccess;
-use codex_protocol::protocol::SandboxPolicy;
use codex_protocol::protocol::WritableRoot;
use codex_utils_template::Template;
use std::path::Path;
@@ -85,27 +84,6 @@ impl PermissionsInstructions {
)
}
- /// Builds permissions instructions from a legacy sandbox policy.
- pub fn from_policy(
- sandbox_policy: &SandboxPolicy,
- approval_policy: AskForApproval,
- approvals_reviewer: ApprovalsReviewer,
- exec_policy: &Policy,
- cwd: &Path,
- exec_permission_approvals_enabled: bool,
- request_permissions_tool_enabled: bool,
- ) -> Self {
- Self::from_permission_profile(
- &PermissionProfile::from_legacy_sandbox_policy(sandbox_policy),
- approval_policy,
- approvals_reviewer,
- exec_policy,
- cwd,
- exec_permission_approvals_enabled,
- request_permissions_tool_enabled,
- )
- }
-
fn from_permissions_with_network(
sandbox_mode: SandboxMode,
network_access: NetworkAccess,
diff --git a/codex-rs/core/src/context/permissions_instructions_tests.rs b/codex-rs/core/src/context/permissions_instructions_tests.rs
index 16d5dc631a..6d1aa5d886 100644
--- a/codex-rs/core/src/context/permissions_instructions_tests.rs
+++ b/codex-rs/core/src/context/permissions_instructions_tests.rs
@@ -53,29 +53,6 @@ fn builds_permissions_with_network_access_override() {
);
}
-#[test]
-fn builds_permissions_from_policy() {
- let policy = SandboxPolicy::WorkspaceWrite {
- writable_roots: vec![],
- network_access: true,
- exclude_tmpdir_env_var: false,
- exclude_slash_tmp: false,
- };
-
- let instructions = PermissionsInstructions::from_policy(
- &policy,
- AskForApproval::UnlessTrusted,
- ApprovalsReviewer::User,
- &Policy::empty(),
- &PathBuf::from("/tmp"),
- /*exec_permission_approvals_enabled*/ false,
- /*request_permissions_tool_enabled*/ false,
- );
- let text = instructions.body();
- assert!(text.contains("Network access is enabled."));
- assert!(text.contains("`approval_policy` is `unless-trusted`"));
-}
-
#[test]
fn builds_permissions_from_profile() {
let cwd = PathBuf::from("/tmp");