Skip to content

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

test(embed): allow deadline refusal before HTTP dispatch

Steven Enamakeld5847bdd54a7
diff --git a/crates/openhuman-embed/src/fanout.rs b/crates/openhuman-embed/src/fanout.rs
index cad578ebd8..83e290ad92 100644
--- a/crates/openhuman-embed/src/fanout.rs
+++ b/crates/openhuman-embed/src/fanout.rs
@@ -28,7 +28,10 @@ pub enum LeafCall {
impl LeafCall {
/// A stateless request with owned, boxed options.
pub fn completion(completer: Completer, request: CompletionRequest) -> Self {
- Self::Completion { completer, request: Box::new(request) }
+ Self::Completion {
+ completer,
+ request: Box::new(request),
+ }
}
/// An independent agent turn with owned, boxed state.
pub fn turn(turn: Turn) -> Self {
diff --git a/crates/openhuman-embed/tests/completion_cancellation.rs b/crates/openhuman-embed/tests/completion_cancellation.rs
index d5aae32e30..aacf077eae 100644
--- a/crates/openhuman-embed/tests/completion_cancellation.rs
+++ b/crates/openhuman-embed/tests/completion_cancellation.rs
@@ -75,5 +75,7 @@ async fn deadline_refusal_is_typed_and_stops_the_provider_future() {
.complete(request())
.await;
assert!(matches!(result, Err(CoreError::DeadlineExceeded { .. })));
- assert_eq!(server.received_requests().await.unwrap().len(), 1);
+ // The whole-call deadline includes client construction. On a busy worker
+ // it may expire before HTTP dispatch, which is a valid earlier refusal.
+ assert!(server.received_requests().await.unwrap().len() <= 1);
}