mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Compare resume sandbox overrides using permission profile labels (#61136)
## What changed Use `legacy_sandbox_policy_label` from the active permission profile to check sandbox overrides when resuming a loaded thread. Continue accepting `external-sandbox` for `danger-full-access` requests, and construct the legacy sandbox policy only when reporting a mismatch. GitOrigin-RevId: 0f923323394692d2e1f39bafe637c70ce305dc3d
This commit is contained in:
@@ -198,24 +198,21 @@ fn collect_resume_override_mismatches(
|
||||
}
|
||||
}
|
||||
if let Some(requested_sandbox) = request.sandbox.as_ref() {
|
||||
let active_sandbox = config_snapshot.sandbox_policy();
|
||||
let sandbox_matches = matches!(
|
||||
(requested_sandbox, &active_sandbox),
|
||||
(
|
||||
SandboxMode::ReadOnly,
|
||||
codex_protocol::protocol::SandboxPolicy::ReadOnly { .. }
|
||||
) | (
|
||||
SandboxMode::WorkspaceWrite,
|
||||
codex_protocol::protocol::SandboxPolicy::WorkspaceWrite { .. }
|
||||
) | (
|
||||
SandboxMode::DangerFullAccess,
|
||||
codex_protocol::protocol::SandboxPolicy::DangerFullAccess
|
||||
) | (
|
||||
SandboxMode::DangerFullAccess,
|
||||
codex_protocol::protocol::SandboxPolicy::ExternalSandbox { .. }
|
||||
)
|
||||
);
|
||||
let active_sandbox_label = config_snapshot
|
||||
.permission_profile
|
||||
.legacy_sandbox_policy_label(config_snapshot.cwd().as_path());
|
||||
let sandbox_matches = match requested_sandbox {
|
||||
SandboxMode::ReadOnly => active_sandbox_label == "read-only",
|
||||
SandboxMode::WorkspaceWrite => active_sandbox_label == "workspace-write",
|
||||
SandboxMode::DangerFullAccess => {
|
||||
matches!(
|
||||
active_sandbox_label,
|
||||
"danger-full-access" | "external-sandbox"
|
||||
)
|
||||
}
|
||||
};
|
||||
if !sandbox_matches {
|
||||
let active_sandbox = config_snapshot.sandbox_policy();
|
||||
mismatch_details.push(format!(
|
||||
"sandbox requested={requested_sandbox:?} active={active_sandbox:?}"
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user