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
fix(inference): align local alias dispatch and extend readiness tests
Eloi Torrents114658ebe17f
diff --git a/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs b/crates/openhuman-core/src/flows/ops_agent_binding_tests.rsindex 4fdaa39ce4..a9d59b43d1 100644--- a/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs+++ b/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs@@ -645,3 +645,44 @@ async fn local_agent_flow_is_ready_without_openhuman_session() {"local flow must not need a session: {errors:?}");}++#[tokio::test]+async fn claude_agent_flow_readiness_does_not_require_an_openhuman_session() {+ let _inference = crate::inference::inference_test_guard();+ let _signed_out = crate::cron::scheduler_gate::SignedOutTestGuard::set(true);+ // Isolate the caller's session classification from CLI installation/auth+ // and provider availability. Layer 1 must still reject managed inference+ // even while the Layer 2 probe has an injected model.+ let _model =+ crate::inference::provider::factory::test_provider_override::install_model(Arc::new(+ tinyagents_harness::testkit::ScriptedModel::replies(vec!["OK"]),+ ));+ let g = graph(json!({+ "nodes": [+ { "id": "t", "kind": "trigger", "name": "Manual" },+ { "id": "a", "kind": "agent", "name": "Claude", "config": { "prompt": "test" } }+ ],+ "edges": [{ "from_node": "t", "to_node": "a" }]+ }));+ for provider in [+ "claude-code:test-model",+ "claude_agent_sdk:test-model",+ "openhuman",+ ] {+ let tmp = TempDir::new().unwrap();+ let mut config = test_config(&tmp);+ config.memory_provider = Some(provider.into());+ let errors = validate_inference_readiness(&config, &g).await;+ if provider == "openhuman" {+ assert!(+ errors.iter().any(|e| e.contains("signed out")),+ "{errors:?}"+ );+ } else {+ assert!(+ errors.is_empty(),+ "{provider} must not require a session: {errors:?}"+ );+ }+ }+}diff --git a/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs b/crates/openhuman-core/src/inference/provider/factory/local_runtime.rsindex 6e19b77cd4..2ad24412d6 100644--- a/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs+++ b/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs@@ -39,15 +39,15 @@ pub(super) fn try_create_local_runtime_chat_model_from_string() -> OptionalChatModelResult {use crate::inference::local::profile::{LOCAL_OPENAI_PROFILE, MLX_PROFILE, OMLX_PROFILE};- let p = provider.trim().to_string();- let is_local = p.starts_with(OLLAMA_PROVIDER_PREFIX)- || p.starts_with(LM_STUDIO_PROVIDER_PREFIX)- || p.starts_with(MLX_PROVIDER_PREFIX)- || p.starts_with(OMLX_PROVIDER_PREFIX)- || p.starts_with(LOCAL_OPENAI_PROVIDER_PREFIX);- if !is_local {- return None;- }+ // Use the same classifier as privacy and session policy. Canonicalize only+ // the provider prefix: model IDs (including tags and temperature suffixes)+ // remain case-sensitive and must reach the runtime unchanged.+ let kind = crate::inference::local::profile::kind_from_provider_string(provider)?;+ let model = provider+ .trim()+ .split_once(':')+ .map_or("", |(_, model)| model);+ let p = format!("{}:{model}", kind.as_str());// Preserve privacy policy; local runtime authentication does not depend on// an OpenHuman backend session.diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rsindex 6762abf92e..779f36a3d6 100644--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs@@ -705,3 +705,37 @@ async fn caller_owned_models_build_without_openhuman_session() {);}}++#[tokio::test]+async fn local_aliases_build_without_a_session_and_preserve_model_ids() {+ let _guard = crate::inference::inference_test_guard();+ let _signed_out = crate::cron::scheduler_gate::SignedOutTestGuard::set(true);+ let config = Config::default();+ for (prefix, canonical) in [+ ("OLLAMA", "ollama"),+ ("LMSTUDIO", "lmstudio"),+ ("lm-studio", "lmstudio"),+ ("lm_studio", "lmstudio"),+ ("MLX", "mlx"),+ ("OMLX", "omlx"),+ ("LOCAL-OPENAI", "local-openai"),+ ("local_openai", "local-openai"),+ ] {+ let provider = format!(" {prefix}:Publisher/Model:[email protected] ");+ let (chat, model) =+ create_chat_model_from_string_with_model_id("chat", &provider, &config, 0.0)+ .unwrap_or_else(|e| panic!("{provider}: {e}"));+ assert_eq!(model, "Publisher/Model:Tag");+ assert_eq!(+ chat.profile().and_then(|p| p.provider.as_deref()),+ Some(canonical)+ );+ }+ // A bare provider names a runtime but not a model. Report that actual+ // configuration problem instead of incorrectly asking for a session.+ let error = create_chat_model_from_string("chat", "ollama", &config, 0.0)+ .err()+ .expect("bare Ollama must require a model ID");+ assert!(error.to_string().contains("empty model"), "{error}");+ assert!(!error.to_string().contains("SESSION_EXPIRED"), "{error}");+}diff --git a/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs b/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rsindex 2db08de6dd..ad8eefd595 100644--- a/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs+++ b/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs@@ -19,7 +19,7 @@ Capability {domain: "local_ai",category: CapabilityCategory::LocalAI,description: "Select Ollama, LM Studio, MLX, oMLX, or a generic local OpenAI-compatible server. Local chat inference does not require an OpenHuman account.",- how_to: "Connections → API keys → LLM, or use provider strings: ollama:<model>, lmstudio:<model>, mlx:<model>, local-openai:<model>",+ how_to: "Connections → API keys → LLM, or use provider strings: ollama:<model>, lmstudio:<model>, mlx:<model>, omlx:<model>, local-openai:<model>",status: CapabilityStatus::Beta,privacy: None,},