Skip to content

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

fix(config): remove duplicate search tool schema file

Steven Enamakelbcc35e4d0e2a
diff --git a/crates/openhuman-core/src/config/schema/tools/search.rs b/crates/openhuman-core/src/config/schema/tools/search.rs
index ff476bb560..1f99f724b9 100644
--- a/crates/openhuman-core/src/config/schema/tools/search.rs
+++ b/crates/openhuman-core/src/config/schema/tools/search.rs
@@ -129,9 +129,17 @@ impl Default for WebSearchConfig {
// execution lives in the TinySearch module; this file only owns the settings
// and the one-time migration from the single-engine format.
-/// Settings format written by this build. Files without the field (or with a
-/// lower value) carry the legacy single-engine fields and are migrated on load.
-pub const SEARCH_SCHEMA_VERSION: u32 = 2;
+/// Settings format written by this build, migrated on load:
+/// - absent/0–1: the legacy single-engine fields → providers, routes, roles;
+/// - 2: `presentation = "all_tools"` → `roles`. The v2 migration used to force
+/// `all_tools` on every upgraded file, which hides the routed
+/// `web_*_tool`s that agent tool scopes name, so those agents lost web
+/// search. v3 moves them back to the routed tools once; a later explicit
+/// choice is saved as v3 and kept.
+pub const SEARCH_SCHEMA_VERSION: u32 = 3;
+
+/// First format with providers, routes and roles.
+pub(crate) const SEARCH_SCHEMA_PROVIDERS: u32 = 2;
pub const SEARCH_ROLE_SEARCH: &str = "search";
pub const SEARCH_ROLE_ANSWER: &str = "answer";
diff --git a/crates/openhuman-core/src/config/schema/tools/search_migrate.rs b/crates/openhuman-core/src/config/schema/tools/search_migrate.rs
index 9cc024c291..6c64562183 100644
--- a/crates/openhuman-core/src/config/schema/tools/search_migrate.rs
+++ b/crates/openhuman-core/src/config/schema/tools/search_migrate.rs
@@ -1,5 +1,6 @@
-//! One-time migration from the single-engine `[search]` format to providers,
-//! routes and roles.
+//! One-time migrations of the `[search]` section: the single-engine format to
+//! providers, routes and roles (v2), then the routed role tools as the
+//! presentation for files v2 had moved to `all_tools` (v3).
use std::collections::BTreeMap;
@@ -7,17 +8,48 @@ use super::{
LegacySearchInputs, SearchConfig, SearchProviderSettings, SearchRoute, SEARCH_ENGINE_BRAVE,
SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL,
SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLE_SEARCH,
- SEARCH_SCHEMA_VERSION,
+ SEARCH_SCHEMA_PROVIDERS, SEARCH_SCHEMA_VERSION,
};
impl SearchConfig {
- /// Whether this file still carries the single-engine format.
+ /// Whether this file was written by an older settings format.
pub fn needs_migration(&self) -> bool {
self.schema_version < SEARCH_SCHEMA_VERSION
}
- /// Convert the single-engine format into providers, routes and roles.
+ /// Bring an older `[search]` section up to [`SEARCH_SCHEMA_VERSION`].
/// Idempotent: returns `false` and changes nothing on a current file.
+ pub fn migrate_legacy(&mut self, legacy: LegacySearchInputs) -> bool {
+ if !self.needs_migration() {
+ return false;
+ }
+ if self.schema_version < SEARCH_SCHEMA_PROVIDERS {
+ self.migrate_single_engine(legacy);
+ }
+ self.migrate_presentation_to_roles();
+ self.schema_version = SEARCH_SCHEMA_VERSION;
+ true
+ }
+
+ /// v2 → v3: put `all_tools` files back on the routed role tools.
+ ///
+ /// Agent tool scopes (orchestrator, researcher, planner, …) allowlist
+ /// `web_search_tool` / `web_answer_tool` / `web_contents_tool`. Under
+ /// `all_tools` TinySearch advertises only provider tools (`exa_search`,
+ /// …), so those agents had no web search at all and called the missing
+ /// routed names until the turn aborted. Router and one-provider choices
+ /// were never forced by a migration, so they are left alone.
+ fn migrate_presentation_to_roles(&mut self) {
+ if self.presentation == super::SearchPresentation::AllTools {
+ tracing::info!(
+ "[config][migrate][search] presentation all_tools -> roles (routed web tools)"
+ );
+ self.presentation = super::SearchPresentation::Roles;
+ }
+ }
+
+ /// v0/1 → v2: convert the single-engine format into providers, routes and
+ /// roles.
///
/// Managed selections map to managed Exa (search, contents) plus managed
/// Gemini (answer) regardless of whether a session exists right now; the
@@ -25,10 +57,7 @@ impl SearchConfig {
/// Parallel stays as a bring-your-own-key provider. Only managed
/// (backend-routed) Parallel is gone: a selection that relied on it
/// without a key is dropped, and Exa and Gemini cover those roles.
- pub fn migrate_legacy(&mut self, legacy: LegacySearchInputs) -> bool {
- if !self.needs_migration() {
- return false;
- }
+ fn migrate_single_engine(&mut self, legacy: LegacySearchInputs) {
let engine = self
.engine
.as_deref()
@@ -191,17 +220,13 @@ impl SearchConfig {
{
self.presentation_provider = None;
}
- // `roles` did not exist in the legacy presentation vocabulary; its
- // serde default means the old file omitted the field. Preserve the
- // legacy default while fresh configs use Roles.
- if self.presentation == super::SearchPresentation::Roles {
- self.presentation = super::SearchPresentation::AllTools;
- }
+ // A legacy file that omitted `presentation` gets the routed role
+ // tools like a fresh one; an explicit legacy choice is kept (and
+ // `all_tools` then goes through the v3 step).
self.engine = None;
self.parallel_route = None;
self.gemini_route = None;
- self.schema_version = SEARCH_SCHEMA_VERSION;
- true
+ self.schema_version = SEARCH_SCHEMA_PROVIDERS;
}
/// Apply a legacy single-engine selection (`SEARCH_ENGINE`, or an older