Skip to content

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

test(runtime): improve native runner checkout serialization test

Steven Enamakel652143a6426f
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner_tests.rs
index dacee579ad..bc67e43668 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner_tests.rs
@@ -120,12 +120,14 @@ async fn native_runner_checkouts_serialize_and_cancel_waiters_cleanly() {
let second = NativeHost {
shared: Arc::clone(&second_shared),
};
- let second_request = request(&dispatch, &session, &profile, "native-cancelled");
- let waiting = tokio::spawn(async move { second.checkout(&second_request).await });
- tokio::task::yield_now().await;
+ let other_session = format!("native-runner-other-session-{}", uuid::Uuid::new_v4());
+ let second_request = request(&dispatch, &other_session, &profile, "native-cancelled");
+ let mut waiting = tokio::spawn(async move { second.checkout(&second_request).await });
assert!(
- !waiting.is_finished(),
- "a second runner instance waits on the checked-out durable session"
+ tokio::time::timeout(std::time::Duration::from_millis(50), &mut waiting)
+ .await
+ .is_err(),
+ "a distinct session in the same profile waits for the active profile turn"
);
waiting.abort();
assert!(
@@ -137,7 +139,7 @@ async fn native_runner_checkouts_serialize_and_cancel_waiters_cleanly() {
);
first_shared.record_delivery("native-first", true);
- let third_request = request(&dispatch, &session, &profile, "native-third");
+ let third_request = request(&dispatch, &other_session, &profile, "native-third");
let third = NativeHost {
shared: Arc::clone(&second_shared),
};
@@ -146,8 +148,8 @@ async fn native_runner_checkouts_serialize_and_cancel_waiters_cleanly() {
third.checkout(&third_request),
)
.await
- .expect("terminal delivery releases the session/profile guards")
- .expect("a later runner can check out the session");
- assert_eq!(third_session.session_id, session);
+ .expect("terminal delivery releases the profile guard")
+ .expect("a later runner can check out a different session in the profile");
+ assert_eq!(third_session.session_id, other_session);
second_shared.record_delivery("native-third", true);
}