Make RequestTimeout non-retryable by default

Aligns with spec update: 408 timeout errors are now non-retryable
by default. Applications can opt in to timeout retries via custom
retry logic. RequestTimeout remains failover-eligible since a
different provider may not share the same timeout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-23 12:56:22 -04:00
parent 0acda783b1
commit 5d3a2d3cfa
No known key found for this signature in database

View file

@ -103,7 +103,8 @@ impl SdkError {
| Self::NoObjectGenerated { .. }
| Self::Abort { .. }
| Self::Configuration { .. }
| Self::UnsupportedToolChoice { .. } => false,
| Self::UnsupportedToolChoice { .. }
| Self::RequestTimeout { .. } => false,
_ => true,
}
}
@ -155,7 +156,7 @@ impl SdkError {
Self::Provider {
kind: ProviderErrorKind::QuotaExceeded,
..
}
} | Self::RequestTimeout { .. }
)
}
@ -333,7 +334,7 @@ mod tests {
let timeout = SdkError::RequestTimeout {
message: "timed out".into(),
};
assert!(timeout.retryable());
assert!(!timeout.retryable());
let network = SdkError::Network {
message: "connection refused".into(),