Skip to content

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

fix(agent): apply packed-tool filtering to newly synthesized tool names

Steven Enamakelad4ee42d828d
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs
index a4cfe66029..7a72730f69 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs
@@ -14,7 +14,6 @@ fn reconcile_surface_names(
discovery_deferred: Option<std::collections::HashSet<String>>,
strip_packed: impl FnOnce(&mut std::collections::HashSet<String>),
) {
- strip_packed(visible);
if let Some(names) = &discovery_deferred {
visible.retain(|name| !names.contains(name));
*deferred = names.clone();
@@ -25,6 +24,12 @@ fn reconcile_surface_names(
permanent: std::mem::take(permanent),
};
managed.refresh_synthesized(previous_synthesized, synthesized, auto_include_new);
+ // New wildcard-synthesized names must participate in packed-tool
+ // filtering so a withheld name can add its `use_skill` route. Restore
+ // permanent names afterward, preserving their precedence over both
+ // packed and deferred visibility filters.
+ strip_packed(&mut managed.visible);
+ managed.make_permanent(std::iter::empty::<String>());
if let Some(names) = &discovery_deferred {
managed.defer_visible(names);
}
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface_tests.rs
index baa8436eae..1c7bbb6870 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface_tests.rs
@@ -47,3 +47,30 @@ fn permanent_tools_survive_packed_and_deferred_filters_but_revocation_wins() {
assert!(deferred.contains("ordinary"));
assert!(!permanent.contains("revoked_permanent"));
}
+
+#[test]
+fn newly_synthesized_packed_tool_keeps_its_use_skill_route_visible() {
+ let mut visible = std::collections::HashSet::new();
+ let mut deferred = std::collections::HashSet::new();
+ let mut permanent = std::collections::HashSet::new();
+ let previous = std::collections::HashSet::new();
+ let next = ["packed_delegate".to_string()].into_iter().collect();
+
+ reconcile_surface_names(
+ &mut visible,
+ &mut deferred,
+ &mut permanent,
+ &previous,
+ &next,
+ true,
+ None,
+ |visible| {
+ if visible.remove("packed_delegate") {
+ visible.insert("use_skill".to_string());
+ }
+ },
+ );
+
+ assert!(visible.contains("use_skill"));
+ assert!(!visible.contains("packed_delegate"));
+}