mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-27 01:11:40 +00:00
fix: stop billing fallback retry spam in gateways
This commit is contained in:
parent
00c3d848d8
commit
79bfad0adc
6 changed files with 195 additions and 7 deletions
|
|
@ -250,6 +250,24 @@ class TestClassifyApiError:
|
|||
assert result.reason == FailoverReason.rate_limit
|
||||
assert result.should_fallback is True
|
||||
|
||||
def test_429_insufficient_balance_classified_as_billing(self):
|
||||
e = MockAPIError("HTTP 429: insufficient balance (1008)", status_code=429)
|
||||
result = classify_api_error(e, provider="minimax")
|
||||
assert result.reason == FailoverReason.billing
|
||||
assert result.retryable is False
|
||||
assert result.should_rotate_credential is True
|
||||
assert result.should_fallback is True
|
||||
|
||||
def test_429_payment_required_error_code_classified_as_billing(self):
|
||||
e = MockAPIError(
|
||||
"provider error",
|
||||
status_code=429,
|
||||
body={"error": {"code": "payment_required", "message": "provider error"}},
|
||||
)
|
||||
result = classify_api_error(e, provider="openrouter")
|
||||
assert result.reason == FailoverReason.billing
|
||||
assert result.retryable is False
|
||||
|
||||
def test_alibaba_rate_increased_too_quickly(self):
|
||||
"""Alibaba/DashScope returns a unique throttling message.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue