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
test(embed): cover routed provider effectiveness for discovered builds
Steven Enamakel49849cd41bf5
diff --git a/crates/openhuman-embed/src/runtime/build.rs b/crates/openhuman-embed/src/runtime/build.rsindex 333ac0ba00..b301f1749e 100644--- a/crates/openhuman-embed/src/runtime/build.rs+++ b/crates/openhuman-embed/src/runtime/build.rs@@ -319,7 +319,7 @@ async fn discovered_base_config() -> (Config, Option<String>) {/// [`ConfigSource::Discovered`] build has no config yet (`None`), but the/// provider is applied to the agents' base config after boot, so it is judged/// by the model it carries itself.-pub(super) fn routed_provider_effective(provider: &Provider, config: Option<&Config>) -> bool {+pub(crate) fn routed_provider_effective(provider: &Provider, config: Option<&Config>) -> bool {provider.has_usable_route()&& match config {Some(config) => config.default_model.as_deref(),diff --git a/crates/openhuman-embed/src/runtime/builder.rs b/crates/openhuman-embed/src/runtime/builder.rsindex 964f734b49..e8d2c34d86 100644--- a/crates/openhuman-embed/src/runtime/builder.rs+++ b/crates/openhuman-embed/src/runtime/builder.rs@@ -30,7 +30,7 @@ use crate::Session;// the default triples through this module.pub(crate) use super::build::apply_provider;#[cfg(test)]-pub(crate) use super::build::effective_host_kind;+pub(crate) use super::build::{effective_host_kind, routed_provider_effective};#[cfg(test)]pub(crate) use super::presets::{default_domains, default_services};#[cfg(test)]diff --git a/crates/openhuman-embed/src/runtime/builder_tests.rs b/crates/openhuman-embed/src/runtime/builder_tests.rsindex f891247304..e2a613ac05 100644--- a/crates/openhuman-embed/src/runtime/builder_tests.rs+++ b/crates/openhuman-embed/src/runtime/builder_tests.rs@@ -30,6 +30,27 @@ fn inherited_workspace_without_a_host_credential_keeps_installed_session_policy();}+#[test]+fn a_discovered_build_judges_the_route_by_the_provider_model() {+ let routed = Provider::openai_compatible("https://llm.example", "sk-test");+ // Discovered: no config yet, so the provider's own model decides.+ assert!(routed_provider_effective(+ &routed.clone().model("gpt-test"),+ None+ ));+ assert!(!routed_provider_effective(&routed, None));+ assert!(!routed_provider_effective(+ &Provider::inherit().model("gpt-test"),+ None+ ));+ // Resolved: the assembled config's model decides.+ let mut config = openhuman_core::config::Config::default();+ config.default_model = Some("gpt-test".into());+ assert!(routed_provider_effective(&routed, Some(&config)));+ config.default_model = Some(" ".into());+ assert!(!routed_provider_effective(&routed, Some(&config)));+}+#[test]fn default_services_start_no_background_writers() {// cron, the login-gated services and memory sync each write to the workspace on their