Skip to content

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

test(inference): cover embedding without a backend session

Steven Enamakel019fce826527
diff --git a/crates/openhuman-tinyhumans/src/inference/managed_embedding_tests.rs b/crates/openhuman-tinyhumans/src/inference/managed_embedding_tests.rs
index 4b88152525..17d2ba23a6 100644
--- a/crates/openhuman-tinyhumans/src/inference/managed_embedding_tests.rs
+++ b/crates/openhuman-tinyhumans/src/inference/managed_embedding_tests.rs
@@ -394,3 +394,17 @@ async fn default_provider_with_config_authenticates_with_config_scoped_token() {
);
}
+
+/// With no stored `app-session` token and no API key, the bearer resolver
+/// short-circuits to the backend-session error before any network call.
+#[tokio::test]
+async fn embedding_without_a_session_reports_no_backend_session() {
+ let tmp = tempfile::TempDir::new().unwrap();
+ let config = test_config(&tmp);
+ let provider = build_through_registry(&config, "voyage-3-large", 3);
+ let err = provider
+ .embed(&["hello".to_string()])
+ .await
+ .expect_err("no session must not embed");
+ assert!(err.to_string().contains("No backend session"), "{err}");
+}