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 error classification tests

Steven Enamakel56429caf9629
diff --git a/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs
index dcb3114336..012de6621d 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs
@@ -413,12 +413,10 @@ fn classify_inference_error_byo_no_code_keeps_user_actionable_copy() {
}
#[test]
-fn classify_inference_error_byo_with_error_code_token_is_not_managed() {
- // CodeRabbit: a BYO / direct-provider error whose body happens to carry an
- // `errorCode`-shaped field must NOT be classified on the managed-code
- // branch — the managed-envelope gate keeps it on the substring ladder so
- // the user-actionable BYO copy is preserved (and FE Sentry is unaffected).
- let raw = r#"custom_openai API error (429 Too Many Requests): {"error":{"errorCode":"RATE_LIMITED","message":"slow down"}}"#;
+fn classify_byo_rate_limit_keeps_provider_copy() {
+ // Direct-provider failures use the generic copy ladder when no hosted
+ // classifier metadata is installed.
+ let raw = "custom_openai API error (429 Too Many Requests): slow down";
let classified = classify_inference_error(raw);
// Still classified as rate_limited via the substring ladder, but through
// the BYO path: the message uses the existing substring-arm copy ("This is
diff --git a/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs
index 6229bc1e27..d383970e08 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs
@@ -546,12 +546,12 @@ fn classify_connection_drop_routes_to_network_retryable() {
#[test]
fn classify_managed_sse_badrequest_not_misread_as_network() {
- // A managed 400 frame carries errorCode → must stay provider_request_rejected
- // (claimed by the errorCode short-circuit before the transport arm).
- let c = classify_inference_error(
- "OpenHuman streaming API error: {\"error\":{\"message\":\"Message has tool role, \
- but there was no previous assistant message with a tool call!\",\
- \"type\":\"stream_error\",\"errorCode\":\"BAD_REQUEST\"}}",
+ // Host classification supplies the semantic kind before generic transport
+ // copy selection, so a streaming rejection is not mistaken for a drop.
+ let c = classify_with_backend_metadata(
+ "generic streaming response: Message has tool role, but there was no previous assistant message with a tool call!",
+ BackendErrorKind::BadRequest,
+ false,
);
assert_eq!(c.error_type, "provider_request_rejected");
}
@@ -569,10 +569,10 @@ fn classify_managed_tool_ordering_400_gets_cleared_resend_copy() {
// message) arrives as a BAD_REQUEST SSE frame — must read "we cleared it,
// send again" (not "try a different model") and be retryable, since the
// de-poison guard already evicted the bad warm session.
- let c = classify_inference_error(
- "OpenHuman streaming API error: {\"error\":{\"message\":\"Message at index 3 has role \
- 'tool' but is not preceded by an assistant message with a matching tool_call\",\
- \"type\":\"stream_error\",\"errorCode\":\"BAD_REQUEST\"}}",
+ let c = classify_with_backend_metadata(
+ "generic streaming response: Message at index 3 has role 'tool' but is not preceded by an assistant message with a matching tool_call",
+ BackendErrorKind::BadRequest,
+ false,
);
assert_eq!(c.error_type, "provider_request_rejected");
assert!(c.retryable, "post-eviction resend works → retryable");