Skip to content

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

chore(tests): add registry ops and definition registry tests

Steven Enamakel7ad1ccd929a9
diff --git a/crates/openhuman-core/src/agent/registry/ops_tests.rs b/crates/openhuman-core/src/agent/registry/ops_tests.rs
index a3b4525a7a..5fcba107e5 100644
--- a/crates/openhuman-core/src/agent/registry/ops_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/ops_tests.rs
@@ -114,3 +114,31 @@ fn ensure_orchestrator_enabled_rejects_disabled_orchestrator() {
"orchestrator agent cannot be disabled"
);
}
+
+#[test]
+fn a_patch_sets_and_clears_tool_rules() {
+ let mut entry = custom_agent("custom", true);
+ let rules = tinytools::ToolRules::from_allow_deny(Vec::<String>::new(), ["shell"]);
+ apply_patch(
+ &mut entry,
+ AgentRegistryPatch {
+ tool_rules: Some(rules.clone()),
+ ..AgentRegistryPatch::default()
+ },
+ );
+ assert_eq!(entry.tool_rules, Some(rules));
+ let definition = crate::agent::registry::defaults::definition_from_registry_entry(&entry);
+ assert!(
+ definition.tool_rules.is_some(),
+ "the entry's rules reach the definition"
+ );
+
+ apply_patch(
+ &mut entry,
+ AgentRegistryPatch {
+ tool_rules: Some(tinytools::ToolRules::default()),
+ ..AgentRegistryPatch::default()
+ },
+ );
+ assert_eq!(entry.tool_rules, None, "an empty rule set clears the field");
+}
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs
index e7f8a25e9b..5ac2e744a1 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs
@@ -402,7 +402,10 @@ fn the_projection_carries_the_definition_rule_layer() {
let mut open = synthetic("open", AgentTier::Worker, &[]);
open.disallowed_tools.clear();
- assert!(registry_of(vec![open.clone()]).project(&open).tool_rules.is_none());
+ assert!(registry_of(vec![open.clone()])
+ .project(&open)
+ .tool_rules
+ .is_none());
}
// ── config-backed custom agents ───────────────────────────────────────