The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(tools): a sub-agent keeps its parent's permission ceiling without rules
M3gA-Mindb2017b8980d2
diff --git a/crates/openhuman-core/src/tools/rules/ops.rs b/crates/openhuman-core/src/tools/rules/ops.rsindex 18380adc0b..eb8bb231a6 100644--- a/crates/openhuman-core/src/tools/rules/ops.rs+++ b/crates/openhuman-core/src/tools/rules/ops.rs@@ -106,7 +106,8 @@ pub fn rule_context(/// workers. A parent without rules (an entry point that built its context/// from scratch) contributes the operator's `[tool_rules]` directly./// The context keeps the parent's `channel` and `origin`; `agent` becomes the-/// child's id. `None` when nothing restricts the child.+/// child's id. `None` when nothing restricts the child: no rule layer and no+/// inherited permission ceiling.#[must_use]pub fn child_rule_policy(parent: Option<&ToolRulePolicy>,@@ -133,7 +134,10 @@ pub fn child_rule_policy(if let Some(layer) = agent_rule_layer(def) {set.push(layer);}- if set.is_permissive() {+ // The parent's permission ceiling restricts the child even when no rule+ // layer does.+ let permission_ceiling = parent.and_then(|parent| parent.permission_ceiling);+ if set.is_permissive() && permission_ceiling.is_none() {return None;}let context = parent@@ -149,7 +153,7 @@ pub fn child_rule_policy(Some(Arc::new(ToolRulePolicy {rules: Arc::new(set),context,- permission_ceiling: parent.and_then(|parent| parent.permission_ceiling),+ permission_ceiling,}))}diff --git a/crates/openhuman-core/src/tools/rules/ops_tests.rs b/crates/openhuman-core/src/tools/rules/ops_tests.rsindex eab66c95e5..b52621341d 100644--- a/crates/openhuman-core/src/tools/rules/ops_tests.rs+++ b/crates/openhuman-core/src/tools/rules/ops_tests.rs@@ -215,3 +215,24 @@ fn an_operator_layer_cannot_be_named_into_an_agent_layer() {"the operator layer is still inherited whatever its author named it");}++/// A parent whose rules are permissive can still carry a permission ceiling+/// (the pack ceiling of a `use_skill` run). The child must keep it: dropping+/// the policy because the rules alone are permissive lifted the ceiling.+#[test]+fn a_child_keeps_the_parents_ceiling_when_no_rules_restrict_it() {+ let parent = turn_rule_policy(+ Arc::new(session_rule_set(None, None)),+ rule_context(None, Some("orchestrator"), None),+ )+ .with_permission_ceiling(PermissionLevel::ReadOnly);+ assert!(+ parent.rules.is_permissive(),+ "precondition: no rule restricts"+ );++ let child = child_rule_policy(Some(&parent), None, &definition("worker"))+ .expect("the parent's ceiling still restricts the child");+ assert_eq!(child.permission_ceiling, Some(PermissionLevel::ReadOnly));+ assert_eq!(child.context.get("agent"), Some("worker"));+}