fix(llm): scope retry classifier to bounded 429/529 forms

This commit is contained in:
sausheong committed 2026-06-13 15:34:19 +08:00
1 parent 04f02c56d6
commit 9292731d79
2 files changed
+22 -2

No files matched your search

+11
View File
@@ -8,6 +8,7 @@ import (
anthropic "github.com/anthropics/anthropic-sdk-go"
openai "github.com/sashabaranov/go-openai"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestIsRetryableModelErrorAnthropic429(t *testing.T) {
@@ -89,3 +90,13 @@ func TestIsRetryableModelErrorUnrelatedError(t *testing.T) {
err := errors.New("some other failure")
assert.False(t, IsRetryableModelError(err))
}
func TestRetry_DigitsInRequestIDNotRetryable(t *testing.T) {
err := errors.New("request failed: req_abc429def something went wrong")
require.False(t, IsRetryableModelError(err))
}
func TestRetry_RealStatus429Retryable(t *testing.T) {
err := errors.New("openai: error, status 429 too many requests")
require.True(t, IsRetryableModelError(err))
}