Skip to content

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

chore: files changed crates/openhuman-core/src/web_chat/progress_tests.rs,crates/openhuman-core/src/

Steven Enamakel32b3d5ab16f8
diff --git a/crates/openhuman-core/src/web_chat/progress_tests.rs b/crates/openhuman-core/src/web_chat/progress_tests.rs
index 32d35928b7..d6117a094a 100644
--- a/crates/openhuman-core/src/web_chat/progress_tests.rs
+++ b/crates/openhuman-core/src/web_chat/progress_tests.rs
@@ -577,7 +577,11 @@ mod subagent_tests {
let completed = recv_for_thread(&mut events, thread_id).await;
assert_eq!(completed.event_name(), "subagent_completed");
- let WebChannelEvent::SubagentCompleted { subagent: Some(subagent), .. } = completed.wire_event() else {
+ let WebChannelEvent::SubagentCompleted {
+ subagent: Some(subagent),
+ ..
+ } = completed.wire_event()
+ else {
panic!("subagent detail present")
};
assert_eq!(subagent.parent_call_id.as_deref(), Some("call-parent-2"));
@@ -616,7 +620,11 @@ mod subagent_tests {
let failed = recv_for_thread(&mut events, thread_id).await;
assert_eq!(failed.event_name(), "subagent_failed");
- let WebChannelEvent::SubagentFailed { subagent: Some(subagent), .. } = failed.wire_event() else {
+ let WebChannelEvent::SubagentFailed {
+ subagent: Some(subagent),
+ ..
+ } = failed.wire_event()
+ else {
panic!("subagent detail present")
};
assert_eq!(subagent.parent_call_id.as_deref(), Some("call-parent-3"));
diff --git a/crates/openhuman-core/src/web_chat/turn_events_tests.rs b/crates/openhuman-core/src/web_chat/turn_events_tests.rs
index a419a8d625..accf65b142 100644
--- a/crates/openhuman-core/src/web_chat/turn_events_tests.rs
+++ b/crates/openhuman-core/src/web_chat/turn_events_tests.rs
@@ -161,9 +161,11 @@ async fn a_stopped_turn_announces_cancelled_to_the_client_that_stopped_it() {
assert!(matches!(seen[0].wire_event(), WebChannelEvent::ChatError {
error_type: Some(error_type), message: Some(message), ..
} if error_type == "cancelled" && message == "Cancelled"));
- assert!(matches!(seen[1].wire_event(), WebChannelEvent::ChatCancelled {
+ assert!(
+ matches!(seen[1].wire_event(), WebChannelEvent::ChatCancelled {
cancel_reason: Some(reason), ..
- } if reason == "user_stop"));
+ } if reason == "user_stop")
+ );
assert!(
seen.iter()
.all(|event| event.context().client_id == "stopper")
@@ -194,9 +196,11 @@ async fn a_superseded_turn_names_its_replacement() {
assert!(matches!(seen[0].wire_event(), WebChannelEvent::ChatError {
message: Some(message), ..
} if message == "Cancelled by newer request"));
- assert!(matches!(seen[1].wire_event(), WebChannelEvent::ChatCancelled {
+ assert!(
+ matches!(seen[1].wire_event(), WebChannelEvent::ChatCancelled {
context, cancel_reason: Some(reason), superseded_by: Some(replacement), ..
- } if reason == "superseded" && replacement == "events-new" && context.client_id == "interrupter"));
+ } if reason == "superseded" && replacement == "events-new" && context.client_id == "interrupter")
+ );
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/web_chat/web_tests_rate_limit_classification_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_rate_limit_classification_tests.rs
index 66f6f2aa7f..2d98a7cb4c 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_rate_limit_classification_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_rate_limit_classification_tests.rs
@@ -242,9 +242,13 @@ async fn start_chat_chat_error_event_serializes_structured_fields_to_json_wire()
// Pin the additive contract: serializing a default (no error)
// event must NOT introduce any of the new keys.
- let empty = crate::web_chat::WebChannelEvent {
- event: "chat_done".to_string(),
- ..Default::default()
+ let empty = crate::web_chat::WebChannelEvent::ChatDone {
+ context: Default::default(),
+ full_response: None,
+ citations: None,
+ usage: None,
+ timing: None,
+ parts: None,
};
let empty_json = serde_json::to_value(&empty).expect("Default WebChannelEvent serializes");
for key in [
@@ -308,11 +312,13 @@ async fn start_chat_emits_structured_rate_limit_metadata_on_chat_error_event() {
.await
.expect("expected chat_error event for started chat request");
- assert!(matches!(recv.wire_event(), crate::web_chat::WebChannelEvent::ChatError {
+ assert!(
+ matches!(recv.wire_event(), crate::web_chat::WebChannelEvent::ChatError {
error_type: Some(error_type), error_source: Some(source),
error_retryable: Some(true), error_retry_after_ms: Some(30_000), ..
} if error_type == "rate_limited" && source == "provider"),
- "upstream 429 wire classification and countdown changed: {recv:?}");
+ "upstream 429 wire classification and countdown changed: {recv:?}"
+ );
assert_eq!(
recv.error_provider.as_deref(),
Some("openrouter"),
diff --git a/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs
index 550eeebb6b..9beb154509 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs
@@ -153,8 +153,11 @@ async fn start_chat_emits_sanitized_chat_error_on_inference_failure() {
// this test guards — raw transport details must never leak into the
// user-facing copy — still holds for the new arm.
let crate::web_chat::WebChannelEvent::ChatError {
- error_type: Some(error_type), message, ..
- } = recv.wire_event() else {
+ error_type: Some(error_type),
+ message,
+ ..
+ } = recv.wire_event()
+ else {
panic!("expected classified chat error: {recv:?}");
};
assert_eq!(error_type, "network");
diff --git a/crates/openhuman-core/src/web_chat/web_tests_turn_lifecycle_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_turn_lifecycle_tests.rs
index e63c1d3184..5dd66436fb 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_turn_lifecycle_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_turn_lifecycle_tests.rs
@@ -60,13 +60,17 @@ async fn an_interrupting_message_supersedes_the_running_turn() {
assert_ne!(first, second);
let error = wait_for_event(&mut rx, &first, "chat_error").await;
- assert!(matches!(error.wire_event(), crate::web_chat::WebChannelEvent::ChatError {
+ assert!(
+ matches!(error.wire_event(), crate::web_chat::WebChannelEvent::ChatError {
error_type: Some(error_type), message: Some(message), ..
- } if error_type == "cancelled" && message == "Cancelled by newer request"));
+ } if error_type == "cancelled" && message == "Cancelled by newer request")
+ );
let cancelled = wait_for_event(&mut rx, &first, "chat_cancelled").await;
- assert!(matches!(cancelled.wire_event(), crate::web_chat::WebChannelEvent::ChatCancelled {
+ assert!(
+ matches!(cancelled.wire_event(), crate::web_chat::WebChannelEvent::ChatCancelled {
context, cancel_reason: Some(reason), superseded_by: Some(replacement), ..
- } if reason == "superseded" && replacement == &second && context.client_id == "second-client"));
+ } if reason == "superseded" && replacement == &second && context.client_id == "second-client")
+ );
cancel_chat_scoped(&DispatchCtx::ambient(), "second-client", thread_id, None)
.await
@@ -94,13 +98,17 @@ async fn a_stop_is_announced_once_to_the_client_that_pressed_it() {
assert_eq!(outcome.value["request_id"], request_id);
let error = wait_for_event(&mut rx, &request_id, "chat_error").await;
- assert!(matches!(error.wire_event(), crate::web_chat::WebChannelEvent::ChatError {
+ assert!(
+ matches!(error.wire_event(), crate::web_chat::WebChannelEvent::ChatError {
context, message: Some(message), ..
- } if message == "Cancelled" && context.client_id == "stopper"));
+ } if message == "Cancelled" && context.client_id == "stopper")
+ );
let cancelled = wait_for_event(&mut rx, &request_id, "chat_cancelled").await;
- assert!(matches!(cancelled.wire_event(), crate::web_chat::WebChannelEvent::ChatCancelled {
+ assert!(
+ matches!(cancelled.wire_event(), crate::web_chat::WebChannelEvent::ChatCancelled {
cancel_reason: Some(reason), superseded_by: None, ..
- } if reason == "user_stop"));
+ } if reason == "user_stop")
+ );
wait_for_in_flight(|e| !e.iter().any(|(k, _)| k == thread_id)).await;
set_test_run_chat_task_block(None).await;
}
@@ -288,7 +296,8 @@ async fn a_turn_with_an_unavailable_local_provider_ends_in_one_classified_chat_e
}),
"all inference retries must target the configured model: {inference_requests:?}"
);
- assert!(matches!(error.wire_event(), crate::web_chat::WebChannelEvent::ChatError {
+ assert!(
+ matches!(error.wire_event(), crate::web_chat::WebChannelEvent::ChatError {
context,
error_type: Some(error_type),
copy_key: Some(copy_key),
@@ -298,7 +307,9 @@ async fn a_turn_with_an_unavailable_local_provider_ends_in_one_classified_chat_e
} if error_type == "provider_unavailable"
&& context.client_id == "real-client"
&& copy_key == "chat_error.provider_unavailable"
- && source == "provider_error"), "{error:?}");
+ && source == "provider_error"),
+ "{error:?}"
+ );
let runtime = crate::web_chat::runner::runtime(&ctx);
assert!(