Skip to content

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

fix(tinyagents): align subagent spawn tool detection with canonical names

Steven Enamakel8fe95be76f51
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
index 4d8c6f915f..542a3e59f4 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
@@ -154,14 +154,15 @@ pub(crate) fn tool_call_limit(max_iterations: usize, cap: Option<usize>) -> usiz
/// True when `name` is a sub-agent spawn/delegation tool that a **child** run
/// must never be able to invoke (issue #4452), re-asserted at registration as
/// defense-in-depth so a misconfigured allowlist cannot reintroduce sub-agent
-/// spawning into a nested run. Kept local to this seam (rather than importing
-/// the `pub(super)` runner helper) so the invariant travels with the
-/// registration site that enforces it.
-///
-/// This is a strict subset of the caller-side strip. The caller also resolves
-/// host-defined, unprefixed `delegate_name` overrides through the registry.
+/// spawning into a nested run. It shares TinyAgents' canonical spawn names and
+/// the host's fixed delegation controls; the caller-side strip additionally
+/// resolves unprefixed `delegate_name` overrides through the registry.
pub(crate) fn is_subagent_spawn_or_delegate_tool(name: &str) -> bool {
- name == "spawn_subagent" || name.starts_with("delegate_") || name == "spawn_worker_thread"
+ const HOST_SPAWN_TOOL_NAMES: &[&str] = &["delegate", "continue_subagent"];
+
+ tinyagents_definition::SPAWN_TOOL_NAMES.contains(&name)
+ || HOST_SPAWN_TOOL_NAMES.contains(&name)
+ || name.starts_with("delegate_")
}
#[cfg(test)]