Skip to content

Add WorkflowRetryPolicy example project#1789

Merged
WhitWaldo merged 2 commits intomasterfrom
copilot/augment-examples-workflow-retry-policies
Apr 16, 2026
Merged

Add WorkflowRetryPolicy example project#1789
WhitWaldo merged 2 commits intomasterfrom
copilot/augment-examples-workflow-retry-policies

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

Description

Adds examples/Workflow/WorkflowRetryPolicy — a self-contained example demonstrating WorkflowRetryPolicy usage on activity and child workflow calls, as described in the Dapr workflow retry policies docs.

Three retry scenarios are covered:

  • Fixed-interval retry — activity retried up to 5 times with constant 1s delay
  • Exponential back-off retry — activity retried with 2× backoff coefficient, capped at 16s
  • Child workflow retry — sub-workflow retried via ChildWorkflowTaskOptions with 1.5× backoff

A FlakyActivity and FlakyChildWorkflow simulate transient failures by throwing for a configurable number of attempts before succeeding.

var options = new WorkflowTaskOptions(
    new WorkflowRetryPolicy(
        maxNumberOfAttempts: 10,
        firstRetryInterval: TimeSpan.FromSeconds(1),
        backoffCoefficient: 2.0,
        maxRetryInterval: TimeSpan.FromSeconds(16)));

await context.CallActivityAsync<string>(nameof(FlakyActivity), input, options);

Project added to all.sln under the examples/Workflow solution folder.

Issue reference

This PR adds the example project requested in the linked issue. #1500

Checklist

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

Copilot AI and others added 2 commits April 16, 2026 09:40
…vities and child workflows

Agent-Logs-Url: https://github.com/dapr/dotnet-sdk/sessions/f1ee135c-d9d3-425d-9df6-8afc544b2296

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dapr/dotnet-sdk/sessions/f1ee135c-d9d3-425d-9df6-8afc544b2296

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.37%. Comparing base (1f1fe91) to head (99ad312).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1789   +/-   ##
=======================================
  Coverage   62.37%   62.37%           
=======================================
  Files         285      285           
  Lines        8421     8421           
  Branches      980      980           
=======================================
  Hits         5253     5253           
- Misses       2934     2935    +1     
+ Partials      234      233    -1     
Flag Coverage Δ
net10.0 62.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Copy link
Copy Markdown
Contributor

@WhitWaldo WhitWaldo left a comment

Choose a reason for hiding this comment

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

Looks great - thank you!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants