Skip to content

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

test(subagent-host): cover pack ownership when inheriting denials

Steven Enamakel26fec3d4a476
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch_policy_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch_policy_tests.rs
index 9d3aab7dc5..cd129de0c3 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch_policy_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch_policy_tests.rs
@@ -119,3 +119,36 @@ fn child_policy_keeps_the_parent_channel_ceiling_and_explicit_denials() {
tinytools::ToolPolicyAction::Deny
);
}
+
+#[test]
+fn child_keeps_the_pack_tools_its_parent_closed_to_hand_off() {
+ // The parent denies `skill_registry_search` only because it hands that pack
+ // off to `skill_setup` (`close_handed_off_packs`); the specialist must still
+ // be able to call it.
+ let tool = PolicyFixtureTool("skill_registry_search", PermissionLevel::ReadOnly);
+ let mut parent = parent_policy(PermissionLevel::Dangerous);
+ parent.session.deny(["skill_registry_search"]);
+ let names = HashSet::from(["skill_registry_search".to_string()]);
+
+ let specialist = child_tool_policy(Some(&parent), "skill_setup", &names, &[&tool])
+ .expect("the specialist inherits the channel policy");
+ assert_ne!(
+ specialist
+ .session
+ .decision_for("skill_registry_search")
+ .action,
+ tinytools::ToolPolicyAction::Deny,
+ "the pack owner keeps its own tool"
+ );
+
+ let stranger = child_tool_policy(Some(&parent), "task_manager_agent", &names, &[&tool])
+ .expect("another child inherits the channel policy");
+ assert_eq!(
+ stranger
+ .session
+ .decision_for("skill_registry_search")
+ .action,
+ tinytools::ToolPolicyAction::Deny,
+ "a child that does not own the pack still inherits the denial"
+ );
+}