Skip to content

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

fix(test): split builder tests into separate files

Steven Enamakel3697679d96bb
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
index d8c1ca1516..10a3297f5c 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
@@ -44,6 +44,19 @@ fn builtin_def(id: &str) -> crate::agent::harness::definition::AgentDefinition {
.unwrap_or_else(|| panic!("builtin agent definition not found: {id}"))
}
+/// A wildcard-belt definition for tests that need the whole registry on the
+/// wire. No built-in keeps a wildcard belt any more (the generalist
+/// `tools_agent` was removed), so the shape is synthesised from a real
+/// built-in: same parsing and defaults, only the id and the belt differ.
+fn wildcard_probe_def() -> crate::agent::harness::definition::AgentDefinition {
+ let mut def = builtin_def("archivist");
+ def.id = "wildcard_probe".to_string();
+ def.delegate_name = None;
+ def.tools = crate::agent::harness::definition::ToolScope::Wildcard;
+ def.subagents = Vec::new();
+ def
+}
+
#[path = "builder_tests_explicit_definition_tests.rs"]
mod explicit_definition_tests;
#[path = "builder_tests_host_tools_tests.rs"]
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_host_tools_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_host_tools_tests.rs
index 08f3c84e18..ac3bf94e87 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_host_tools_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_host_tools_tests.rs
@@ -33,10 +33,7 @@ impl tinytools::Tool for Marker {
}
fn definition() -> crate::agent::harness::definition::AgentDefinition {
- crate::agent::harness::AgentDefinitionRegistry::builtins_only()
- .get("tools_agent")
- .cloned()
- .expect("tools_agent built-in definition")
+ super::wildcard_probe_def()
}
/// The whole point: a name the host supplied is callable, and the model is
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
index 03425a03a2..f54c5e7399 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
@@ -1,15 +1,21 @@
use super::*;
fn visible_names(agent_id: &str) -> std::collections::HashSet<String> {
- let tmp = tempfile::TempDir::new().unwrap();
- let config = test_config(&tmp);
let definition = crate::agent::harness::AgentDefinitionRegistry::builtins_only()
.get(agent_id)
.cloned()
.unwrap_or_else(|| panic!("built-in agent definition not found: {agent_id}"));
+ visible_names_for(&definition)
+}
+
+fn visible_names_for(
+ definition: &crate::agent::harness::definition::AgentDefinition,
+) -> std::collections::HashSet<String> {
+ let tmp = tempfile::TempDir::new().unwrap();
+ let config = test_config(&tmp);
let agent =
- crate::agent::OpenHumanSessionHost::from_config_with_definition(&config, &definition)
- .unwrap_or_else(|e| panic!("{agent_id} session build: {e}"));
+ crate::agent::OpenHumanSessionHost::from_config_with_definition(&config, definition)
+ .unwrap_or_else(|e| panic!("{} session build: {e}", definition.id));
agent
.visible_tool_specs_arc()
.iter()
@@ -21,13 +27,10 @@ fn visible_names(agent_id: &str) -> std::collections::HashSet<String> {
fn resetting_wildcard_visibility_keeps_collapsed_exposure() {
let tmp = tempfile::TempDir::new().unwrap();
let config = test_config(&tmp);
- let definition = crate::agent::harness::AgentDefinitionRegistry::builtins_only()
- .get("tools_agent")
- .cloned()
- .expect("tools_agent built-in definition");
+ let definition = super::wildcard_probe_def();
let mut agent =
crate::agent::OpenHumanSessionHost::from_config_with_definition(&config, &definition)
- .expect("build tools agent");
+ .expect("build wildcard agent");
agent.set_visible_tool_names(std::collections::HashSet::new());
@@ -42,13 +45,10 @@ fn resetting_wildcard_visibility_keeps_collapsed_exposure() {
fn hiding_and_reseeding_wildcard_visibility_keeps_collapsed_exposure() {
let tmp = tempfile::TempDir::new().unwrap();
let config = test_config(&tmp);
- let definition = crate::agent::harness::AgentDefinitionRegistry::builtins_only()
- .get("tools_agent")
- .cloned()
- .expect("tools_agent built-in definition");
+ let definition = super::wildcard_probe_def();
let mut agent =
crate::agent::OpenHumanSessionHost::from_config_with_definition(&config, &definition)
- .expect("build tools agent");
+ .expect("build wildcard agent");
agent.set_visible_tool_names(std::collections::HashSet::new());
agent.hide_tools(&[crate::memory::tools::MEMORY_TOOL_NAME]);
@@ -70,7 +70,7 @@ fn hiding_and_reseeding_wildcard_visibility_keeps_collapsed_exposure() {
/// eight `todo_*` tools it replaces.
#[test]
fn wildcard_belt_advertises_collapsed_tools_not_their_hidden_members() {
- let visible = visible_names("tools_agent");
+ let visible = visible_names_for(&super::wildcard_probe_def());
for collapsed in [crate::memory::tools::MEMORY_TOOL_NAME, "todo"] {
assert!(
@@ -215,3 +215,38 @@ fn named_belt_keeps_its_legacy_members() {
"named belt must not gain the collapsed tool; got {visible:?}"
);
}
+
+/// The tools of the specialists the inline skills replaced are `Deferred`:
+/// off the orchestrator's wire, in its deferred set (so `tool_search` finds
+/// them), and callable once found. This is the whole bargain that let
+/// `settings_agent`, `scheduler_agent`, `help`, `code_executor` and `critic`
+/// go — a regression here silently takes those capabilities from chat.
+#[test]
+fn orchestrator_reaches_the_replaced_specialists_tools_through_discovery() {
+ let tmp = tempfile::TempDir::new().unwrap();
+ let config = test_config(&tmp);
+ let definition = crate::agent::harness::AgentDefinitionRegistry::builtins_only()
+ .get("orchestrator")
+ .cloned()
+ .expect("orchestrator built-in definition");
+ let agent =
+ crate::agent::OpenHumanSessionHost::from_config_with_definition(&config, &definition)
+ .expect("orchestrator session build");
+ let deferred = agent.deferred_tool_names_for_test();
+ let visible = agent.visible_tool_names_for_test();
+ let policy = agent.tool_policy_session_for_test();
+ for tool in [
+ "cron",
+ "config_snapshot",
+ "service_restart",
+ "gitbooks_search",
+ "node_exec",
+ "read_diff",
+ "run_tests",
+ "mcp_registry_installed_list",
+ ] {
+ assert!(deferred.contains(tool), "`{tool}` must be deferred; got {deferred:?}");
+ assert!(!visible.contains(tool), "`{tool}` must stay off the wire");
+ assert!(policy.is_allowed(tool), "`{tool}` must be callable once found");
+ }
+}