From 980778f529134bf5db2dfcac399a3b96598d28fd Mon Sep 17 00:00:00 2001 From: Tiffany Citra Date: Wed, 15 Oct 2025 17:04:10 -0700 Subject: [PATCH] Fix sandbox retry approvals --- codex-rs/core/src/codex.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index edeaef9932..1cedbf6204 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -982,13 +982,17 @@ async fn handle_function_call( ) .await; - match rx_approve.await.unwrap_or_default() { + let decision = rx_approve.await.unwrap_or_default(); + + if matches!(decision, ReviewDecision::ApprovedForSession) { + // Persist this command as pre-approved for the + // remainder of the session so future executions + // can skip the sandbox directly. + sess.add_approved_command(params.command.clone()); + } + + match decision { ReviewDecision::Approved | ReviewDecision::ApprovedForSession => { - // Persist this command as pre‑approved for the - // remainder of the session so future - // executions skip the sandbox directly. - // TODO(ragona): Isn't this a bug? It always saves the command in an | fork? - sess.add_approved_command(params.command.clone()); // Inform UI we are retrying without sandbox. sess.notify_background_event( &sub_id,