Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(approval): remove duplicate gate state check in approval flow

Steven Enamakel9b5fed9a4031
diff --git a/crates/openhuman-core/src/security/approval/gate_state.rs b/crates/openhuman-core/src/security/approval/gate_state.rs
index ff60a3259e..c278806c1f 100644
--- a/crates/openhuman-core/src/security/approval/gate_state.rs
+++ b/crates/openhuman-core/src/security/approval/gate_state.rs
@@ -49,13 +49,20 @@ impl ApprovalGate {
if let Some(tx) = self.take_waiter(request_id) {
let _ = tx.send(decision);
}
+ // Routing (thread/client/tool_call_id) was recorded at park time —
+ // see `intercept_audited_inner` — so a decision made after the
+ // in-memory waiter already resolved (e.g. via the TTL/channel-drop
+ // paths in `gate_intercept.rs`) still reports `None` here, which is
+ // correct: this fn only fires for a live `decide()` call.
+ let route = self.take_request_route(request_id);
BUS.publish(DomainEvent::ApprovalDecided {
request_id: row.request_id.clone(),
tool_name: row.tool_name.clone(),
decision: decision.as_str().to_string(),
- thread_id: None,
- client_id: None,
- tool_call_id: None,
+ thread_id: route.as_ref().and_then(|r| r.thread_id.clone()),
+ client_id: route.as_ref().and_then(|r| r.client_id.clone()),
+ tool_call_id: route.and_then(|r| r.tool_call_id),
+ resolution: None,
});
}
Ok(decided)