Skip to content

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

Merge origin/main into profile-direct-providers

Steven Enamakel733d55fb944a
diff --cc crates/openhuman-core/src/modules/search/mod.rs
index 1ce6a1e0fe,7778394909..43f55846d3
--- a/crates/openhuman-core/src/modules/search/mod.rs
+++ b/crates/openhuman-core/src/modules/search/mod.rs
@@@ -50,10 -62,11 +62,12 @@@ fn direct_settings(config: &Config, pro
settings.default_language = Some(config.searxng.default_language.clone());
}
other => {
- settings.base_url = search.credentials(other).and_then(|c| c.base_url.clone());
- settings.credential = search
- .credentials(other)
- .and_then(|c| c.key())
+ // A key pinned on this agent's config wins over the stored one.
+ settings.credential = search.direct_key(other).map(str::to_owned);
+ settings.base_url = search
+ .host_credential(other)
+ .and_then(|pinned| pinned.base_url())
++ .or_else(|| search.credentials(other).and_then(|c| c.base_url.as_deref()))
.map(str::to_owned);
}
}
diff --cc crates/openhuman-core/src/modules/search/proxy.rs
index 04c63599ed,140a1d7e55..5492f758de
--- a/crates/openhuman-core/src/modules/search/proxy.rs
+++ b/crates/openhuman-core/src/modules/search/proxy.rs
@@@ -139,15 -164,20 +164,28 @@@ wher
result
}
+ /// The config a search call runs under.
+ ///
+ /// A config carrying host-pinned search credentials
+ /// ([`crate::config::SearchConfig::pin_host_credential`]) is authoritative:
+ /// it is one agent's in-memory config, its keys exist nowhere else, and a
+ /// reload of the shared `config_path` would drop them. Any other config is
+ /// reloaded so a settings or login change is honoured on the next call.
async fn current_config(config: &Config) -> Result<Config, String> {
+ if config.profile_providers.is_some() {
+ let context = crate::core::runtime::CoreContext::scoped()
+ .ok_or_else(|| "profile search requires its authenticated context".to_owned())?;
+ let current = context.embedder_config().filter(|current| current.config_path == config.config_path)
+ .filter(|_| context.profile().is_some())
+ .ok_or_else(|| "profile search configuration belongs to another context".to_owned())?;
+ return Ok(current.clone());
+ }
+ if config.search.is_host_pinned() {
+ tracing::debug!(
+ "[modules][search] host-pinned search credentials; using the agent's config"
+ );
+ return Ok(config.clone());
+ }
crate::config::ops::reload_config_from_paths(&config.config_path, &config.workspace_dir).await
}