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.
What
NewKeyRotatorininternal/provider/keyrotator.gotakes arateLimitCooldown, 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 aTODOon the function saying exactly this (keyrotator.go:35), and every caller passes0today (seeinternal/provider/openai.go:44), so it always falls back to 60s.Scope
rate_limit_cooldownfield (a duration) toProviderConfigininternal/config/config.go:520.NewKeyRotator(...)call ininternal/provider/openai.go:44so a configured value is used instead of0.configs/aegisflow.example.yaml.TODOcomment once it is wired.Acceptance
rate_limit_cooldown: 30son a provider benches a 429-hit key for 30s.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.