Summary
Implement support for task execution IDs in the Dapr JS SDK Workflow implementation, enabling unique identification of individual task executions within a workflow instance.
Background
When a workflow schedules a task (activity, timer, sub-workflow, external event wait), it currently identifies that task by its sequence number in the orchestration history. Task execution IDs provide a richer identification mechanism that:
- Uniquely identifies each task execution across the lifetime of a workflow instance
- Enables more precise correlation of completions to scheduled tasks
- Supports advanced scenarios like task cancellation, status queries on individual tasks, and exactly-once delivery guarantees
- Provides better observability and debugging (trace individual task executions)
See the Dapr proposal for the full design and motivation.
Proposed Changes
- Generate execution IDs when scheduling tasks via
WorkflowContext - check this: I think they might be created by the runtime, meaning we can skip this step in the implementation
- Expose execution IDs on the
Task objects returned by callActivity, callSubWorkflow, createTimer, waitForExternalEvent
- Use execution IDs for correlation when matching completion events to pending tasks during replay
- Surface execution IDs in
DaprWorkflowClient for task-level status queries (if supported by the API)
Proposed API
function* myWorkflow(ctx: WorkflowContext, input: any) {
const task = ctx.callActivity(processData, input);
// Access the execution ID for logging/correlation
console.log(`Scheduled activity with execution ID: ${task.executionId}`);
const result = yield task;
return result;
}
Acceptance Criteria
References
Dapr Proposal: Task Execution IDs
Summary
Implement support for task execution IDs in the Dapr JS SDK Workflow implementation, enabling unique identification of individual task executions within a workflow instance.
Background
When a workflow schedules a task (activity, timer, sub-workflow, external event wait), it currently identifies that task by its sequence number in the orchestration history. Task execution IDs provide a richer identification mechanism that:
See the Dapr proposal for the full design and motivation.
Proposed Changes
WorkflowContext- check this: I think they might be created by the runtime, meaning we can skip this step in the implementationTaskobjects returned bycallActivity,callSubWorkflow,createTimer,waitForExternalEventDaprWorkflowClientfor task-level status queries (if supported by the API)Proposed API
Acceptance Criteria
executionIdpropertyReferences
Dapr Proposal: Task Execution IDs