Skip to content

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

fix(security_gate): allow read-only tools without approval

Steven Enamakelaf7e28658144
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
index aaedbea2b8..479e700930 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
@@ -225,7 +225,16 @@ impl OpenHumanSecurityGate {
/// The policy to answer this call against: the agent's or the live one when
/// installed, else the constructor snapshot.
fn effective_policy(&self) -> Arc<SecurityPolicy> {
- crate::security::live_policy::effective().unwrap_or_else(|| self.policy.clone())
+ crate::security::live_policy::effective_in(&DispatchCtx::from_weak(self.dispatch.as_ref()))
+ .unwrap_or_else(|| self.policy.clone())
+ }
+
+ /// The origin of the turn this gate authorizes for: the run's own context
+ /// when it carries one, else the calling task's turn scope.
+ fn turn_origin(&self) -> Option<crate::agent::turn_origin::AgentTurnOrigin> {
+ DispatchCtx::from_weak(self.dispatch.as_ref())
+ .turn_origin()
+ .or_else(|| DispatchCtx::ambient_turn().turn_origin())
}
/// Finds the registered [`Tool`] named `name`, if any.
@@ -527,7 +536,7 @@ impl OpenHumanSecurityGate {
// This check precedes the shell shortcut and all approval settings,
// including installations where the approval gate is disabled.
if matches!(
- crate::agent::turn_origin::current(),
+ self.turn_origin(),
Some(
crate::agent::turn_origin::AgentTurnOrigin::TrustedAutomation {
source: crate::agent::turn_origin::TrustedAutomationSource::Cron,