Skip to content

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

refactor(core): thread DispatchCtx through tool and approval call sites

Steven Enamakel978f493429ae
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
index d6fc9ebeb1..f7ed0cff40 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
@@ -2,6 +2,7 @@
//! the session's channel-permission ceiling at the tool boundary, and render
//! session-scoped `use_skill` listings.
+use crate::core::runtime::DispatchCtx;
use std::sync::Arc;
use async_trait::async_trait;
diff --git a/crates/openhuman-core/src/config/tools.rs b/crates/openhuman-core/src/config/tools.rs
index 16d2ddfde6..536dd3d4f9 100644
--- a/crates/openhuman-core/src/config/tools.rs
+++ b/crates/openhuman-core/src/config/tools.rs
@@ -12,6 +12,7 @@
//! as a follow-up. They would all ship default-OFF (and autonomy is privilege
//! escalation), so leaving them out keeps this PR's surface read-only and safe.
+use crate::core::runtime::DispatchCtx;
use std::sync::Arc;
use async_trait::async_trait;
diff --git a/crates/openhuman-core/src/cron/scheduler.rs b/crates/openhuman-core/src/cron/scheduler.rs
index 8ddb2cd4d3..42c3833645 100644
--- a/crates/openhuman-core/src/cron/scheduler.rs
+++ b/crates/openhuman-core/src/cron/scheduler.rs
@@ -25,6 +25,7 @@ pub(crate) mod shell_job;
mod tests;
#[allow(unused_imports)]
+use crate::core::runtime::DispatchCtx;
use agent_run::*;
#[allow(unused_imports)]
use delivery::*;
diff --git a/crates/openhuman-embed/tests/agent_lifecycle.rs b/crates/openhuman-embed/tests/agent_lifecycle.rs
index ce8ac2e352..b9ebb6305d 100644
--- a/crates/openhuman-embed/tests/agent_lifecycle.rs
+++ b/crates/openhuman-embed/tests/agent_lifecycle.rs
@@ -144,7 +144,7 @@ fn removing_an_agent_releases_everything_it_held() {
"a removal barrier is a benign decision miss, not a lost registration"
);
for owner in [None, Some("closing")] {
- assert!(openhuman_core::security::approval::rpc::approval_decide(
+ assert!(openhuman_core::security::approval::rpc::approval_decide(&ctx,
&closing_request.request_id,
openhuman_embed::ApprovalDecision::ApproveOnce,
owner,
diff --git a/crates/openhuman-rpc/src/server/socketio.rs b/crates/openhuman-rpc/src/server/socketio.rs
index c78514c734..34d287499a 100644
--- a/crates/openhuman-rpc/src/server/socketio.rs
+++ b/crates/openhuman-rpc/src/server/socketio.rs
@@ -30,6 +30,7 @@
//! (a "type carve-out"; see AGENTS.md). `pub mod socketio;` in `core::mod` is
//! intentionally NOT gated for the same reason.
+use crate::core_host::core::runtime::DispatchCtx;
use serde::Deserialize;
use serde::Serialize;
use serde_json::json;
diff --git a/tests/in_process/config_auth_app_state_connectivity_e2e.rs b/tests/in_process/config_auth_app_state_connectivity_e2e.rs
index e961586c87..e1064aff4a 100644
--- a/tests/in_process/config_auth_app_state_connectivity_e2e.rs
+++ b/tests/in_process/config_auth_app_state_connectivity_e2e.rs
@@ -1,6 +1,7 @@
//! Focused JSON-RPC E2E coverage for config, auth/credentials, app_state,
//! and connectivity controller surfaces.
+use openhuman_core::core::runtime::DispatchCtx;
use crate::env_guard::{env_lock, env_lock_async, EnvVarGuard};
use crate::rpc_auth::ensure_rpc_auth;
use crate::rpc_harness::{ok, payload, rpc, schema};
@@ -2680,10 +2681,10 @@ async fn config_auto_approve_public_helper_persists_once_and_is_idempotent() {
EnvVarGuard::unset(APP_ENV_VAR),
EnvVarGuard::unset(VITE_APP_ENV_VAR)];
- openhuman_core::config::add_auto_approve_tool("tool.config.round10")
+ openhuman_core::config::add_auto_approve_tool(&DispatchCtx::process_default(), "tool.config.round10")
.await
.expect("add auto approve tool");
- openhuman_core::config::add_auto_approve_tool("tool.config.round10")
+ openhuman_core::config::add_auto_approve_tool(&DispatchCtx::process_default(), "tool.config.round10")
.await
.expect("idempotent auto approve tool");