Honor granular sandbox approvals in unified exec (#40024)

## What changed

- Use the shared approval-policy check for unified exec sandbox escalation so
  `require_escalated` commands can prompt when granular `sandbox_approval` is
  enabled and remain rejected when it is disabled.
- Add an approval scenario covering sandbox escalation with granular approvals
  enabled.

GitOrigin-RevId: 98907960cd9df181e1b2fd9d7fea11fa3c0ed7e6
This commit is contained in:
Sean Huang authored and copyberry committed 2026-08-21 21:54:40 +00:00
1 parent 6143217c67
commit 9445ef227e
2 files changed
+32 -2

No files matched your search

@@ -1,6 +1,7 @@
use std::path::Path;
use std::sync::Arc;
use crate::exec_policy::prompt_is_rejected_by_policy;
use crate::function_tool::FunctionCallError;
use crate::maybe_emit_implicit_skill_invocation;
use crate::tools::context::ExecCommandToolOutput;
@@ -279,10 +280,11 @@ impl ExecCommandHandler {
.sandbox_permissions
.requests_sandbox_override()
&& !effective_additional_permissions.permissions_preapproved
&& !matches!(
&& prompt_is_rejected_by_policy(
context.step_context.turn.approval_policy(),
codex_protocol::protocol::AskForApproval::OnRequest
/*prompt_is_rule*/ false,
)
.is_some()
{
let approval_policy = context.step_context.turn.approval_policy();
manager.release_process_id(process_id).await;