Skip to content

Make key-rotator rate-limit cooldown configurable per provider #135

Description

@saivedant169

What

NewKeyRotator in internal/provider/keyrotator.go takes a rateLimitCooldown, which is how long a key that just hit a 429 is benched before it gets retried. It is hardcoded to a 60s default and there is no way to set it. There is already a TODO on the function saying exactly this (keyrotator.go:35), and every caller passes 0 today (see internal/provider/openai.go:44), so it always falls back to 60s.

Scope

  • Add an optional per-provider rate_limit_cooldown field (a duration) to ProviderConfig in internal/config/config.go:520.
  • Thread it through to the NewKeyRotator(...) call in internal/provider/openai.go:44 so a configured value is used instead of 0.
  • Keep the 60s default when the field is unset or zero, so existing configs behave exactly as they do now.
  • Document the field in configs/aegisflow.example.yaml.
  • Delete the TODO comment once it is wired.

Acceptance

  • Setting rate_limit_cooldown: 30s on a provider benches a 429-hit key for 30s.
  • Leaving it unset keeps the 60s behavior, unchanged from today.
  • go test ./... passes, with a test that shows a configured value reaching the rotator.

Keep it a plain per-provider duration. Do not expand it into per-key or per-status-code policy, that is out of scope here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions