Skip to content

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

chore: rename test files for consistency

Steven Enamakelc757ac596a4f
diff --git a/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs b/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs
index 4426d45524..fb37344949 100644
--- a/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs
@@ -96,97 +96,6 @@ const C9A_BODY: &str = "kiro API error (500 Internal Server Error): \
reached the limit.\\\",\\\"reason\\\":\\\"MONTHLY_REQUEST_COUNT\\\"}\",\
\"type\":\"server_error\"}}";
-/// Verbatim TAURI-RUST-AFE Responses-API body — the Codex/ChatGPT OAuth
-/// `/responses` endpoint refuses with `usage_limit_reached` once the Plus
-/// plan cap is hit. It carries no "monthly"/"quota" co-marker, so the C9A
-/// phrase set missed it; couple the test to the exact string so a wording
-/// drift fails CI rather than silently leaking events back to Sentry.
-const AFE_BODY: &str = "openai Responses API error: {\"error\":{\"type\":\
- \"usage_limit_reached\",\"message\":\"The usage limit has been reached\",\
- \"plan_type\":\"plus\",\"resets_at\":1750000000}}";
-
-#[test]
-fn quota_exhausted_matches_verbatim_c9a_body() {
- // Status-agnostic: the verbatim 500-wrapped body must match even though
- // the transport status is 500, not 402.
- assert!(is_provider_quota_exhausted(C9A_BODY));
- assert!(body_indicates_quota_exhausted(C9A_BODY));
-}
-
-#[test]
-fn rate_cap_exceeded_matches_verbatim_hxf_body_but_not_transient_or_context() {
- // TAURI-RUST-HXF: verbatim groq `on_demand` free-tier 413 — a single
- // request over the per-minute token cap. Status-agnostic; anchored on
- // BOTH "request too large" (single-request permanence) and a
- // tokens-per-minute marker.
- assert!(is_provider_rate_cap_exceeded_message(
- "groq API error (413 Payload Too Large): {\"error\":{\"message\":\"Request too large \
- for model `openai/gpt-oss-120b` in organization `org_x` service tier `on_demand` on \
- tokens per minute (TPM): Limit 8000, Requested 42084.\",\"code\":\"rate_limit_exceeded\"}}"
- ));
- // Transient burst ("try again in Ns") lacks "request too large" → stays
- // retryable + Sentry-visible.
- assert!(!is_provider_rate_cap_exceeded_message(
- "groq API error (429 Too Many Requests): Rate limit reached. Please try again in 2.5s."
- ));
- // Context-window overflow is a different bucket (model size, not a rate
- // cap) — no tokens-per-minute marker.
- assert!(!is_provider_rate_cap_exceeded_message(
- "openai API error (400): This model's maximum context length is 8192 tokens"
- ));
- // A bare 413 with no TPM marker must not match.
- assert!(!is_provider_rate_cap_exceeded_message(
- "openai API error (413 Payload Too Large): request entity too large"
- ));
-}
-
-#[test]
-fn quota_exhausted_matches_verbatim_afe_body() {
- // Coverage gap closed (TAURI-RUST-AFE): the Responses `usage_limit_reached`
- // body must demote through the same #4076 quota machinery even though it
- // lacks a "monthly"/"quota" co-marker.
- assert!(is_provider_quota_exhausted(AFE_BODY));
- assert!(body_indicates_quota_exhausted(AFE_BODY));
- // Bare phrasings (no surrounding envelope) must also match.
- assert!(body_indicates_quota_exhausted("usage_limit_reached"));
- assert!(body_indicates_quota_exhausted(
- "The usage limit has been reached"
- ));
-}
-
-#[test]
-fn quota_exhausted_matches_common_phrasings() {
- for body in [
- "{\"reason\":\"MONTHLY_REQUEST_COUNT\"}",
- "You have reached the limit on your monthly requests",
- "monthly request quota reached",
- "monthly limit reached",
- "plan quota exceeded",
- "usage limit exceeded for this period",
- ] {
- assert!(is_provider_quota_exhausted(body), "should match: {body:?}");
- }
-}
-
-#[test]
-fn quota_exhausted_ignores_unrelated_500_and_rate_limit() {
- // A generic 500 outage and a 429 rate-limit are NOT plan-quota
- // exhaustion and must stay reportable / retryable respectively — the
- // quota guard must not swallow them.
- for body in [
- "kiro API error (500 Internal Server Error): {\"error\":\
- {\"message\":\"upstream connection reset\",\"type\":\"server_error\"}}",
- "rate_limit_exceeded: too many requests, retry after 12s",
- "429 Too Many Requests",
- "context length exceeded: reduce the number of tokens",
- ] {
- assert!(
- !is_provider_quota_exhausted(body),
- "should NOT match: {body:?}"
- );
- }
-}
-
#[test]
fn quota_and_credits_matchers_do_not_overlap_on_c9a() {
// The 402-gated credits matcher must keep ignoring the 500-wrapped
@@ -198,7 +107,7 @@ fn quota_and_credits_matchers_do_not_overlap_on_c9a() {
StatusCode::INTERNAL_SERVER_ERROR,
C9A_BODY
));
- assert!(is_provider_quota_exhausted(C9A_BODY));
+ assert!(body_indicates_quota_exhausted(C9A_BODY));
}
/// Verbatim TAURI-RUST-8FQ Responses-API body. The matcher keys on this
diff --git a/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs
index ff95c575e3..841233d199 100644
--- a/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs
@@ -502,6 +502,23 @@ mod provider_config_rejection_suppression {
}
}
+mod context_window_exceeded_suppression {
+ use super::super::*;
+
+ #[test]
+ fn log_helper_runs_without_panicking() {
+ // Covers the demotion log path taken by `api_error` when a
+ // custom provider rejects the user's model/param config. No
+ // tracing subscriber in unit tests, so this is a pure smoke.
+ log_provider_config_rejection(
+ "api_error",
+ "custom_openai",
+ Some("reasoning-v1"),
+ reqwest::StatusCode::BAD_REQUEST,
+ );
+ }
+}
+
mod context_window_exceeded_suppression {
use super::super::*;
diff --git a/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs
index 5a5f4097e5..1ca0e3e5fe 100644
--- a/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs
@@ -287,7 +287,7 @@ async fn api_error_monthly_quota_returns_message_via_demoted_branch() {
);
// The body must classify as quota-exhausted so the demote branch — not the
// 500 status gate — handles it.
- assert!(is_provider_quota_exhausted(body));
+ assert!(body_indicates_quota_exhausted(body));
assert!(should_report_provider_http_failure(
StatusCode::INTERNAL_SERVER_ERROR
));