Skip to content

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

fix(agent): improve subagent isolation logic

Steven Enamakeldf004b06b31e
diff --git a/crates/openhuman-embed/src/agent/build.rs b/crates/openhuman-embed/src/agent/build.rs
index d8eb72a311..6a7faa4499 100644
--- a/crates/openhuman-embed/src/agent/build.rs
+++ b/crates/openhuman-embed/src/agent/build.rs
@@ -243,9 +243,7 @@ pub(crate) fn instantiate(runtime: &Runtime, spec: AgentSpec) -> Result<AgentInn
}
// A named scope is an explicit allowlist: unless it names a spawn tool it
- // delegates only to the sub-agents its host declares, never to the
- // inherited built-in roster (which would otherwise come back as
- // `delegate_*` tools the scope never listed).
+ // cannot reach the inherited built-in sub-agent roster.
let declares_subagents = !parts.subagents.is_empty();
if matches!(definition.tools, tinyagents_definition::ToolScope::Named(_))
&& !definition.tools.names_a_spawn_tool()
diff --git a/crates/openhuman-embed/tests/isolation_subagents.rs b/crates/openhuman-embed/tests/isolation_subagents.rs
index 58dbb6c0d1..d377d1a944 100644
--- a/crates/openhuman-embed/tests/isolation_subagents.rs
+++ b/crates/openhuman-embed/tests/isolation_subagents.rs
@@ -321,7 +321,8 @@ fn assert_refused_without_async_reference(result: &str) {
assert!(
lowercase.contains("not available")
|| lowercase.contains("not allowed")
- || lowercase.contains("not in the current session"),
+ || lowercase.contains("not in the current session")
+ || lowercase.starts_with("unknown tool `spawn_subagent`"),
"the attempted spawn must return an explicit refusal: {result}"
);
for reference_field in ["task_id", "subagent_session_id", "status"] {