Skip to content

Feat: Add jitterfactor to retry policy#1687

Draft
javier-aliaga wants to merge 6 commits intodapr:masterfrom
javier-aliaga:add-jitterfactor-retry-activity
Draft

Feat: Add jitterfactor to retry policy#1687
javier-aliaga wants to merge 6 commits intodapr:masterfrom
javier-aliaga:add-jitterfactor-retry-activity

Conversation

@javier-aliaga
Copy link
Contributor

Description

Please explain the changes you've made

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[issue number]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Signed-off-by: Javier Aliaga <javier@diagrid.io>
Signed-off-by: Javier Aliaga <javier@diagrid.io>
Signed-off-by: Javier Aliaga <javier@diagrid.io>
@javier-aliaga javier-aliaga requested a review from Copilot March 4, 2026 15:36
@javier-aliaga javier-aliaga changed the title Feat: Add jitterfactor to retry activity policy Feat: Add jitterfactor to retry policy Mar 4, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for a configurable retry “jitter factor” and wires it through workflow-to-durable retry policy conversion, enabling deterministic jittered backoff in the durable task executor to reduce retry synchronization (“thundering herd”).

Changes:

  • Add jitterFactor to WorkflowTaskRetryPolicy and propagate it to durabletask RetryPolicy.
  • Apply deterministic jitter to computed retry delays in TaskOrchestrationExecutor.
  • Add unit tests for jitter factor validation/defaults and for maxRetryInterval propagation in workflow context.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskRetryPolicy.java Adds jitterFactor field + builder setter; updates constructor signature to include jitter.
sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowContext.java Propagates maxRetryInterval (when set) and jitterFactor into durable RetryPolicy.
sdk-workflows/src/test/java/io/dapr/workflows/DefaultWorkflowContextTest.java Adds tests verifying maxRetryInterval propagation and default behavior.
sdk-workflows/src/test/java/io/dapr/workflows/WorkflowTaskRetryPolicyTest.java Adds tests for jitter defaults, boundaries, null-constructor behavior, and chaining.
durabletask-client/src/main/java/io/dapr/durabletask/RetryPolicy.java Adds jitterFactor field with setter/getter and validation.
durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java Applies deterministic jitter reduction to retry delays during orchestration execution.
durabletask-client/src/test/java/io/dapr/durabletask/RetryPolicyTest.java Adds tests for jitter defaults/range checks and documents deterministic jitter math.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Javier Aliaga <javier@diagrid.io>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Javier Aliaga <javier@diagrid.io>
@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.56%. Comparing base (a2877aa) to head (e4c3cb3).

Files with missing lines Patch % Lines
...ava/io/dapr/workflows/WorkflowTaskRetryPolicy.java 77.77% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1687      +/-   ##
============================================
+ Coverage     79.51%   79.56%   +0.04%     
- Complexity     2194     2195       +1     
============================================
  Files           237      237              
  Lines          6577     6587      +10     
  Branches        730      731       +1     
============================================
+ Hits           5230     5241      +11     
+ Misses          992      989       -3     
- Partials        355      357       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants