File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -98,9 +98,9 @@ impl ToolOrchestrator {
9898 "sandbox denied and no retry" . to_string ( ) ,
9999 ) ) ;
100100 }
101- // Under `Never`, do not retry without sandbox; surface a concise message
101+ // Under `Never` or `OnRequest` , do not retry without sandbox; surface a concise message
102102 // derived from the actual output (platform-agnostic).
103- if matches ! ( approval_policy, AskForApproval :: Never ) {
103+ if !tool . wants_no_sandbox_approval ( approval_policy) {
104104 let msg = build_never_denied_message_from_output ( output. as_ref ( ) ) ;
105105 return Err ( ToolError :: SandboxDenied ( msg) ) ;
106106 }
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ use crate::tools::sandboxing::ToolCtx;
1717use crate :: tools:: sandboxing:: ToolError ;
1818use crate :: tools:: sandboxing:: ToolRuntime ;
1919use crate :: tools:: sandboxing:: with_cached_approval;
20+ use codex_protocol:: protocol:: AskForApproval ;
2021use codex_protocol:: protocol:: ReviewDecision ;
2122use futures:: future:: BoxFuture ;
2223use std:: collections:: HashMap ;
@@ -127,6 +128,10 @@ impl Approvable<ApplyPatchRequest> for ApplyPatchRuntime {
127128 . await
128129 } )
129130 }
131+
132+ fn wants_no_sandbox_approval ( & self , policy : AskForApproval ) -> bool {
133+ !matches ! ( policy, AskForApproval :: Never )
134+ }
130135}
131136
132137impl ToolRuntime < ApplyPatchRequest , ExecToolCallOutput > for ApplyPatchRuntime {
Original file line number Diff line number Diff line change @@ -121,6 +121,11 @@ pub(crate) trait Approvable<Req> {
121121 }
122122 }
123123
124+ /// Decide we can request an approval for no-sandbox execution.
125+ fn wants_no_sandbox_approval ( & self , policy : AskForApproval ) -> bool {
126+ !matches ! ( policy, AskForApproval :: Never | AskForApproval :: OnRequest )
127+ }
128+
124129 fn start_approval_async < ' a > (
125130 & ' a mut self ,
126131 req : & ' a Req ,
You can’t perform that action at this time.
0 commit comments