fix(provider): surface API key rotation as ineffective warning (#1000)

rotate_key() selects the next key in the round-robin but never applies
it to the underlying provider (Provider trait has no set_api_key
method). The previous info-level log implied rotation was working.

Change to warn-level and explicitly state the key is not applied,
making the limitation visible to operators instead of silently
pretending rotation works.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Edvard Schøyen 2026-02-20 05:00:26 -05:00 committed by GitHub
parent 1a3be5e54f
commit e2c507664c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -356,10 +356,12 @@ impl Provider for ReliableProvider {
// so the retry hits a different quota bucket.
if rate_limited && !non_retryable_rate_limit {
if let Some(new_key) = self.rotate_key() {
tracing::info!(
tracing::warn!(
provider = provider_name,
error = %error_detail,
"Rate limited, rotated API key (key ending ...{})",
"Rate limited; key rotation selected key ending ...{} \
but cannot apply (Provider trait has no set_api_key). \
Retrying with original key.",
&new_key[new_key.len().saturating_sub(4)..]
);
}
@ -472,10 +474,12 @@ impl Provider for ReliableProvider {
if rate_limited && !non_retryable_rate_limit {
if let Some(new_key) = self.rotate_key() {
tracing::info!(
tracing::warn!(
provider = provider_name,
error = %error_detail,
"Rate limited, rotated API key (key ending ...{})",
"Rate limited; key rotation selected key ending ...{} \
but cannot apply (Provider trait has no set_api_key). \
Retrying with original key.",
&new_key[new_key.len().saturating_sub(4)..]
);
}
@ -594,10 +598,12 @@ impl Provider for ReliableProvider {
if rate_limited && !non_retryable_rate_limit {
if let Some(new_key) = self.rotate_key() {
tracing::info!(
tracing::warn!(
provider = provider_name,
error = %error_detail,
"Rate limited, rotated API key (key ending ...{})",
"Rate limited; key rotation selected key ending ...{} \
but cannot apply (Provider trait has no set_api_key). \
Retrying with original key.",
&new_key[new_key.len().saturating_sub(4)..]
);
}