From 2e49d55d412d4af61aa0be96c983f358434cd603 Mon Sep 17 00:00:00 2001 From: Akanksha Trehun Date: Thu, 10 Sep 2026 09:48:37 +0530 Subject: [PATCH] docs(workflow): clarify RetryPolicy field docstrings Users kept tripping over the same three gotchas: max_number_of_attempts counts the first attempt too, an unset max_retry_interval leaves the backoff interval uncapped rather than disabling retries, and hitting retry_timeout ends retries with whatever the last attempt returned instead of running one more attempt. Spell all three out in the docstrings instead of leaving them to be discovered the hard way. Signed-off-by: Akanksha Trehun --- dapr/ext/workflow/retry_policy.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dapr/ext/workflow/retry_policy.py b/dapr/ext/workflow/retry_policy.py index 255e7bc6c..eb95a6b9f 100644 --- a/dapr/ext/workflow/retry_policy.py +++ b/dapr/ext/workflow/retry_policy.py @@ -39,13 +39,18 @@ def __init__( Args: first_retry_interval(timedelta): The retry interval to use for the first retry attempt. - max_number_of_attempts(int): The maximum number of retry attempts. + max_number_of_attempts(int): The total number of attempts, including the first one, + not the number of retries after the first attempt. backoff_coefficient(Optional[float]): The backoff coefficient to use for calculating - the next retry interval. + the next retry interval. With the default of 1.0, every retry interval is + first_retry_interval; a coefficient above 1.0 grows the interval on each attempt + up to max_retry_interval, if set. max_retry_interval(Optional[timedelta]): The maximum retry interval to use for any - retry attempt. + retry attempt. Leaving this unset means the interval keeps growing without a cap + when backoff_coefficient is above 1.0. retry_timeout(Optional[timedelta]): The maximum amount of time to spend retrying the - operation. + operation. Once exceeded, the activity or workflow fails outright, even if + max_number_of_attempts has not been reached, so its own final attempt is not run. """ # validate inputs if first_retry_interval < timedelta(seconds=0):