Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

fix: drop Mutex before calling tx_approve.send() (#2876)

Michael Bolinc988ce28fe29
diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs
index 99c59d97a9..d7c39c14a5 100644
--- a/codex-rs/core/src/codex.rs
+++ b/codex-rs/core/src/codex.rs
@@ -657,9 +657,17 @@ impl Session {
}
pub fn notify_approval(&self, sub_id: &str, decision: ReviewDecision) {
- let mut state = self.state.lock_unchecked();
- if let Some(tx_approve) = state.pending_approvals.remove(sub_id) {
- tx_approve.send(decision).ok();
+ let entry = {
+ let mut state = self.state.lock_unchecked();
+ state.pending_approvals.remove(sub_id)
+ };
+ match entry {
+ Some(tx_approve) => {
+ tx_approve.send(decision).ok();
+ }
+ None => {
+ warn!("No pending approval found for sub_id: {sub_id}");
+ }
}
}