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(embedding_host): cover embedding failures in connection test payload
Steven Enamakel41df1b9a2af2
diff --git a/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs b/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rsindex 1cd1cd0d73..67fd5d86d4 100644--- a/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs+++ b/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs@@ -7,9 +7,7 @@ use super::{resolve_api_key, LOG_PREFIX};use crate::inference::embedding_host::factory::{create_embedding_provider_with_config, credential_resolver, managed_factory, settings,};-use tinyinference_embeddings::verify::{- ConnectionTestError, test_embedding_connection_detailed,-};+use tinyinference_embeddings::verify::{test_embedding_connection_detailed, ConnectionTestError};use tinyinference_providers::route::split_custom_provider;/// Generates embeddings for the given input texts using the currentlydiff --git a/crates/openhuman-core/src/inference/embedding_host/rpc_tests.rs b/crates/openhuman-core/src/inference/embedding_host/rpc_tests.rsindex feecb9aa3e..e3d6aa46f9 100644--- a/crates/openhuman-core/src/inference/embedding_host/rpc_tests.rs+++ b/crates/openhuman-core/src/inference/embedding_host/rpc_tests.rs@@ -231,17 +231,41 @@ async fn test_connection_returns_model_construction_failures_as_rpc_errors() {let mut config = Config::default();config.config_path = tmp.path().join("config.toml");- let error = test_connection(- &config,- Some("not-a-provider"),- Some("model"),- Some(4),- )- .await- .expect_err("invalid provider construction must remain an RPC error");+ let error = test_connection(&config, Some("not-a-provider"), Some("model"), Some(4))+ .await+ .expect_err("invalid provider construction must remain an RPC error");assert!(error.contains("unknown embedding provider"), "{error}");}+#[tokio::test]+async fn test_connection_reports_embedding_failures_in_the_failure_payload() {+ use axum::{http::StatusCode, routing::post, Router};++ let app = Router::new().route(+ "/api/embed",+ post(|| async { (StatusCode::INTERNAL_SERVER_ERROR, "embedding unavailable") }),+ );+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();+ let base_url = format!("http://{}", listener.local_addr().unwrap());+ let server = tokio::spawn(async move { axum::serve(listener, app).await.unwrap() });++ let _guard = crate::inference::inference_test_guard_async().await;+ let tmp = TempDir::new().unwrap();+ let mut config = Config::default();+ config.config_path = tmp.path().join("config.toml");+ config.local_ai.base_url = Some(base_url);++ let outcome = test_connection(&config, Some("ollama"), Some("model"), Some(4))+ .await+ .expect("model construction succeeded, so the failure stays in the outcome");+ assert_eq!(outcome.value["success"], false);+ assert!(outcome.value["error"]+ .as_str()+ .unwrap()+ .contains("embedding"));+ server.abort();+}+/// Live `embed` (RPC) for managed also routes through the config-aware/// factory; with no session it surfaces the same backend-session error.#[tokio::test]