Skip to content

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

refactor(subagent_host): move parent tool ceiling into filter_definition_tool_indices

Steven Enamakel6c9a79f969b6
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index 226685d5d1..7d50736844 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -484,23 +484,13 @@ async fn run_typed_mode(
.as_deref()
.or(definition.skill_filter.as_deref()),
nested_spawn_depth_available,
+ &parent.subagent_tool_ceiling_names,
);
let mut allowed_indices = filtered_tools.indices;
let nested_spawn_ids = filtered_tools.nested_spawn_ids;
let nested_spawn_granted = !filtered_tools.nested_spawn_tools.is_empty();
let can_spawn_subagent = filtered_tools.nested_spawn_tools.contains("spawn_subagent");
- // A child may only narrow an explicit profile/channel ceiling, never widen
- // it back to `all_tools`. The parent's own role-specific prompt surface is
- // intentionally not a ceiling: coordinators delegate effectful work to
- // specialists whose tools they do not advertise directly.
- super::super::tool_prep::retain_parent_visible_tool_indices(
- &mut allowed_indices,
- &parent.all_tools,
- &parent.subagent_tool_ceiling_names,
- nested_spawn_granted,
- );
-
// Rule-withheld tools stay callable (`allowed_names`) but off the prompt.
let child_rules = options
.run_context
diff --git a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
index 74877dcca1..e117921fc3 100644
--- a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
@@ -140,6 +140,7 @@ pub(super) fn filter_definition_tool_indices(
definition: &AgentDefinition,
skill_filter: Option<&str>,
nested_spawn_depth_available: bool,
+ parent_visible: &std::collections::HashSet<String>,
) -> DefinitionToolFilter {
let nested_spawn_ids = definition.allowed_subagent_ids();
let explicitly_declares_nested_spawn = |name: &str| {
@@ -194,6 +195,13 @@ pub(super) fn filter_definition_tool_indices(
}
}
+ retain_parent_visible_tool_indices(
+ &mut allowed,
+ parent_tools,
+ parent_visible,
+ nested_spawn_granted,
+ );
+
DefinitionToolFilter {
indices: allowed,
nested_spawn_ids,