Skip to content

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

chore: files changed crates/openhuman-core/src/security/approval/gate_intercept.rs

Steven Enamakel3efb65a08f00
diff --git a/crates/openhuman-core/src/security/approval/gate_intercept.rs b/crates/openhuman-core/src/security/approval/gate_intercept.rs
index 5a23f8b51c..621e786be2 100644
--- a/crates/openhuman-core/src/security/approval/gate_intercept.rs
+++ b/crates/openhuman-core/src/security/approval/gate_intercept.rs
@@ -53,7 +53,12 @@ impl ApprovalGate {
// `AgentTurnOrigin` around `run_turn`. Unlabelled callers map to
// `Unknown`, which is denied — the gate refuses to execute an
// external_effect tool from an unlabelled call site.
- let origin = turn_origin::current().unwrap_or(AgentTurnOrigin::Unknown);
+ // The gate has no context of its own yet (the approval-gate carrier is
+ // a separate #7801 step), so it reads the task's turn scope once and
+ // asks that for the origin, the agent's approval posture and its host
+ // overrides.
+ let turn_ctx = crate::core::runtime::DispatchCtx::ambient_turn();
+ let origin = turn_ctx.turn_origin().unwrap_or(AgentTurnOrigin::Unknown);
// Approval of job creation grants the scheduler permission to run the
// saved prompt and deliver its answer, not permission for arbitrary
// future external effects. Enforce this before global auto-approval,
@@ -224,7 +229,7 @@ impl ApprovalGate {
if !forced
&& !matches!(&origin, AgentTurnOrigin::Unknown)
- && crate::core::runtime::CoreContext::current_approvals_disabled()
+ && turn_ctx.approvals_disabled()
{
tracing::info!(
tool = tool_name,
@@ -509,7 +514,8 @@ impl ApprovalGate {
// to time out and return `Deny` incorrectly. (CodeRabbit
// review on PR #2149.)
let (tx, rx) = oneshot::channel::<ApprovalDecision>();
- let scope = crate::core::runtime::CoreContext::current_host_overrides()
+ let scope = turn_ctx
+ .host_overrides()
.and_then(|overrides| overrides.approval_scope());
let register = |workspace| -> anyhow::Result<()> {
{