Skip to content

feat(workflows) Support task execution IDs #802

@WhitWaldo

Description

@WhitWaldo

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

  1. 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
  2. Expose execution IDs on the Task objects returned by callActivity, callSubWorkflow, createTimer, waitForExternalEvent
  3. Use execution IDs for correlation when matching completion events to pending tasks during replay
  4. 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

  • Task execution IDs are generated and included in scheduled task messages
  • Task objects expose an executionId property
  • Completion correlation uses execution IDs where available
  • Backward compatibility is maintained (instances started without execution IDs continue to work)
  • Unit tests verify execution ID generation and correlation
  • Integration tests verify task execution IDs flow through the system

References

Dapr Proposal: Task Execution IDs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions