Skip to content

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

test: adapt web chat tests to optional full_response and scoped events

Steven Enamakeld60dff76686f
diff --git a/crates/openhuman-core/src/core/runtime/subscribers_tests.rs b/crates/openhuman-core/src/core/runtime/subscribers_tests.rs
index 8d3d159be5..9340a878b5 100644
--- a/crates/openhuman-core/src/core/runtime/subscribers_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/subscribers_tests.rs
@@ -256,7 +256,7 @@ fn proactive_message_reaches_web_on_channelless_core_boot() {
event.wire_event(),
crate::web_chat::WebChannelEvent::ProactiveMessage {
full_response, ..
- } if full_response == "Your morning briefing is ready."
+ } if full_response.as_deref() == Some("Your morning briefing is ready.")
) {
break event;
}
@@ -351,7 +351,7 @@ fn proactive_message_is_scoped_to_originating_saas_profile() {
event.wire_event(),
crate::web_chat::WebChannelEvent::ProactiveMessage {
full_response, ..
- } if full_response == "Your morning briefing is ready."
+ } if full_response.as_deref() == Some("Your morning briefing is ready.")
) {
break event;
}
diff --git a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
index 585445385f..7d673124c7 100644
--- a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
@@ -114,7 +114,7 @@ fn repair_backend_failure_returns_no_proposal_before_starting_the_builder() {
done.wire_event(),
crate::web_chat::WebChannelEvent::ChatDone {
full_response, ..
- } if full_response.contains("workflow was not changed")
+ } if full_response.as_deref().is_some_and(|text| text.contains("workflow was not changed"))
));
});
}
diff --git a/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs
index e7d8735b74..e17f01b11d 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs
@@ -484,7 +484,7 @@ async fn chat_done_is_published_only_after_the_in_flight_slot_is_released() {
let thread_id = "chat-done-after-slot-release";
let request_id = start_parked_turn(thread_id, &block).await;
let mut events = crate::web_chat::subscribe_web_channel_events();
- let is_done = |event: &crate::web_chat::WebChannelEvent| {
+ let is_done = |event: &crate::web_chat::ScopedWebEvent| {
event.event_name() == "chat_done" && event.context().request_id == request_id
};
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 2d98a7cb4c..b72ca387b2 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
@@ -320,7 +320,10 @@ async fn start_chat_emits_structured_rate_limit_metadata_on_chat_error_event() {
"upstream 429 wire classification and countdown changed: {recv:?}"
);
assert_eq!(
- recv.error_provider.as_deref(),
+ match recv.wire_event() {
+ crate::web_chat::WebChannelEvent::ChatError { error_provider, .. } => error_provider.as_deref(),
+ _ => None,
+ },
Some("openrouter"),
"provider name must reach the wire so the FE can show \"openrouter is throttling\": \
{recv:?}"