Skip to content

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

test(voice): isolate hotkey lifecycle fixtures in subprocesses

Steven Enamakelda84dc14c4e8
diff --git a/crates/openhuman-core/src/modules/voice_tests.rs b/crates/openhuman-core/src/modules/voice_tests.rs
index 31c3463288..6f468324b8 100644
--- a/crates/openhuman-core/src/modules/voice_tests.rs
+++ b/crates/openhuman-core/src/modules/voice_tests.rs
@@ -386,12 +386,8 @@ async fn every_entry_point_degrades_rather_than_hanging_when_the_module_is_gone(
#[test]
fn every_member_this_client_calls_is_one_the_contract_declares() {
- // The fifteen call sites in this module are written as `tinyvoice_bus`
- // constants, so a rename upstream is a compile error here rather than a
- // `MemberNotFound` at runtime. This pins the other direction: a member the
- // contract declares and this client never calls is either a gap in the
- // client or a member that should not be in the contract, and either way it
- // should be noticed here rather than discovered later.
+ // Host adapters use contract constants for call sites. Keep the curated
+ // surface, including capture leases and hotkeys, aligned with the module.
use tinyvoice_bus::names::methods;
let called = [
methods::ROUTE,
@@ -408,6 +404,24 @@ fn every_member_this_client_calls_is_one_the_contract_declares() {
methods::ENCODE_WAV,
methods::ENCODE_WAV_PCM16,
methods::PREPARE_CAPTURE,
+ methods::CAPTURE_POLL,
+ methods::CAPTURE_SHUTDOWN,
+ methods::CAPTURE_START,
+ methods::CAPTURE_STOP,
+ methods::RESERVE_CAPTURE,
+ methods::LIST_INPUT_DEVICES,
+ methods::RECORDING_START,
+ methods::RECORDING_FINISH,
+ methods::RECORDING_SUMMARY,
+ methods::RECORDING_CANCEL,
+ methods::READ_AUDIO_OUTPUT,
+ methods::RELEASE_AUDIO_OUTPUT,
+ methods::HOTKEY_RESERVE,
+ methods::HOTKEY_START,
+ methods::HOTKEY_READ,
+ methods::HOTKEY_FEED,
+ methods::HOTKEY_STOP,
+ methods::HOTKEY_SHUTDOWN,
];
// `Segment` is the one deliberate omission: it segments a complete energy
// buffer in one call, and the always-on capture loop needs the stateful
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 69fe9f7e6d..e10ca20582 100644
--- a/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs
+++ b/crates/openhuman-core/src/voice/server/hotkey_listener_tests.rs
@@ -225,7 +225,8 @@ async fn listener_fixture() -> (
#[cfg(feature = "modules")]
#[tokio::test]
-async fn cancelling_startup_still_closes_the_module_owned_listener() {
+#[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 {
start_globe_with_client(client, Push, &CancellationToken::new()).await
@@ -245,7 +246,8 @@ async fn cancelling_startup_still_closes_the_module_owned_listener() {
#[cfg(feature = "modules")]
#[tokio::test]
-async fn stopping_listener_joins_its_bus_cleanup() {
+#[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();
let (handle, _rx) = start_globe_with_client(client, Push, &CancellationToken::new())
@@ -257,7 +259,8 @@ async fn stopping_listener_joins_its_bus_cleanup() {
#[cfg(feature = "modules")]
#[tokio::test]
-async fn lost_start_reply_recovers_the_lease_before_releasing_admission() {
+#[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
.lose_start_reply
@@ -279,7 +282,8 @@ async fn lost_start_reply_recovers_the_lease_before_releasing_admission() {
#[cfg(feature = "modules")]
#[tokio::test(start_paused = true)]
-async fn failed_close_retains_ownership_until_the_module_confirms_cleanup() {
+#[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
.fail_close
@@ -291,3 +295,47 @@ async fn failed_close_retains_ownership_until_the_module_confirms_cleanup() {
handle.stop().await;
assert_eq!(fixture.closes.load(std::sync::atomic::Ordering::SeqCst), 1);
}
+
+// Each fixture owns the process-wide Globe admission lock and its cleanup tasks.
+// 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) {
+ let output = std::process::Command::new(std::env::current_exe().unwrap())
+ .args(["--ignored", "--exact", "--nocapture"])
+ .arg(format!(
+ "voice::server::hotkey_listener::tests::{name}_fixture"
+ ))
+ .output()
+ .unwrap();
+ assert!(
+ output.status.success() && String::from_utf8_lossy(&output.stdout).contains("1 passed"),
+ "lifecycle fixture failed: {}{}",
+ String::from_utf8_lossy(&output.stdout),
+ String::from_utf8_lossy(&output.stderr),
+ );
+}
+
+#[cfg(feature = "modules")]
+#[test]
+fn cancelling_startup_still_closes_the_module_owned_listener() {
+ run_lifecycle_fixture("cancelling_startup_still_closes_the_module_owned_listener");
+}
+
+#[cfg(feature = "modules")]
+#[test]
+fn stopping_listener_joins_its_bus_cleanup() {
+ run_lifecycle_fixture("stopping_listener_joins_its_bus_cleanup");
+}
+
+#[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");
+}
+
+#[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");
+}