The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(session_host): use runtime dedup_visible_tool_specs
Steven Enamakel28392fc74ca7
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rsindex 0658229d73..4c179f9b08 100644--- a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs@@ -1,6 +1,6 @@//! `SessionHostBuilder::build` — validates and assembles the final [`OpenHumanSessionHost`].-use super::{dedup_visible_tool_specs, visible_tool_specs_for_policy};+use super::visible_tool_specs_for_policy;use crate::agent::session_host::types::{OpenHumanSessionHost, SessionHostBuilder};use anyhow::Result;use std::sync::Arc;@@ -292,7 +292,7 @@ impl SessionHostBuilder {// accept duplicates, which hid this bug until #1710's per-role// routing started sending the same tool list to Anthropic.let visible_tool_specs: Vec<Arc<ToolSpec>> =- dedup_visible_tool_specs(visible_tool_specs_unfiltered);+ tinyagents_runtime::dedup_visible_tool_specs(visible_tool_specs_unfiltered);let visible_names_list: Vec<&str> =visible_tool_specs.iter().map(|s| s.name.as_str()).collect();diff --git a/crates/openhuman-core/src/agent/session_host/builder/mod.rs b/crates/openhuman-core/src/agent/session_host/builder/mod.rsindex 71e1b63485..e3a043f453 100644--- a/crates/openhuman-core/src/agent/session_host/builder/mod.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/mod.rs@@ -30,46 +30,6 @@ use tinyagents_definition::ToolScope;use tinytools::ToolPolicySession;use tinytools::{Tool, ToolSpec};-/// Drop entries with duplicate `name` fields, first occurrence wins.-///-/// Anthropic (and other strict providers) rejects a chat/completions-/// request that lists two tools with the same name — OpenHuman's own-/// backend and OpenAI silently accept duplicates, which hid the-/// underlying collision (a sub-agent's `delegate_name` shadowing a-/// same-named skill tool) until #1710's-/// per-role routing started sending the same tool list to Anthropic.-///-/// Called from every place that materialises the visible tool spec-/// list — initial build, post-composio refresh, scope-filter change —-/// so the request the provider sees is always name-unique regardless-/// of which path produced it.-///-/// Generic over the element type so the two carriers of a spec list share one-/// implementation: the main agent holds `Arc<ToolSpec>` (the three spec views-/// share their leaves), while the sub-agent assembly still materialises owned-/// `ToolSpec`s for the public `AgentTurnRequest`.-pub(crate) fn dedup_visible_tool_specs<S: std::borrow::Borrow<ToolSpec>>(specs: Vec<S>) -> Vec<S> {- let mut seen: std::collections::HashSet<String> = std::collections::HashSet::new();- let mut deduped: Vec<S> = Vec::with_capacity(specs.len());- let mut dropped: Vec<String> = Vec::new();- for spec in specs {- let name = spec.borrow().name.clone();- if seen.insert(name.clone()) {- deduped.push(spec);- } else {- dropped.push(name);- }- }- if !dropped.is_empty() {- log::warn!(- "[agent] dropped {} duplicate tool spec(s) before sending to provider: {:?}",- dropped.len(),- dropped- );- }- deduped-}-/// Drop every synthesised delegation tool whose name a durable tool already/// owns.///