Skip to content

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

test(channels): replace sign-out cancellation test with invalid model cache test

Steven Enamakel6120a661513e
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index c49a53fd66..0fb83181d2 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -402,51 +402,18 @@ async fn sign_out_cancels_remote_invalidation_while_it_waits_for_the_session_tab
#[cfg(feature = "modules")]
#[tokio::test]
-async fn sign_out_cancels_remote_invalidation_while_it_waits_for_the_session_table() {
- let core_context =
- crate::core::runtime::CoreContext::for_test(crate::core::runtime::DomainSet::full(), None);
- let expected_core_context = Arc::clone(&core_context);
- crate::core::runtime::CoreContext::scope(core_context, async {
- let guard = crate::web_chat::lock_thread_sessions_for_test(
- &crate::core::runtime::DispatchCtx::ambient(),
- )
- .await;
- let cancellation = tokio_util::sync::CancellationToken::new();
- let callback = RouteCallbacks::new(
- runtime_context(PathBuf::from("/tmp/channel-callback")),
- cancellation.clone(),
- );
- assert!(Arc::ptr_eq(
- callback.core_context.as_ref().unwrap(),
- &expected_core_context
- ));
- assert_eq!(callback.tenant, crate::core::runtime::Tenant::default());
-
- let request = tinychannels_bus::ChannelBackendRequest::RemoteControl(
- tinychannels_bus::module_remote::RemoteHostRequest::InvalidateThread {
- thread_id: "sign-out-in-flight".into(),
- },
- );
- let mut operation = Box::pin(callback.dispatch_controller_backend(request));
- let waker = Waker::noop().clone();
- let mut task_context = Context::from_waker(&waker);
-
- assert!(
- matches!(operation.as_mut().poll(&mut task_context), Poll::Pending),
- "the callback should be waiting on the locked session table"
- );
- cancellation.cancel();
- assert!(
- matches!(
- operation.as_mut().poll(&mut task_context),
- Poll::Ready(Err(_))
- ),
- "sign-out must cancel the callback before it can mutate session state"
- );
+async fn load_cached_model_preview_returns_empty_when_cache_json_is_invalid() {
+ let tempdir = tempfile::tempdir().unwrap();
+ let state_dir = tempdir.path().join("state");
+ std::fs::create_dir_all(&state_dir).unwrap();
+ std::fs::write(
+ state_dir.join("models_cache.json"),
+ "{ definitely invalid json",
+ )
+ .unwrap();
- drop(guard);
- })
- .await;
+ let response = module_route_help_response(tempdir.path(), "/model", Vec::new()).await;
+ assert!(response.contains("Model catalog is unavailable in this channel for `openai`"));
}
#[tokio::test]