Skip to content

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

feat(search): migrate TinyFish to own-key-only model

Steven Enamakel9a4aa0252dbe
diff --git a/crates/openhuman-core/src/config/schema/load/migrate.rs b/crates/openhuman-core/src/config/schema/load/migrate.rs
index 8b66f7e11c..6a044feff5 100644
--- a/crates/openhuman-core/src/config/schema/load/migrate.rs
+++ b/crates/openhuman-core/src/config/schema/load/migrate.rs
@@ -211,6 +211,7 @@ pub(crate) fn migrate_search_settings(config: &mut Config) {
.as_deref()
.is_some_and(|key| !key.trim().is_empty()),
searxng_active: config.searxng.enabled,
+ tinyfish_api_key: config.integrations.tinyfish.api_key.clone(),
};
config.search.migrate_legacy(legacy);
}
diff --git a/crates/openhuman-core/src/config/schema/tools/search.rs b/crates/openhuman-core/src/config/schema/tools/search.rs
index 92ba016c78..a9fdbd31df 100644
--- a/crates/openhuman-core/src/config/schema/tools/search.rs
+++ b/crates/openhuman-core/src/config/schema/tools/search.rs
@@ -135,7 +135,9 @@ impl Default for WebSearchConfig {
/// `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.
+/// choice is saved as v3 and kept. v3 also makes TinyFish own-key: the
+/// backend never proxied it, so a managed TinyFish is turned off unless a
+/// key is available.
pub const SEARCH_SCHEMA_VERSION: u32 = 3;
/// First format with providers, routes and roles.
@@ -417,6 +419,9 @@ pub struct LegacySearchInputs {
pub seltz_active: bool,
/// `searxng.enabled`.
pub searxng_active: bool,
+ /// The key the legacy `integrations.tinyfish` toggle held, if any. TinyFish
+ /// is own-key only now; this seeds `search.tinyfish` when it has none.
+ pub tinyfish_api_key: Option<String>,
}
impl SearchConfig {
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 6c64562183..c29bddf627 100644
--- a/crates/openhuman-core/src/config/schema/tools/search_migrate.rs
+++ b/crates/openhuman-core/src/config/schema/tools/search_migrate.rs
@@ -23,14 +23,39 @@ impl SearchConfig {
if !self.needs_migration() {
return false;
}
+ let legacy_tinyfish_key = legacy.tinyfish_api_key.clone();
if self.schema_version < SEARCH_SCHEMA_PROVIDERS {
self.migrate_single_engine(legacy);
}
self.migrate_presentation_to_roles();
+ self.migrate_tinyfish_to_own_key(legacy_tinyfish_key);
self.schema_version = SEARCH_SCHEMA_VERSION;
true
}
+ /// v2 → v3: TinyFish is own-key only (the TinyHumans backend never
+ /// proxied it, so every managed TinyFish call failed). Seed its key from
+ /// the legacy integration toggle when there is one, and turn it off when
+ /// there is no key, so it waits in "With your own key" instead of sitting
+ /// in the connected list as "Needs API key".
+ fn migrate_tinyfish_to_own_key(&mut self, legacy_key: Option<String>) {
+ if !self.tinyfish.has_key() {
+ if let Some(key) = legacy_key.filter(|k| !k.trim().is_empty()) {
+ self.tinyfish.api_key = Some(key);
+ }
+ }
+ let has_key = self.tinyfish.has_key();
+ if let Some(settings) = self.providers.get_mut("tinyfish") {
+ settings.route = SearchRoute::Direct;
+ if settings.enabled && !has_key {
+ tracing::info!(
+ "[config][migrate][search] TinyFish needs your own key now; turned it off"
+ );
+ settings.enabled = false;
+ }
+ }
+ }
+
/// v2 → v3: put `all_tools` files back on the routed role tools.
///
/// Agent tool scopes (orchestrator, researcher, planner, …) allowlist