Skip to content

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

fix(agent): only use_skill renders a pack listing

M3gA-Mind44fa6ef05e99
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
index a21b895cac..cf93ff9b7e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
@@ -12,7 +12,7 @@ use tinyagents_harness::middleware::{
DenialRenderer, MiddlewareToolOutcome, PolicyDecision, ToolCallPolicy, ToolHandler,
ToolMiddleware, ToolPolicyGateMiddleware,
};
-use tinyagents_harness_tools::skills::PackRegistryHandle;
+use tinyagents_harness_tools::skills::{PackRegistryHandle, USE_SKILL};
use tinyinference_llm::tool::ToolCall as TaToolCall;
use tinytools::ToolResult as TaToolResult;
@@ -261,10 +261,15 @@ impl ToolPolicyHostState {
/// has no idea who is calling it. Only the disclosure half is rendered here:
/// a call that names a `tool` is the execution half, which
/// `channel_permission_block` has already gated and the tool's own
- /// `execute` dispatches. Returns `None` when there is nothing to scope (a
- /// tool named, no `skill` argument, no pack handle), so the call falls
+ /// `execute` dispatches. Returns `None` when there is nothing to scope (not
+ /// `use_skill`, a tool named, no `skill` argument), so the call falls
/// through to the tool's own `execute` unchanged.
pub(crate) fn render_skill_for_session(&self, call: &TaToolCall) -> Option<TaToolResult> {
+ // Only `use_skill` discloses a pack. Another tool whose arguments carry
+ // a `skill` key (an MCP schema, a stray key) must run as itself.
+ if call.name != USE_SKILL {
+ return None;
+ }
if tinyagents_harness_tools::skills::named_tool(&call.arguments).is_some() {
return None;
}
@@ -335,7 +340,7 @@ impl ToolPolicyHostState {
// channel sitting under that ceiling, an invented name came back as
// `PermissionTooLow`: a permission denial for a tool that does not
// exist. Existence is not a policy question (#6302).
- if call.name == "use_skill" {
+ if call.name == USE_SKILL {
if let Some(inner_tool) = call
.arguments
.get("tool")
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_policy_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_policy_tests.rs
index 212e7308f8..70eae6c36a 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_policy_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_policy_tests.rs
@@ -523,3 +523,16 @@ fn a_pack_member_this_session_never_registered_is_not_found_not_forbidden() {
"absence must not read as a permission denial: {message}"
);
}
+
+/// Only `use_skill` renders a pack listing. Any other registered tool whose
+/// arguments carry a string `skill` (an MCP schema, a stray key) must fall
+/// through to its own `execute`.
+#[tokio::test]
+async fn a_non_use_skill_call_with_a_skill_argument_is_not_rendered_as_a_listing() {
+ let mw = non_owner_middleware();
+ assert!(
+ mw.render_skill_for_session(&call("build_workflow", json!({ "skill": "workflows" })))
+ .is_none(),
+ "build_workflow was answered with a pack listing instead of executing"
+ );
+}