diff --git a/pkg/channels/manager.go b/pkg/channels/manager.go index 2f3e0a2b7..403681702 100644 --- a/pkg/channels/manager.go +++ b/pkg/channels/manager.go @@ -144,7 +144,7 @@ type toolFeedbackMessageContentPreparer interface { } type toolFeedbackAnimatorConfigurer interface { - ConfigureToolFeedbackAnimator(ToolFeedbackAnimatorConfig) + ConfigureToolFeedbackAnimator(cfg ToolFeedbackAnimatorConfig) } type asyncTask struct { diff --git a/pkg/channels/tool_feedback_animator.go b/pkg/channels/tool_feedback_animator.go index 03d818992..6ed353f3d 100644 --- a/pkg/channels/tool_feedback_animator.go +++ b/pkg/channels/tool_feedback_animator.go @@ -15,6 +15,7 @@ const defaultToolFeedbackAnimationInterval = 3 * time.Second const initialToolFeedbackAnimationFrame = "" var toolFeedbackAnimationFrames = []string{"..", "."} + var retryAfterPattern = regexp.MustCompile(`retry after:? (\d+)`) // MaxToolFeedbackAnimationFrameLength returns the largest frame suffix length @@ -304,7 +305,9 @@ func (a *ToolFeedbackAnimator) retryAfterDelay(err error) (time.Duration, bool) return 0, false } errText := strings.ToLower(err.Error()) - if !errors.Is(err, ErrRateLimit) && !strings.Contains(errText, "too many requests") && !strings.Contains(errText, "429") { + if !errors.Is(err, ErrRateLimit) && + !strings.Contains(errText, "too many requests") && + !strings.Contains(errText, "429") { return 0, false } match := retryAfterPattern.FindStringSubmatch(errText) diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 90cd63d3b..baaa938bd 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -833,7 +833,9 @@ func TestLoadConfig_ToolFeedbackThrottleIntervals(t *testing.T) { configPath := filepath.Join(dir, "config.json") if err := os.WriteFile( configPath, - []byte(`{"version":1,"agents":{"defaults":{"tool_feedback":{"enabled":true,"animation_interval_secs":5,"edit_min_interval_seconds":10}}}}`), + []byte( + `{"version":1,"agents":{"defaults":{"tool_feedback":{"enabled":true,"animation_interval_secs":5,"edit_min_interval_seconds":10}}}}`, + ), 0o600, ); err != nil { t.Fatalf("WriteFile() error: %v", err)