Skip to content

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

test(profiles): cover child tool filtering and reserved names

Steven Enamakelfd6395c4c6da
diff --git a/crates/openhuman-core/src/agent/subagent_host/tool_prep_tests.rs b/crates/openhuman-core/src/agent/subagent_host/tool_prep_tests.rs
index b2e9c52ddc..24e61ec5f4 100644
--- a/crates/openhuman-core/src/agent/subagent_host/tool_prep_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/tool_prep_tests.rs
@@ -7,6 +7,33 @@ fn custom_delegate_is_treated_as_spawn_tool() {
assert!(!is_subagent_spawn_tool("directory_resolve"));
}
+#[test]
+fn child_tool_surface_never_contains_any_spawn_or_continuation_tool() {
+ let tools: Vec<Box<dyn Tool>> = [
+ "spawn_subagent",
+ "spawn_async_subagent",
+ "spawn_parallel_agents",
+ "spawn_worker_thread",
+ "delegate_graph",
+ "delegate_researcher",
+ "continue_subagent",
+ ]
+ .into_iter()
+ .map(|name| Box::new(NamedTool(name)) as Box<dyn Tool>)
+ .collect();
+
+ let indices = filter_tool_indices(&tools, &ToolScope::Wildcard, &[], None);
+
+ assert!(
+ indices.is_empty(),
+ "child tool surface retained: {:?}",
+ indices
+ .iter()
+ .map(|&index| tools[index].name())
+ .collect::<Vec<_>>()
+ );
+}
+
#[test]
fn unprefixed_delegate_name_overrides_are_treated_as_spawn_tools() {
// Most synthesised delegation tools use an unprefixed
diff --git a/crates/openhuman-core/src/profiles/capabilities.rs b/crates/openhuman-core/src/profiles/capabilities.rs
index 0927c9935e..097c412925 100644
--- a/crates/openhuman-core/src/profiles/capabilities.rs
+++ b/crates/openhuman-core/src/profiles/capabilities.rs
@@ -27,6 +27,10 @@ pub struct ProfileCapabilities {
system_prompt: Option<String>,
}
+#[cfg(test)]
+#[path = "capabilities_tests.rs"]
+mod tests;
+
impl ProfileCapabilities {
/// Construct immutable adapters. `None` names select only supplied host tools.
pub fn new(
diff --git a/crates/openhuman-core/src/profiles/provider_settings_tests.rs b/crates/openhuman-core/src/profiles/provider_settings_tests.rs
index 4f1221cd42..05df8359b1 100644
--- a/crates/openhuman-core/src/profiles/provider_settings_tests.rs
+++ b/crates/openhuman-core/src/profiles/provider_settings_tests.rs
@@ -80,6 +80,7 @@ fn rejects_collisions_duplicates_unsafe_identifiers_and_alias_chains() {
"",
" ",
"shell",
+ "spawn_subagent",
"memory",
"show_page",
"web_answer_tool",