auto refresh expired bedrock tokens

This commit is contained in:
Josh Woodcock
2026-05-27 13:29:11 -05:00
parent d55befec1c
commit 0e72791483
6 changed files with 139 additions and 11 deletions
+16
View File
@@ -310,6 +310,22 @@ impl AIApiError {
{
false
}
// Don't retry Bedrock credential/auth errors — they require user
// action (e.g. SSO re-login) and will always fail with the same token.
AIApiError::Stream { source, .. }
if {
let msg = source.to_string().to_lowercase();
msg.contains("session token not found")
|| msg.contains("expiredtoken")
|| msg.contains("expired token")
|| msg.contains("unrecognizedclientexception")
|| msg.contains("unauthorizedexception")
|| (msg.contains("sso/cache") && msg.contains("no such file"))
|| (msg.contains("sso/cache") && msg.contains("notfound"))
} =>
{
false
}
// By default, retry on error.
_ => true,
}