Skip to content

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

fix(session): pass agent definition name to tool pack withholding

Steven Enamakel7d869deaf486
diff --git a/src/openhuman/agent/harness/session/builder/setters.rs b/src/openhuman/agent/harness/session/builder/setters.rs
index f06fbf9453..8d095966fd 100644
--- a/src/openhuman/agent/harness/session/builder/setters.rs
+++ b/src/openhuman/agent/harness/session/builder/setters.rs
@@ -452,6 +452,13 @@ impl AgentBuilder {
let tool_specs: Vec<ToolSpec> = tools.iter().map(|tool| tool.spec()).collect();
let mut visible_names = self.visible_tool_names.unwrap_or_default();
+ // Resolved here rather than at its historical position below: the pack
+ // withholding is per-agent (a pack is skipped for the specialist that
+ // owns its family), so the id has to exist before the strip.
+ let agent_definition_name = self
+ .agent_definition_name
+ .clone()
+ .unwrap_or_else(|| "main".to_string());
// On-demand tool disclosure: withhold packed tools' schemas from the
// provider and advertise `load_skill` / `use_skill` in their place. The
// tools stay in the registry below and stay executable — only the
@@ -460,7 +467,10 @@ impl AgentBuilder {
if visible_names.is_empty() {
visible_names = tools.iter().map(|tool| tool.name().to_string()).collect();
}
- crate::openhuman::tools::toolpacks::strip_packed_from_visible(&mut visible_names);
+ crate::openhuman::tools::toolpacks::strip_packed_from_visible(
+ &mut visible_names,
+ &agent_definition_name,
+ );
let config = self.config.clone().unwrap_or_default();
let event_session_id = self
.event_session_id
@@ -470,10 +480,6 @@ impl AgentBuilder {
.event_channel
.clone()
.unwrap_or_else(|| "internal".to_string());
- let agent_definition_name = self
- .agent_definition_name
- .clone()
- .unwrap_or_else(|| "main".to_string());
let tool_policy_session = ToolPolicyEngine::build_session(
&agent_definition_name,
&event_channel,
diff --git a/src/openhuman/agent/harness/session/runtime.rs b/src/openhuman/agent/harness/session/runtime.rs
index 275251cadc..b43c6c7c7e 100644
--- a/src/openhuman/agent/harness/session/runtime.rs
+++ b/src/openhuman/agent/harness/session/runtime.rs
@@ -389,7 +389,10 @@ impl Agent {
// Seeding from `tool_specs` above materialises the "all visible"
// sentinel into a concrete set, which would re-admit packed tools that
// the builder withheld. Re-apply the withholding.
- crate::openhuman::tools::toolpacks::strip_packed_from_visible(&mut self.visible_tool_names);
+ crate::openhuman::tools::toolpacks::strip_packed_from_visible(
+ &mut self.visible_tool_names,
+ &self.agent_definition_name,
+ );
self.rebuild_tool_policy_session();
}
diff --git a/src/openhuman/agent/harness/session/turn/tools.rs b/src/openhuman/agent/harness/session/turn/tools.rs
index 2d102994d4..73235b1348 100644
--- a/src/openhuman/agent/harness/session/turn/tools.rs
+++ b/src/openhuman/agent/harness/session/turn/tools.rs
@@ -608,8 +608,10 @@ impl Agent {
// any that belong to a tool pack — so re-apply the withholding here
// or a packed `delegate_*` tool would reappear on the wire on the
// first Composio reconcile, silently undoing the compression.
+ let agent_id = self.agent_definition_name.clone();
crate::openhuman::tools::toolpacks::strip_packed_from_visible(
&mut self.visible_tool_names,
+ &agent_id,
);
}