chore: make create_approval_requirement_for_command an async fn (#7501)

I think this might help with https://github.com/openai/codex/pull/7033
because `create_approval_requirement_for_command()` will soon need
access to `Session.state`, which is a `tokio::sync::Mutex` that needs to
be accessed via `async`.
This commit is contained in:
Michael Bolin
2025-12-02 15:01:15 -08:00
committed by GitHub
Unverified
parent 4d4778ec1c
commit ec93b6daf3
3 changed files with 32 additions and 24 deletions
@@ -554,19 +554,21 @@ impl UnifiedExecSessionManager {
let env = apply_unified_exec_env(create_env(&context.turn.shell_environment_policy));
let mut orchestrator = ToolOrchestrator::new();
let mut runtime = UnifiedExecRuntime::new(self);
let approval_requirement = create_approval_requirement_for_command(
&context.turn.exec_policy,
command,
context.turn.approval_policy,
&context.turn.sandbox_policy,
SandboxPermissions::from(with_escalated_permissions.unwrap_or(false)),
)
.await;
let req = UnifiedExecToolRequest::new(
command.to_vec(),
cwd,
env,
with_escalated_permissions,
justification,
create_approval_requirement_for_command(
&context.turn.exec_policy,
command,
context.turn.approval_policy,
&context.turn.sandbox_policy,
SandboxPermissions::from(with_escalated_permissions.unwrap_or(false)),
),
approval_requirement,
);
let tool_ctx = ToolCtx {
session: context.session.as_ref(),