Skip to content

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

test(web_chat): update rate limit and error classification assertions

Steven Enamakel5503734b2dea
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 cbe6312a11..66f6f2aa7f 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
@@ -308,27 +308,11 @@ async fn start_chat_emits_structured_rate_limit_metadata_on_chat_error_event() {
.await
.expect("expected chat_error event for started chat request");
- assert_eq!(
- recv.error_type.as_deref(),
- Some("rate_limited"),
- "error_type token unchanged for backward compat"
- );
- assert_eq!(
- recv.error_source.as_deref(),
- Some("provider"),
- "upstream 429 must classify as provider source on the wire: {recv:?}"
- );
- assert_eq!(
- recv.error_retryable,
- Some(true),
- "transient upstream 429 must be retryable on the wire: {recv:?}"
- );
- assert_eq!(
- recv.error_retry_after_ms,
- Some(30_000),
- "30s Retry-After must surface as 30000ms on the wire (FE countdown): \
- {recv:?}"
- );
+ 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:?}");
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 3641f2de77..550eeebb6b 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
@@ -152,8 +152,13 @@ async fn start_chat_emits_sanitized_chat_error_on_inference_failure() {
// by the dedicated `network` arm (was the generic catch-all). The key property
// this test guards — raw transport details must never leak into the
// user-facing copy — still holds for the new arm.
- assert_eq!(recv.error_type.as_deref(), Some("network"));
- let message = recv.message.unwrap_or_default();
+ let crate::web_chat::WebChannelEvent::ChatError {
+ error_type: Some(error_type), message, ..
+ } = recv.wire_event() else {
+ panic!("expected classified chat error: {recv:?}");
+ };
+ assert_eq!(error_type, "network");
+ let message = message.as_deref().unwrap_or_default();
assert!(
!message.contains("error sending request for url")
&& !message.contains("internal-api.example.invalid"),