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/agent/tinyagents/middleware/tool_policy.rs,crates/ope

Steven Enamakel79c88ac1d8d7
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 3e39880ae2..d6fc9ebeb1 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
@@ -332,7 +332,7 @@ impl ToolMiddleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
// level), mirroring the engine order in `agent_tool_exec`.
#[cfg(feature = "modules")]
let desktop_approval_disabled = match self.resolve_tool(&call.name) {
- Some(tool) => crate::desktop::control::approvals_disabled_for(&ctx, tool.as_ref()).await,
+ Some(tool) => crate::desktop::control::approvals_disabled_for(&crate::core::runtime::DispatchCtx::ambient(), tool.as_ref()).await,
None => false,
};
#[cfg(not(feature = "modules"))]
diff --git a/crates/openhuman-core/src/cron/scheduler.rs b/crates/openhuman-core/src/cron/scheduler.rs
index 0d483fa91d..8ddb2cd4d3 100644
--- a/crates/openhuman-core/src/cron/scheduler.rs
+++ b/crates/openhuman-core/src/cron/scheduler.rs
@@ -122,8 +122,9 @@ impl LiveAgentSchedulers {
.retain(|id, _| live.iter().any(|(live_id, _)| live_id == id));
for (agent_id, ctx) in live {
let scheduler = &mut self.by_agent;
+ let dispatch = crate::core::runtime::DispatchCtx::new(ctx.clone());
crate::core::runtime::CoreContext::scope(ctx, async move {
- let config = match crate::config::ops::load_current_or_init(&ctx).await {
+ let config = match crate::config::ops::load_current_or_init(&dispatch).await {
Ok(config) => config,
Err(error) => {
tracing::debug!(agent = %agent_id, %error, "[cron:scheduler] agent config unavailable");
diff --git a/crates/openhuman-core/src/integrations/task_sources/bus.rs b/crates/openhuman-core/src/integrations/task_sources/bus.rs
index 7b6a99d368..94d5eca429 100644
--- a/crates/openhuman-core/src/integrations/task_sources/bus.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/bus.rs
@@ -52,8 +52,8 @@ impl EventHandler<DomainEvent> for TaskSourcesConnectionSubscriber {
// Every scope may hold sources for this toolkit (`crate::storage`):
// handle each scope as its own agent, with that agent's config.
- crate::storage::agents::for_each_live_scope("task_sources connection", || {
- fire_in_scope(&DispatchCtx::ambient(), provider, toolkit, connection_id)
+ crate::storage::agents::for_each_live_scope("task_sources connection", || async move {
+ fire_in_scope(&DispatchCtx::ambient(), provider, toolkit, connection_id).await
})
.await;
}
diff --git a/crates/openhuman-core/src/integrations/task_sources/periodic.rs b/crates/openhuman-core/src/integrations/task_sources/periodic.rs
index 40a946260a..abe88885ee 100644
--- a/crates/openhuman-core/src/integrations/task_sources/periodic.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/periodic.rs
@@ -101,7 +101,9 @@ async fn run_loop() {
// `local`, then every agent that keeps its sources in its own storage
// scope (`crate::storage::agents`).
for (agent, result) in
- crate::storage::agents::for_each_live_scope("task_sources", run_one_tick).await
+ crate::storage::agents::for_each_live_scope("task_sources", || async {
+ run_one_tick(&DispatchCtx::ambient()).await
+ }).await
{
if let Err(e) = result {
tracing::warn!(error = %e, agent = agent.as_deref().unwrap_or("local"), "[task_sources:periodic] tick failed (continuing)");
diff --git a/crates/openhuman-core/src/memory/bus.rs b/crates/openhuman-core/src/memory/bus.rs
index b3a7cc60a3..72cab270b6 100644
--- a/crates/openhuman-core/src/memory/bus.rs
+++ b/crates/openhuman-core/src/memory/bus.rs
@@ -115,8 +115,9 @@ impl EventHandler<DomainEvent> for SystemJobsSubscriber {
/// own context so its memory binding and sources apply.
async fn sync_live_agent_sources() {
for (agent_id, ctx) in crate::core::runtime::AgentContextRegistry::live() {
+ let dispatch = crate::core::runtime::DispatchCtx::new(ctx.clone());
crate::core::runtime::CoreContext::scope(ctx, async {
- match crate::config::ops::load_current_or_init(&ctx).await {
+ match crate::config::ops::load_current_or_init(&dispatch).await {
Ok(config) => {
tracing::debug!(agent = %agent_id, "[memory:bus] agent source sync");
run_system_job(&config, SOURCES_SYNC_JOB).await;
diff --git a/crates/openhuman-core/src/sandbox/ops_tests.rs b/crates/openhuman-core/src/sandbox/ops_tests.rs
index 1c0083c24c..4d3895bdca 100644
--- a/crates/openhuman-core/src/sandbox/ops_tests.rs
+++ b/crates/openhuman-core/src/sandbox/ops_tests.rs
@@ -352,10 +352,11 @@ async fn sandbox_off_component_forces_the_unsandboxed_fallback_and_no_module_loa
let mut set = crate::core::runtime::ComponentSet::all();
set.sandbox = false;
let ctx = crate::core::runtime::context::CoreContext::for_test_with_components(set);
+ let dispatch = DispatchCtx::new(ctx.clone());
crate::core::runtime::context::CoreContext::scope(ctx, async {
assert!(sandbox_component_off());
assert!(sandbox_disabled_by_host());
- assert!(!command_requires_sandbox(&ctx, Some(SandboxMode::Sandboxed))
+ assert!(!command_requires_sandbox(&dispatch, Some(SandboxMode::Sandboxed))
.await
.unwrap());
})