Skip to content

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

fix(web_chat): correct test assertion for start chat ingress

Steven Enamakelf49c82824268
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 8a6be3e9ef..e9dbaf3b3c 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
@@ -60,7 +60,22 @@ async fn start_chat_rejects_prompt_injection_payload() {
.await
.expect_err("prompt-injection payload should be rejected");
- let lower = err.to_ascii_lowercase();
+ // Structured now (StartChatError::Guardrail{verdict,score,reasons}), not
+ // a plain string — assert the classifiable shape as well as the
+ // human-readable copy `Display` still gives a plain-string consumer.
+ match &err {
+ StartChatError::Guardrail { verdict, .. } => {
+ assert!(
+ verdict == "block" || verdict == "review_blocked",
+ "unexpected guardrail verdict: {verdict}"
+ );
+ }
+ StartChatError::Other(message) => {
+ panic!("expected a Guardrail rejection, got Other({message})");
+ }
+ }
+
+ let lower = err.to_string().to_ascii_lowercase();
assert!(
lower.contains("blocked by a security policy")
|| lower.contains("flagged for security review"),