mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
code-mode: make all approvals trigger elicitation pause (#31650)
### summary We want to pause code-mode from yielding back to the model when a subcommand triggers an approval prompt. This means that all of these previously inline blocking requests should also take out a ElicitationService registration. This also does some plumbing refactoring to request patch approval to make it match the other `request_*_approval` methods in that it blocks on the approval in the function instead of returning the oneshot channel, this affords our ability to encapsulate the ElicitationService registration via RAII. Adds tests to confirm the blocking behavior for code_mode both in suite tests and that the session holds them.
This commit is contained in:
1 parent
b6f9aee16d
commit
c55cb4b363
6 files changed
+461
-11
No files matched your search
@@ -156,7 +156,7 @@ impl Approvable<ApplyPatchRequest> for ApplyPatchRuntime {
|
||||
return ReviewDecision::Approved;
|
||||
}
|
||||
if let Some(reason) = retry_reason {
|
||||
let rx_approve = session
|
||||
return session
|
||||
.request_patch_approval(
|
||||
turn,
|
||||
call_id,
|
||||
@@ -165,7 +165,6 @@ impl Approvable<ApplyPatchRequest> for ApplyPatchRuntime {
|
||||
/*grant_root*/ None,
|
||||
)
|
||||
.await;
|
||||
return rx_approve.await.unwrap_or_default();
|
||||
}
|
||||
|
||||
with_cached_approval(
|
||||
@@ -173,12 +172,11 @@ impl Approvable<ApplyPatchRequest> for ApplyPatchRuntime {
|
||||
"apply_patch",
|
||||
approval_keys,
|
||||
|| async move {
|
||||
let rx_approve = session
|
||||
session
|
||||
.request_patch_approval(
|
||||
turn, call_id, changes, /*reason*/ None, /*grant_root*/ None,
|
||||
)
|
||||
.await;
|
||||
rx_approve.await.unwrap_or_default()
|
||||
.await
|
||||
},
|
||||
)
|
||||
.await
|
||||
|
||||
Reference in new issue
Block a user