Skip to content

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

feat(approval): add intercept_audited_for_call with tool call id threading

Steven Enamakel98072727e945
diff --git a/crates/openhuman-core/src/security/approval/gate_setup.rs b/crates/openhuman-core/src/security/approval/gate_setup.rs
index 56d6217c4b..111a0bed99 100644
--- a/crates/openhuman-core/src/security/approval/gate_setup.rs
+++ b/crates/openhuman-core/src/security/approval/gate_setup.rs
@@ -156,6 +156,23 @@ impl ApprovalGate {
tool_name: &str,
action_summary: &str,
args_redacted: serde_json::Value,
+ ) -> (GateOutcome, Option<String>) {
+ self.intercept_audited_for_call(tool_name, action_summary, args_redacted, None)
+ .await
+ }
+
+ /// Like [`Self::intercept_audited`], but threads the gated tool call's
+ /// provider-assigned call id through so `ApprovalRequested`/`ApprovalDecided`
+ /// and the persisted `pending_approvals` row can correlate back to the
+ /// exact `tool_call` timeline row instead of matching on tool name alone.
+ /// `None` for callers with no tracked call id (a legacy path, or a call
+ /// not driven through the tinyagents harness).
+ pub async fn intercept_audited_for_call(
+ &self,
+ tool_name: &str,
+ action_summary: &str,
+ args_redacted: serde_json::Value,
+ tool_call_id: Option<&str>,
) -> (GateOutcome, Option<String>) {
// No caller-supplied park bound: identical behavior to before. With
// `park_bound = None` the inner never takes the caller-bound abandon
@@ -167,6 +184,7 @@ impl ApprovalGate {
args_redacted,
None,
&mut _park_bound_elapsed,
+ tool_call_id,
)
.await
}