pub async fn send_with_retry<F, Fut>(
policy: &RetryPolicy,
make_request: F,
) -> Result<Response, Error>Expand description
Send one request per attempt with capped exponential backoff and jitter.
The caller rebuilds the request on every attempt via make_request (a
RequestBuilder is consumed by send(), so it cannot be reused).
Transport failures (connect errors, timeouts) are retried; builder errors
fail fast because retrying a malformed request can never succeed.
Responses with a retryable status (429/500/502/503/504 per
RetryPolicy::classify_status) are retried while attempts remain;
otherwise the final response is returned for the caller to handle.
This is the shared helper for idempotent background fetches (release metadata, asset downloads, catalog refreshes). Interactive LLM requests must NOT use it: the runloop already retries those under its own budget, and stacking a transport retry underneath would multiply dispatches and provider billing.
What this does NOT do: it never honors Retry-After (policy backoff
only; Retry-After cooperation stays at the tool-registry layer where the
server relationship exists), and it never retries a response body failure —
only the initial send().