Skip to content

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

fix(session-host): gate delegation tools on spawn tool presence

Steven Enamakel626293d290cd
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs
index 7b8efe6cf5..b32b91f465 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs
@@ -23,7 +23,12 @@ impl OpenHumanTurnPrelude {
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner)
.recorded_tool_snapshot_adopted;
- if definition.subagents.is_empty() && !has_recorded_tool_snapshot {
+ // A named scope delegates only when it names a spawn tool (the build
+ // time rule), so the definition's roster never widens an explicit
+ // allowlist here either.
+ let delegates = !definition.subagents.is_empty()
+ && super::builder::should_synthesize_delegation_tools(&definition);
+ if !delegates && !has_recorded_tool_snapshot {
return Ok(());
}
let (integrations, integrations_are_authoritative, recorded_tool_snapshot_adopted) = {
@@ -43,7 +48,11 @@ impl OpenHumanTurnPrelude {
.tool_surface
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
- let mut collected = collect_orchestrator_tools(&definition, &registry, &integrations);
+ let mut collected = if delegates {
+ collect_orchestrator_tools(&definition, &registry, &integrations)
+ } else {
+ Vec::new()
+ };
#[cfg(feature = "mcp")]
collected.extend(mcp_tools);
let rebuilt = self.rebuilt_recorded_tools(