Split in-memory execution policy rules into a separate crate (#62615)

## Why

Configuration, protocol, and prompt code use in-memory policies and
previously pulled in the Starlark parser through `codex-execpolicy`.

## What changed

Move policy construction, rule validation, and evaluation into
`codex-execpolicy-rules` and use it directly from those crates. Keep
Starlark policy loading and file updates in `codex-execpolicy`, which
re-exports the shared rule types and wraps rule validation errors while
preserving their source locations.

GitOrigin-RevId: 5bc70d3cd387b43a3ad1fcc56af96ad169ac8b13
This commit is contained in:
Charlie Marsh
2026-11-19 22:32:56 +00:00
committed by copyberry
parent db263d4f54
commit 5bdb5e8b3c
26 changed files with 261 additions and 171 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ workspace = true
chardetng = { workspace = true }
chrono = { workspace = true, features = ["serde"] }
codex-async-utils = { workspace = true }
codex-execpolicy = { workspace = true }
codex-execpolicy-rules = { workspace = true }
codex-extension-items = { workspace = true }
codex-http-client = { workspace = true }
codex-network-proxy = { workspace = true }
+1 -1
View File
@@ -10,7 +10,7 @@ use crate::models::PermissionProfile;
use crate::models::PermissionProfileSnapshot;
use crate::protocol::AskForApproval;
use crate::sandbox::SandboxType;
use codex_execpolicy::RequirementsExecPolicy;
use codex_execpolicy_rules::RequirementsExecPolicy;
use codex_network_proxy::EnvironmentNetworkPolicy;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_path_uri::PathUri;
+2 -2
View File
@@ -2549,7 +2549,7 @@ impl std::fmt::Display for FunctionCallOutputPayload {
mod tests {
use super::*;
use anyhow::Result;
use codex_execpolicy::Policy;
use codex_execpolicy_rules::Policy;
use pretty_assertions::assert_eq;
use std::path::PathBuf;
use tempfile::tempdir;
@@ -3436,7 +3436,7 @@ mod tests {
exec_policy
.add_prefix_rule(
&[format!("tool-{i:03}"), "x".repeat(500)],
codex_execpolicy::Decision::Allow,
codex_execpolicy_rules::Decision::Allow,
)
.expect("add rule");
}