Skip to content

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

test: add unit tests for composio triggers, oauth credentials, and voice

Steven Enamakel1d9ff709e1b3
diff --git a/crates/openhuman-core/src/integrations/composio/trigger_history_tests.rs b/crates/openhuman-core/src/integrations/composio/trigger_history_tests.rs
index 419651b706..8fd509e52f 100644
--- a/crates/openhuman-core/src/integrations/composio/trigger_history_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/trigger_history_tests.rs
@@ -23,7 +23,7 @@ async fn disabled_archive_operations_leave_the_host_filesystem_untouched() {
.contains("module unavailable"));
assert!(!workspace.path().join("state").exists());
assert!(owner.lease.lock().await.is_none());
- owner.close().await.unwrap();
+ owner.close(&crate::core::runtime::DispatchCtx::default()).await.unwrap();
}
#[cfg(feature = "modules")]
@@ -133,8 +133,8 @@ async fn changing_users_releases_the_old_archive_before_opening_the_next_scope()
)
.await
.unwrap();
- owner.close().await.unwrap();
- owner.close().await.unwrap();
+ owner.close(&crate::core::runtime::DispatchCtx::default()).await.unwrap();
+ owner.close(&crate::core::runtime::DispatchCtx::default()).await.unwrap();
assert_eq!(
*calls.lock().await,
vec![
@@ -176,7 +176,7 @@ async fn cancelling_a_pending_open_retains_a_handle_that_shutdown_can_release()
opening.abort();
assert!(opening.await.unwrap_err().is_cancelled());
observed.open_continue.notify_one();
- owner.close().await.unwrap();
+ owner.close(&crate::core::runtime::DispatchCtx::default()).await.unwrap();
assert_eq!(
*observed.calls.lock().await,
vec!["open:cancelled/state", "close:cancelled/state"]
diff --git a/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs b/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs
index f58061dd03..86ad4fc6c4 100644
--- a/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs
@@ -507,7 +507,7 @@ async fn start_credential_gated_services_completes_with_all_services_disabled()
// immediately; the generous ceiling only guards against a deadlock.
tokio::time::timeout(
std::time::Duration::from_secs(30),
- start_credential_gated_services(&config),
+ start_credential_gated_services(&crate::core::runtime::DispatchCtx::default(), &config),
)
.await
.expect("start_credential_gated_services must return, not block");
diff --git a/crates/openhuman-core/src/voice/always_on_tests.rs b/crates/openhuman-core/src/voice/always_on_tests.rs
index 8e6a84a2b5..480b1436b2 100644
--- a/crates/openhuman-core/src/voice/always_on_tests.rs
+++ b/crates/openhuman-core/src/voice/always_on_tests.rs
@@ -65,6 +65,6 @@ async fn voice_component_off_keeps_always_on_down_even_when_enabled() {
let mut config = crate::config::Config::default();
config.voice_server.always_on_enabled = true;
config.components.voice = false;
- start_if_enabled(&config).await;
+ start_if_enabled(&crate::core::runtime::DispatchCtx::default(), &config).await;
assert!(!ENABLED.load(Ordering::SeqCst));
}
diff --git a/crates/openhuman-core/src/voice/dictation_listener_tests.rs b/crates/openhuman-core/src/voice/dictation_listener_tests.rs
index 7bdbc4b565..7569f1856b 100644
--- a/crates/openhuman-core/src/voice/dictation_listener_tests.rs
+++ b/crates/openhuman-core/src/voice/dictation_listener_tests.rs
@@ -74,7 +74,7 @@ async fn start_if_enabled_returns_early_when_config_disabled() {
// Fast path — `enabled=false` → the fn returns without spawning.
let mut config = Config::default();
config.dictation.enabled = false;
- start_if_enabled(&config).await;
+ start_if_enabled(&crate::core::runtime::DispatchCtx::default(), &config).await;
// No panic = pass. The absence of a spawned hotkey task is what
// we're verifying; hard to assert directly without internals.
}
@@ -84,7 +84,7 @@ async fn start_if_enabled_returns_early_when_hotkey_empty() {
let mut config = Config::default();
config.dictation.enabled = true;
config.dictation.hotkey = String::new();
- start_if_enabled(&config).await;
+ start_if_enabled(&crate::core::runtime::DispatchCtx::default(), &config).await;
}
#[tokio::test]
@@ -92,7 +92,7 @@ async fn start_if_enabled_returns_early_when_hotkey_unparseable() {
let mut config = Config::default();
config.dictation.enabled = true;
config.dictation.hotkey = "not a real hotkey".into();
- start_if_enabled(&config).await;
+ start_if_enabled(&crate::core::runtime::DispatchCtx::default(), &config).await;
}
// On macOS the rdev listener must never start — TSMGetInputSourceProperty
@@ -105,7 +105,7 @@ async fn start_if_enabled_is_noop_on_macos_with_valid_hotkey() {
config.dictation.enabled = true;
config.dictation.hotkey = "ctrl+space".into();
// Must return without panicking or spawning the rdev listener.
- start_if_enabled(&config).await;
+ start_if_enabled(&crate::core::runtime::DispatchCtx::default(), &config).await;
// No rdev thread was started: the global handle remains None.
let guard = LISTENER_HANDLE.lock().expect("lock");
assert!(
@@ -120,7 +120,7 @@ async fn start_if_enabled_is_noop_on_macos_with_fn_hotkey() {
let mut config = Config::default();
config.dictation.enabled = true;
config.dictation.hotkey = "fn".into();
- start_if_enabled(&config).await;
+ start_if_enabled(&crate::core::runtime::DispatchCtx::default(), &config).await;
let guard = LISTENER_HANDLE.lock().expect("lock");
assert!(
guard.is_none(),
@@ -156,7 +156,7 @@ async fn voice_component_off_overrides_dictation_enabled() {
config.dictation.enabled = true;
config.dictation.hotkey = "ctrl+space".into();
config.components.voice = false;
- start_if_enabled(&config).await;
+ start_if_enabled(&crate::core::runtime::DispatchCtx::default(), &config).await;
assert!(
LISTENER_HANDLE.lock().expect("lock").is_none(),
"no hotkey listener while [components].voice is off"
diff --git a/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs b/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs
index 9a5721e65f..72ce731e65 100644
--- a/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs
+++ b/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs
@@ -227,7 +227,7 @@ async fn listener_fixture() -> (
async fn cancelling_startup_still_closes_the_module_owned_listener_fixture() {
let (client, fixture, _service) = listener_fixture().await;
let startup = tokio::spawn(async move {
- start_globe_with_client(client, Push, &CancellationToken::new()).await
+ start_globe_with_client(&crate::core::runtime::DispatchCtx::default(), client, Push, &CancellationToken::new()).await
});
fixture.entered.notified().await;
startup.abort();
@@ -246,7 +246,7 @@ async fn cancelling_startup_still_closes_the_module_owned_listener_fixture() {
async fn stopping_listener_joins_its_bus_cleanup_fixture() {
let (client, fixture, _service) = listener_fixture().await;
fixture.allow_start.notify_one();
- let (handle, _rx) = start_globe_with_client(client, Push, &CancellationToken::new())
+ let (handle, _rx) = start_globe_with_client(&crate::core::runtime::DispatchCtx::default(), client, Push, &CancellationToken::new())
.await
.unwrap();
handle.stop().await;
@@ -261,7 +261,7 @@ async fn lost_start_reply_recovers_the_lease_before_releasing_admission_fixture(
.store(true, std::sync::atomic::Ordering::SeqCst);
fixture.allow_start.notify_one();
assert!(
- start_globe_with_client(client, Push, &CancellationToken::new())
+ start_globe_with_client(&crate::core::runtime::DispatchCtx::default(), client, Push, &CancellationToken::new())
.await
.is_err()
);
@@ -281,7 +281,7 @@ async fn failed_close_retains_ownership_until_the_module_confirms_cleanup_fixtur
.fail_close
.store(true, std::sync::atomic::Ordering::SeqCst);
fixture.allow_start.notify_one();
- let (handle, _rx) = start_globe_with_client(client, Push, &CancellationToken::new())
+ let (handle, _rx) = start_globe_with_client(&crate::core::runtime::DispatchCtx::default(), client, Push, &CancellationToken::new())
.await
.unwrap();
handle.stop().await;