Skip to content

fix: assign new event IDs for activity retries and add TaskExecutionId#46

Merged
acroca merged 2 commits intodapr:mainfrom
JoshVanL:task-execution-id
Mar 6, 2026
Merged

fix: assign new event IDs for activity retries and add TaskExecutionId#46
acroca merged 2 commits intodapr:mainfrom
JoshVanL:task-execution-id

Conversation

@JoshVanL
Copy link

@JoshVanL JoshVanL commented Mar 6, 2026

Previously, retried activities reused the same event ID as the original attempt, diverging from durabletask-go, durabletask-java, and durabletask-dotnet which all assign a new sequence number per retry. This change aligns the Python SDK with the other SDKs by generating a new event ID for each retry attempt.

Additionally, implements TaskExecutionId — a deterministic UUID that remains stable across all retry attempts of the same logical activity call, enabling idempotency and deduplication in activity execution.

Previously, retried activities reused the same event ID as the original
attempt, diverging from durabletask-go, durabletask-java, and
durabletask-dotnet which all assign a new sequence number per retry.
This change aligns the Python SDK with the other SDKs by generating a
new event ID for each retry attempt.

Additionally, implements TaskExecutionId — a deterministic UUID that
remains stable across all retry attempts of the same logical activity
call, enabling idempotency and deduplication in activity execution.

Signed-off-by: joshvanl <me@joshvanl.dev>
@JoshVanL JoshVanL requested a review from a team as a code owner March 6, 2026 13:13
Copilot AI review requested due to automatic review settings March 6, 2026 13:13
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

This PR aligns the Python SDK's activity retry behavior with durabletask-go, durabletask-java, and durabletask-dotnet by assigning a new sequence number (event ID) for each retry attempt instead of reusing the original event ID. It also introduces TaskExecutionId — a deterministic UUID that remains stable across retry attempts of the same logical activity call, enabling idempotency and deduplication.

Changes:

  • Refactored RetryableTask to store task metadata (name, encoded input, instance ID, app ID, task execution ID) as instance fields instead of holding a reference to the protobuf action, and added task_execution_id to ActivityContext.
  • Updated retry logic in _OrchestrationExecutor.process_event and call_activity_function_helper to generate new sequence numbers per retry and pass through the stable task_execution_id.
  • Updated all retry-related tests to reflect the new ID numbering scheme and added timerCreated/taskScheduled events to test histories for proper replay fidelity.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
durabletask/task.py Replaced _action reference in RetryableTask with individual metadata fields; added task_execution_id property to ActivityContext.
durabletask/worker.py Generate task_execution_id via new_guid() in call_activity; pass it through retry chain; use id=None on retries for new sequence numbers; pass taskExecutionId to ActivityContext.
durabletask/internal/helpers.py Added task_execution_id parameter to new_schedule_task_action and set it on ScheduleTaskAction.
tests/durabletask/test_orchestration_executor.py Updated all retry tests to expect new sequence numbers per retry attempt, added timerCreated/taskScheduled events, and verified updated error messages with correct task IDs.

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

You can also share your feedback on Copilot code review. Take the survey.

Signed-off-by: joshvanl <me@joshvanl.dev>
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 no new comments.


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

@acroca acroca merged commit c67b696 into dapr:main Mar 6, 2026
11 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