Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Don't retry for PaymentRequiredError or ModelRequestLimitReachedError (#36075)

Richard Feldman48ae02c1cace
diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs
index 20d482f60d1..1d417efbbae 100644
--- a/crates/agent/src/thread.rs
+++ b/crates/agent/src/thread.rs
@@ -2268,6 +2268,15 @@ impl Thread {
max_attempts: 3,
})
}
+ Other(err)
+ if err.is::<PaymentRequiredError>()
+ || err.is::<ModelRequestLimitReachedError>() =>
+ {
+ // Retrying won't help for Payment Required or Model Request Limit errors (where
+ // the user must upgrade to usage-based billing to get more requests, or else wait
+ // for a significant amount of time for the request limit to reset).
+ None
+ }
// Conservatively assume that any other errors are non-retryable
HttpResponseError { .. } | Other(..) => Some(RetryStrategy::Fixed {
delay: BASE_RETRY_DELAY,