Skip to content

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

fix(ci): restore merged test gates

Steven Enamakel4f49b8574840
diff --git a/crates/openhuman-cli/src/bin/rss_bench.rs b/crates/openhuman-cli/src/bin/rss_bench.rs
index 1fd7ae5b7f..0e2cd656ac 100644
--- a/crates/openhuman-cli/src/bin/rss_bench.rs
+++ b/crates/openhuman-cli/src/bin/rss_bench.rs
@@ -26,6 +26,7 @@
use anyhow::{Context, Result};
use async_trait::async_trait;
+use openhuman_core::agent::harness::AgentDefinitionRegistry;
use openhuman_core::agent::Agent;
use openhuman_core::memory::{Memory, MemoryCategory, MemoryEntry, NamespaceSummary, RecallOpts};
use openhuman_core::platform::proc_metrics::{
@@ -160,9 +161,14 @@ struct Roster {
/// Build `n` bare agents, each with its own temp workspace, mock model,
/// `"none"` memory backend, and a single host-supplied tool.
fn build_roster(n: usize) -> Result<Roster> {
+ // Hosted turns require the process-level definition authority even when
+ // this fixture supplies its own model, memory, and tools. Built-ins keep
+ // the benchmark hermetic: no workspace scan or network access occurs.
+ AgentDefinitionRegistry::init_global_builtins()
+ .context("initialize built-in agent definitions for benchmark roster")?;
let mut agents = Vec::with_capacity(n);
let mut workspaces = Vec::with_capacity(n);
- for i in 0..n {
+ for _ in 0..n {
let workspace = TempDir::new().context("create temp workspace")?;
let path = workspace.path().to_path_buf();
@@ -174,7 +180,10 @@ fn build_roster(n: usize) -> Result<Roster> {
.memory(memory)
.tool_dispatcher(Box::new(NativeDialect))
.model_name("bench-mock".into())
- .agent_definition_name(format!("bench-{i}"))
+ // Hosted execution resolves a stable definition id from the
+ // process registry. The roster index belongs in its isolated
+ // workspace, not the authority id.
+ .agent_definition_name("orchestrator".to_string())
.workspace_dir(path.clone())
.action_dir(path)
.auto_save(false)
diff --git a/crates/openhuman-core/src/agent/harness/session/builder/builder_build.rs b/crates/openhuman-core/src/agent/harness/session/builder/builder_build.rs
index 037c7d291f..e9f49b64e7 100644
--- a/crates/openhuman-core/src/agent/harness/session/builder/builder_build.rs
+++ b/crates/openhuman-core/src/agent/harness/session/builder/builder_build.rs
@@ -230,6 +230,35 @@ impl AgentBuilder {
.workspace_dir
.unwrap_or_else(|| std::path::PathBuf::from("."));
let action_dir = self.action_dir.unwrap_or_else(|| workspace_dir.clone());
+ let memory = self
+ .memory
+ .ok_or_else(|| anyhow::anyhow!("memory is required"))?;
+
+ // Direct builder callers (notably embedding fixtures) do not pass
+ // through `build_session_agent_inner`, which normally creates the
+ // durable host authority for a root TinyAgents invocation. When the
+ // caller has initialized the registry, provide an equivalent minimal
+ // base from the builder's isolated workspace and supplied memory.
+ // Leave it absent when no registry exists so custom-runtime callers
+ // still receive the explicit hosted-authority error at turn time.
+ let mut hosted_config = crate::config::Config::default();
+ hosted_config.workspace_dir = workspace_dir.clone();
+ hosted_config.action_dir = action_dir.clone();
+ let hosted_config = Arc::new(hosted_config);
+ let hosted_base =
+ crate::agent::harness::AgentDefinitionRegistry::global_arc().map(|definitions| {
+ Arc::new(crate::agent::tinyagents::host::OpenHumanHostBase {
+ security_policy: Arc::new(crate::security::SecurityPolicy::from_config(
+ &hosted_config.autonomy,
+ &workspace_dir,
+ &action_dir,
+ )),
+ config: Arc::clone(&hosted_config),
+ definitions,
+ memory: Arc::clone(&memory),
+ post_turn_hooks: self.post_turn_hooks.clone(),
+ })
+ });
let tools = Arc::new(tools);
let synthesized_tools = Arc::new(synthesized_tools);
@@ -251,9 +280,7 @@ impl AgentBuilder {
visible_tool_names: visible_names,
subagent_tool_ceiling_names,
tool_policy_session,
- memory: self
- .memory
- .ok_or_else(|| anyhow::anyhow!("memory is required"))?,
+ memory,
auto_recall: self.auto_recall,
tool_dispatcher: std::sync::Arc::from(
self.tool_dispatcher
@@ -316,7 +343,7 @@ impl AgentBuilder {
connected_integrations: Vec::new(),
connected_integrations_initialized: false,
runtime_config: None,
- hosted_base: None,
+ hosted_base,
definition: None,
// Default to `true` (omit) so legacy / custom agents built
// without a definition stay lean. Opt-in agents thread their
diff --git a/crates/openhuman-core/src/agent/orchestration/tools.rs b/crates/openhuman-core/src/agent/orchestration/tools.rs
index a5a87f1dda..000346cd71 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools.rs
@@ -54,6 +54,7 @@ mod steer_subagent;
#[cfg(test)]
#[path = "tools/tools_e2e_tests.rs"]
mod tools_e2e_tests;
+mod use_skill_dispatch;
#[path = "tools/wait.rs"]
mod wait;
#[path = "tools/wait_subagent.rs"]
@@ -61,7 +62,8 @@ mod wait_subagent;
#[path = "tools/worker_thread.rs"]
mod worker_thread;
-pub(crate) use dispatch::{dispatch_subagent, DelegationDispatch, UseSkillDispatch};
+pub(crate) use dispatch::{dispatch_subagent, DelegationDispatch};
+pub(crate) use use_skill_dispatch::UseSkillDispatch;
pub(crate) use agent_prepare_context::AgentPrepareContextDispatch;
pub use agent_prepare_context::{
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
index 21864898d8..97b0bb092d 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
@@ -21,69 +21,6 @@ pub(crate) struct DelegationDispatch {
kind: DelegationDispatchKind,
}
-/// Typed dispatch for `use_skill` when its selected inner tool is a synthesized
-/// delegation. Plain `Tool::execute_with_context` cannot carry the hosted
-/// parent run context that a sub-agent needs, so route those inner calls back
-/// through [`DelegationDispatch`] and leave every ordinary packed tool on the
-/// proxy's existing execution path.
-pub(crate) struct UseSkillDispatch {
- tool: Arc<dyn tinytools::Tool>,
- tool_sets: Vec<Arc<Vec<Box<dyn tinytools::Tool>>>>,
-}
-
-impl UseSkillDispatch {
- pub(crate) fn new(
- tool: Arc<dyn tinytools::Tool>,
- tool_sets: Vec<Arc<Vec<Box<dyn tinytools::Tool>>>>,
- ) -> Self {
- Self { tool, tool_sets }
- }
-}
-
-#[async_trait]
-impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for UseSkillDispatch {
- fn tool(&self) -> Arc<dyn tinytools::Tool> {
- self.tool.clone()
- }
-
- async fn execute(
- &self,
- state: &(),
- arguments: serde_json::Value,
- options: ToolCallOptions,
- parent: &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,
- ) -> anyhow::Result<ToolResult> {
- let skill = arguments.get("skill").and_then(serde_json::Value::as_str);
- let inner_name = arguments.get("tool").and_then(serde_json::Value::as_str);
- if let (Some(skill), Some(inner_name)) = (skill, inner_name) {
- let belongs_to_pack = crate::tools::toolpacks::pack_for_tool(inner_name)
- .is_some_and(|pack| pack.id == skill);
- if belongs_to_pack {
- if let Some(inner) =
- crate::agent::tinyagents::tools::CanonicalSharedToolAdapter::for_name(
- self.tool_sets.clone(),
- inner_name,
- )
- .map(Arc::new)
- {
- if let Some(dispatch) = DelegationDispatch::for_tool(inner) {
- let inner_args = arguments
- .get("args")
- .cloned()
- .unwrap_or_else(|| serde_json::json!({}));
- return dispatch.execute(state, inner_args, options, parent).await;
- }
- }
- }
- }
-
- let context = ToolExecutionContext::from_run_context(parent);
- self.tool
- .execute_with_context(arguments, options, Some(&context))
- .await
- }
-}
-
enum DelegationDispatchKind {
Collapsed {
targets: Result<Vec<super::collapsed_delegation::DelegateTarget>, String>,
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/use_skill_dispatch.rs b/crates/openhuman-core/src/agent/orchestration/tools/use_skill_dispatch.rs
new file mode 100644
index 0000000000..2d2a1a19ca
--- /dev/null
+++ b/crates/openhuman-core/src/agent/orchestration/tools/use_skill_dispatch.rs
@@ -0,0 +1,71 @@
+//! Hosted-context-preserving dispatch for packed skill tools.
+
+use super::dispatch::DelegationDispatch;
+use async_trait::async_trait;
+use std::sync::Arc;
+use tinyagents_harness::context::RunContext;
+use tinyagents_harness::tool::{ToolDispatch, ToolExecutionContext};
+use tinytools::{ToolCallOptions, ToolResult};
+
+/// Typed dispatch for `use_skill` when its selected inner tool is a synthesized
+/// delegation. Plain `Tool::execute_with_context` cannot carry the hosted
+/// parent run context that a sub-agent needs, so route those inner calls back
+/// through [`DelegationDispatch`] and leave every ordinary packed tool on the
+/// proxy's existing execution path.
+pub(crate) struct UseSkillDispatch {
+ tool: Arc<dyn tinytools::Tool>,
+ tool_sets: Vec<Arc<Vec<Box<dyn tinytools::Tool>>>>,
+}
+
+impl UseSkillDispatch {
+ pub(crate) fn new(
+ tool: Arc<dyn tinytools::Tool>,
+ tool_sets: Vec<Arc<Vec<Box<dyn tinytools::Tool>>>>,
+ ) -> Self {
+ Self { tool, tool_sets }
+ }
+}
+
+#[async_trait]
+impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for UseSkillDispatch {
+ fn tool(&self) -> Arc<dyn tinytools::Tool> {
+ self.tool.clone()
+ }
+
+ async fn execute(
+ &self,
+ state: &(),
+ arguments: serde_json::Value,
+ options: ToolCallOptions,
+ parent: &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,
+ ) -> anyhow::Result<ToolResult> {
+ let skill = arguments.get("skill").and_then(serde_json::Value::as_str);
+ let inner_name = arguments.get("tool").and_then(serde_json::Value::as_str);
+ if let (Some(skill), Some(inner_name)) = (skill, inner_name) {
+ let belongs_to_pack = crate::tools::toolpacks::pack_for_tool(inner_name)
+ .is_some_and(|pack| pack.id == skill);
+ if belongs_to_pack {
+ if let Some(inner) =
+ crate::agent::tinyagents::tools::CanonicalSharedToolAdapter::for_name(
+ self.tool_sets.clone(),
+ inner_name,
+ )
+ .map(Arc::new)
+ {
+ if let Some(dispatch) = DelegationDispatch::for_tool(inner) {
+ let inner_args = arguments
+ .get("args")
+ .cloned()
+ .unwrap_or_else(|| serde_json::json!({}));
+ return dispatch.execute(state, inner_args, options, parent).await;
+ }
+ }
+ }
+ }
+
+ let context = ToolExecutionContext::from_run_context(parent);
+ self.tool
+ .execute_with_context(arguments, options, Some(&context))
+ .await
+ }
+}
diff --git a/scripts/__tests__/coverage-runner-status.test.mjs b/scripts/__tests__/coverage-runner-status.test.mjs
index 0564ddf997..d9daeaf0e9 100644
--- a/scripts/__tests__/coverage-runner-status.test.mjs
+++ b/scripts/__tests__/coverage-runner-status.test.mjs
@@ -260,7 +260,7 @@ test("source changes compile the aggregate raw coverage target", () => {
assert.equal(res.status, 0, res.output);
assert.match(
res.output,
- /BASH_ARGS <scripts\/ci-cancel-aware\.sh> <cargo> <test> <--features> <voice web3> <--test> <raw_coverage_all> <--no-run>/,
+ /BASH_ARGS <scripts\/ci-cancel-aware\.sh> <cargo> <test> <--features> <voice web3> <-p> <openhuman-cli> <--test> <raw_coverage_all> <--no-run>/,
);
});