Skip to content

fix(workflow): correlate activity and child workflow retries - #953

Merged
WhitWaldo merged 1 commit into
dapr:mainfrom
JoshVanL:retry-correlation
Nov 21, 2026
Merged

WhitWaldo merged 1 commit into
dapr:mainfrom
JoshVanL:retry-correlation

Conversation

@JoshVanL

Copy link
Copy Markdown
Member

Retry delay timers were created with the plain createTimer origin, and child workflow retry attempts carried no link to the first attempt, so history readers could not group the attempts of a retry.

  • Activity retry timers now carry the activityRetry origin with the chain's task execution ID.
  • Child workflow retry timers now carry the childWorkflowRetry origin with the first attempt's instance ID.
  • Child workflow retry attempts (2nd onward) set retryParentInstanceInfo to the first attempt's instance ID.

Backwards compatible: no action is added, removed or reordered, and replay checks only action type and name, so histories recorded with the old origin replay unchanged. Activity retries replayed from a history with no task execution ID keep the createTimer origin.

Retry delay timers were created with the plain createTimer origin, and
child workflow retry attempts carried no link to the first attempt, so
history readers could not group the attempts of a retry.

- Activity retry timers now carry the activityRetry origin with the
  chain's task execution ID.
- Child workflow retry timers now carry the childWorkflowRetry origin
  with the first attempt's instance ID.
- Child workflow retry attempts (2nd onward) set
  retryParentInstanceInfo to the first attempt's instance ID.

Backwards compatible: no action is added, removed or reordered, and
replay checks only action type and name, so histories recorded with the
old origin replay unchanged. Activity retries replayed from a history
with no task execution ID keep the createTimer origin.

Signed-off-by: joshvanl <me@joshvanl.dev>
@JoshVanL
JoshVanL requested review from a team as code owners November 21, 2026 13:09
Copilot AI balanced review requested due to automatic review settings November 21, 2026 13:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block approval of the retry-correlation metadata change.

No open issues 🎉

What changed in this PR

Adds retry correlation metadata so workflow history readers can group activity attempts, child workflow attempts, and their retry timers, while preserving replay compatibility with older histories.

Changes:

  • Tags retry timers with the activity execution ID or first child workflow instance ID.
  • Links subsequent child workflow attempts to the first attempt.
  • Adds tests for correlation metadata, legacy-history replay, and unchanged user-created timer origins.
File Description
test/​unit/​workflow/​workflowRetry.test.ts Adds retry correlation and backward-compatible replay tests.
src/​workflow/​engine/​worker/​protoHelpers.ts Supports retry timer origins and child retry parent metadata in action builders.
src/​workflow/​engine/​context/​OrchestrationRuntimeContext.ts Supplies correlation identifiers when scheduling retry timers and child attempts.

Review effort: Balanced

@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.48%. Comparing base (8f1d09a) to head (b553cce).

Files with missing lines Patch % Lines
...flow/engine/context/OrchestrationRuntimeContext.ts 94.44% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #953      +/-   ##
==========================================
+ Coverage   85.38%   85.48%   +0.09%     
==========================================
  Files         160      160              
  Lines        5872     5884      +12     
  Branches     1220     1222       +2     
==========================================
+ Hits         5014     5030      +16     
+ Misses        669      664       -5     
- Partials      189      190       +1     
Flag Coverage Δ
e2e 21.53% <3.70%> (-0.05%) ⬇️
unit 85.31% <96.29%> (+0.09%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@WhitWaldo WhitWaldo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me - thank you!

@WhitWaldo
WhitWaldo merged commit 00aa5a9 into dapr:main Nov 21, 2026
11 of 12 checks passed
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.

3 participants