Skip to content

feat: add the dispatching Workflow Task to activity.Info for a Local Activity - #383

Closed
moetemp wants to merge 1 commit into
moe/streams/restart-basefrom
moe/activity-workflow-task-info
Closed

moetemp wants to merge 1 commit into
moe/streams/restart-basefrom
moe/activity-workflow-task-info

Conversation

@moetemp

@moetemp moetemp commented Nov 13, 2026

Copy link
Copy Markdown
Owner

This PR adds activity.Info.workflow_task for a Local Activity.

It is the Workflow Task in which the Worker dispatched this execution, as a WorkflowTaskAttempt with started_event_id, attempt and started_time. It is None for every other Activity. Core already sends the value in ActivityTask.Start.workflow_task (temporalio/sdk-rust#1703), and this PR only maps it.

Why. A Local Activity runs inside a Workflow Task. When that task fails or times out, the retried task runs the same Local Activity again, with the same Activity id and with attempt back at 1. Nothing in activity.Info tells the two executions apart or orders them. A Local Activity that has an effect outside Temporal needs that. Streams is the first user. A Local Activity that appends to a Stream writes as a Producer whose epoch is its Workflow Task, so the Store refuses a late write of the failed task, and a reader can tell the two copies apart.

The three fields.

  • started_event_id orders the Workflow Tasks of a run.
  • attempt orders the attempts of one task.
  • started_time tells a reused started event id apart. The server can drop a speculative task, and the next task then gets the same event id.

Open for review. Is this the right shape for every author of an Activity, or should activity.Info give one opaque value that is unique and ordered across the executions of a Local Activity in a run?

A Local Activity runs again with the same Activity id and with attempt 1 when its Workflow Task is
retried, and nothing in `activity.Info` tells the two executions apart or orders them.
`Info.workflow_task` has the started event id, the attempt and the started time of that task,
which Core sends for a Local Activity.
@moetemp

moetemp commented Nov 14, 2026

Copy link
Copy Markdown
Owner Author

Closed in favour of temporalio#2127

@moetemp moetemp closed this Nov 14, 2026
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.

1 participant