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(voice): run isolated fixtures in-process via env re-exec
Steven Enamakelfc38945d585a
diff --git a/crates/openhuman-core/src/voice/always_on/capture.rs b/crates/openhuman-core/src/voice/always_on/capture.rsindex 24afa5c0dc..3ba4f5973e 100644--- a/crates/openhuman-core/src/voice/always_on/capture.rs+++ b/crates/openhuman-core/src/voice/always_on/capture.rs@@ -25,7 +25,7 @@ pub(super) async fn spawn_capture_thread(let lease = CaptureLease::reserve(config, Kind::Stream).await?;let stream = lease.start_stream().await?;let mut stopped = STOP.subscribe();- let task = tokio::spawn(async move {+ let task = crate::core::runtime::spawn_scoped(async move {loop {if tx.is_closed() {break;diff --git a/crates/openhuman-core/src/voice/always_on/processor.rs b/crates/openhuman-core/src/voice/always_on/processor.rsindex 1b6003ff7b..29bbaabe2f 100644--- a/crates/openhuman-core/src/voice/always_on/processor.rs+++ b/crates/openhuman-core/src/voice/always_on/processor.rs@@ -121,7 +121,7 @@ pub async fn start_if_enabled(app_config: &Config) {let onset_threshold = vad.onset_threshold;let mut stopped = super::capture::stop_subscription();- let processor = tokio::spawn(async move {+ let processor = crate::core::runtime::spawn_scoped(async move {let _running = running;let _pump = pump;// The segmenter lives in the module now, so opening it can fail fordiff --git a/crates/openhuman-core/src/voice/always_on/processor_tests.rs b/crates/openhuman-core/src/voice/always_on/processor_tests.rsindex e1d337fef1..fcccb9b3f3 100644--- a/crates/openhuman-core/src/voice/always_on/processor_tests.rs+++ b/crates/openhuman-core/src/voice/always_on/processor_tests.rs@@ -2,13 +2,22 @@ use super::*;#[test]fn core_shutdown_stops_and_joins_always_on_processing() {+ const CHILD_ENV: &str = "OPENHUMAN_ALWAYS_ON_SHUTDOWN_FIXTURE";+ if std::env::var(CHILD_ENV).as_deref() == Ok("1") {+ tokio::runtime::Builder::new_current_thread()+ .enable_all()+ .build()+ .unwrap()+ .block_on(shutdown_fixture());+ return;+ }let output = std::process::Command::new(std::env::current_exe().unwrap()).args([- "--ignored","--exact",- "voice::always_on::processor::tests::shutdown_fixture",+ "voice::always_on::processor::tests::core_shutdown_stops_and_joins_always_on_processing","--nocapture",])+ .env(CHILD_ENV, "1").output().unwrap();assert!(String::from_utf8_lossy(&output.stdout).contains("1 passed"));@@ -21,8 +30,6 @@ fn core_shutdown_stops_and_joins_always_on_processing() {}// A child process isolates the process-wide capture and processor state.-#[tokio::test]-#[ignore = "invoked by the isolated shutdown regression"]async fn shutdown_fixture() {ENABLED.store(true, Ordering::SeqCst);let mut stopped = super::super::capture::stop_subscription();diff --git a/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs b/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rsindex ebe2ab8621..9a5721e65f 100644--- a/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs+++ b/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs@@ -109,8 +109,6 @@ fn push_suppresses_duplicate_physical_edges() {assert!(state.event(Up, Push).is_none());}-// The paused-clock case must not compete for production admission with a-// fixture running on another test runtime's real clock.#[cfg(feature = "modules")]#[derive(Clone, Default)]struct ListenerFixture {@@ -226,8 +224,6 @@ async fn listener_fixture() -> (}#[cfg(feature = "modules")]-#[tokio::test]-#[ignore = "invoked by the isolated lifecycle regression"]async fn cancelling_startup_still_closes_the_module_owned_listener_fixture() {let (client, fixture, _service) = listener_fixture().await;let startup = tokio::spawn(async move {@@ -247,8 +243,6 @@ async fn cancelling_startup_still_closes_the_module_owned_listener_fixture() {}#[cfg(feature = "modules")]-#[tokio::test]-#[ignore = "invoked by the isolated lifecycle regression"]async fn stopping_listener_joins_its_bus_cleanup_fixture() {let (client, fixture, _service) = listener_fixture().await;fixture.allow_start.notify_one();@@ -260,8 +254,6 @@ async fn stopping_listener_joins_its_bus_cleanup_fixture() {}#[cfg(feature = "modules")]-#[tokio::test]-#[ignore = "invoked by the isolated lifecycle regression"]async fn lost_start_reply_recovers_the_lease_before_releasing_admission_fixture() {let (client, fixture, _service) = listener_fixture().await;fixture@@ -283,8 +275,6 @@ async fn lost_start_reply_recovers_the_lease_before_releasing_admission_fixture(}#[cfg(feature = "modules")]-#[tokio::test(start_paused = true)]-#[ignore = "invoked by the isolated lifecycle regression"]async fn failed_close_retains_ownership_until_the_module_confirms_cleanup_fixture() {let (client, fixture, _service) = listener_fixture().await;fixture@@ -302,12 +292,23 @@ async fn failed_close_retains_ownership_until_the_module_confirms_cleanup_fixtur// Separate processes prevent paused-clock fixtures from timing out on another// fixture's in-flight cleanup, and runtime teardown cannot strand a shared lock.#[cfg(feature = "modules")]-fn run_lifecycle_fixture(name: &str) {+fn run_lifecycle_fixture(name: &str, fixture: impl std::future::Future<Output = ()>) {+ const CHILD_ENV: &str = "OPENHUMAN_HOTKEY_LIFECYCLE_FIXTURE";+ if std::env::var(CHILD_ENV).as_deref() == Ok(name) {+ tokio::runtime::Builder::new_current_thread()+ .enable_all()+ .start_paused(+ name == "failed_close_retains_ownership_until_the_module_confirms_cleanup",+ )+ .build()+ .unwrap()+ .block_on(fixture);+ return;+ }let output = std::process::Command::new(std::env::current_exe().unwrap())- .args(["--ignored", "--exact", "--nocapture"])- .arg(format!(- "voice::server::hotkey_listener::tests::{name}_fixture"- ))+ .args(["--exact", "--nocapture"])+ .env(CHILD_ENV, name)+ .arg(format!("voice::server::hotkey_listener::tests::{name}")).output().unwrap();assert!(@@ -321,23 +322,35 @@ fn run_lifecycle_fixture(name: &str) {#[cfg(feature = "modules")]#[test]fn cancelling_startup_still_closes_the_module_owned_listener() {- run_lifecycle_fixture("cancelling_startup_still_closes_the_module_owned_listener");+ run_lifecycle_fixture(+ "cancelling_startup_still_closes_the_module_owned_listener",+ cancelling_startup_still_closes_the_module_owned_listener_fixture(),+ );}#[cfg(feature = "modules")]#[test]fn stopping_listener_joins_its_bus_cleanup() {- run_lifecycle_fixture("stopping_listener_joins_its_bus_cleanup");+ run_lifecycle_fixture(+ "stopping_listener_joins_its_bus_cleanup",+ stopping_listener_joins_its_bus_cleanup_fixture(),+ );}#[cfg(feature = "modules")]#[test]fn lost_start_reply_recovers_the_lease_before_releasing_admission() {- run_lifecycle_fixture("lost_start_reply_recovers_the_lease_before_releasing_admission");+ run_lifecycle_fixture(+ "lost_start_reply_recovers_the_lease_before_releasing_admission",+ lost_start_reply_recovers_the_lease_before_releasing_admission_fixture(),+ );}#[cfg(feature = "modules")]#[test]fn failed_close_retains_ownership_until_the_module_confirms_cleanup() {- run_lifecycle_fixture("failed_close_retains_ownership_until_the_module_confirms_cleanup");+ run_lifecycle_fixture(+ "failed_close_retains_ownership_until_the_module_confirms_cleanup",+ failed_close_retains_ownership_until_the_module_confirms_cleanup_fixture(),+ );}