Skip to content

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

fix: authorize synthesized delegation routes

Steven Enamakel796f47b3b3a6
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index 71e7f0953e..c053909699 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -619,29 +619,13 @@ impl OpenHumanSessionHost {
ToolScope::Named(names) => {
let mut set: std::collections::HashSet<String> =
names.iter().cloned().collect();
- // Only the *advertised* ones. A synthesised tool that
- // reports `ToolExposure::Hidden` is a member of a
- // collapsed tool — today every `ArchetypeDelegationTool`,
- // whose family the single `delegate_to` tool now stands
- // for. Inserting it here would put it back on the wire
- // beside the tool that replaced it, shipping both
- // surfaces and saving nothing.
- //
- // This is not the same judgement as
- // `strip_deferred_from_visible`, which deliberately
- // leaves a hand-written `[tools] named` belt alone. That
- // restraint is about not second-guessing a human's
- // choice; these names were never chosen by a human, they
- // are inserted right here. Hiding one removes nothing an
- // author asked for.
- //
- // The tool stays in `synthed`, so it stays registered
- // and dispatchable for a replayed transcript or a saved
- // skill that names it — exactly like a packed tool.
+ // These are the per-specialist delegation routes the
+ // collector actually synthesizes today. Do not infer a
+ // collapsed replacement from `ToolExposure::Hidden`:
+ // `CollapsedDelegationTool` is not constructed here,
+ // so filtering these names would leave the orchestrator
+ // with no executable hand-off route (#6370).
for t in &synthed {
- if t.exposure() == tinytools::ToolExposure::Hidden {
- continue;
- }
set.insert(t.name().to_string());
}
// `named = []` means zero tools. An empty set here is
@@ -739,7 +723,6 @@ impl OpenHumanSessionHost {
Some(set) => set,
None => delegation_tools
.iter()
- .filter(|t| t.exposure() != tinytools::ToolExposure::Hidden)
.map(|t| t.name().to_string())
.collect(),
};
@@ -760,12 +743,7 @@ impl OpenHumanSessionHost {
visible = tools
.iter()
.map(|t| t.name().to_string())
- .chain(
- delegation_tools
- .iter()
- .filter(|t| t.exposure() != tinytools::ToolExposure::Hidden)
- .map(|t| t.name().to_string()),
- )
+ .chain(delegation_tools.iter().map(|t| t.name().to_string()))
.filter(|name| !definition_disallows_tool(&def.disallowed_tools, name))
.collect();
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs b/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs
index 04d5159569..b0e6a01e85 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs
@@ -131,10 +131,20 @@ impl OpenHumanHostBundleFactory {
.map(|tool| tool.name().to_string())
.collect(),
);
+ let session_delegation_tools = Arc::new(
+ inputs
+ .tool_sets
+ .iter()
+ .skip(1)
+ .flat_map(|set| set.iter())
+ .map(|tool| tool.name().to_string())
+ .collect(),
+ );
let definitions = Arc::new(
OpenHumanDefinitionRegistry::new(inputs.definitions)
.with_config(Arc::clone(&inputs.config))
- .with_registered_tools(registered_tools),
+ .with_registered_tools(registered_tools)
+ .with_session_delegation_tools(session_delegation_tools),
);
let mut security = OpenHumanSecurityGate::new(inputs.security_policy, inputs.tool_sets);
if let Some(policy) = inputs.tool_policy {
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
index e854036dce..2050d2fef9 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
@@ -139,6 +139,10 @@ pub struct OpenHumanDefinitionRegistry {
/// non-empty cannot be projected faithfully and [`Self::tools_for`] fails
/// closed rather than re-granting the denied tools.
registered_tools: Option<Arc<Vec<String>>>,
+ /// Per-invocation direct delegation routes synthesized beside the durable
+ /// tool registry. They must augment a named root scope so the hosted loop
+ /// authorizes the same hand-off routes it advertises.
+ session_delegation_tools: Option<Arc<Vec<String>>>,
}
/// Outcome of resolving a definition's own scope.
@@ -161,6 +165,7 @@ impl OpenHumanDefinitionRegistry {
registry: RegistryHandle::Shared(registry),
config: None,
registered_tools: None,
+ session_delegation_tools: None,
}
}
@@ -175,6 +180,7 @@ impl OpenHumanDefinitionRegistry {
registry: RegistryHandle::Global(registry),
config: None,
registered_tools: None,
+ session_delegation_tools: None,
})
}
@@ -201,6 +207,12 @@ impl OpenHumanDefinitionRegistry {
self
}
+ /// Attaches the root invocation's synthesized direct-delegation names.
+ pub fn with_session_delegation_tools(mut self, tools: Arc<Vec<String>>) -> Self {
+ self.session_delegation_tools = Some(tools);
+ self
+ }
+
/// Resolves `id` to a **host** definition: harness registry first, then the
/// enabled custom-agent config fallback.
///
@@ -277,6 +289,9 @@ impl OpenHumanDefinitionRegistry {
match &def.tools {
ToolScope::Named(named) => {
let mut names = named.clone();
+ if let Some(delegation_tools) = self.session_delegation_tools.as_deref() {
+ names.extend(delegation_tools.iter().cloned());
+ }
// `extra_tools` is an "also include these" hook on top of a
// named scope. Under `Wildcard` it is meaningless — everything
// is already in scope.