This commit is contained in:
2026-08-23 13:08:14 +02:00
parent ee1405cc1a
commit 89ae7e5fa8
4 changed files with 74 additions and 7 deletions
@@ -47,6 +47,23 @@ func TestFormatOpenAIHTTPError_preservesUsefulHints(t *testing.T) {
},
want: "model rejects legacy token cap",
},
{
status: 429,
err: &openAIErrorBody{
Message: "You exceeded your current quota, please check your plan and billing details.",
Type: "insufficient_quota",
Code: "insufficient_quota",
},
want: "API billing/quota empty",
},
{
status: 429,
err: &openAIErrorBody{
Message: "Rate limit reached for requests",
Code: "rate_limit_exceeded",
},
want: "AI provider rate limited",
},
{
status: 401,
err: &openAIErrorBody{
@@ -81,6 +98,19 @@ func TestFormatOpenAIHTTPError_preservesUsefulHints(t *testing.T) {
}
}
func TestOpenAIErrorIsRetryableRateLimit(t *testing.T) {
t.Parallel()
if openAIErrorIsRetryableRateLimit(&openAIErrorBody{Code: "insufficient_quota", Type: "insufficient_quota"}) {
t.Fatal("quota must not retry")
}
if !openAIErrorIsRetryableRateLimit(&openAIErrorBody{Code: "rate_limit_exceeded"}) {
t.Fatal("true rate limit should retry")
}
if openAIErrorIsRetryableRateLimit(nil) {
t.Fatal("nil 429 body must not auto-retry")
}
}
func TestProbeCompleteOptions(t *testing.T) {
t.Parallel()
opts := ProbeCompleteOptions()