Skip to content

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

Open
moetemp wants to merge 2 commits into
moe/fix-flaky-worker-shutdown-testsfrom
moe/activity-workflow-task-info
Open

moetemp wants to merge 2 commits into
moe/fix-flaky-worker-shutdown-testsfrom
moe/activity-workflow-task-info

Conversation

@moetemp

@moetemp moetemp commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What changed?

This PR adds activity.Info.workflow_task for a Local Activity. It's the Workflow Task in which the Worker dispatched this execution, and it's None for every other Activity. Core already sends the value (temporalio/sdk-rust#1703), so this PR only maps it.

It's a WorkflowTaskAttempt with three fields.

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

Why?

When a Workflow Task fails or times out, the retried task runs its 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. An append from a Local Activity uses its Workflow Task as its epoch, so the Store refuses a late write of the failed task.

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

How did you test it?

test_activity_info_workflow_task runs the same Activity as a Local Activity and as a regular one, on the local dev server. Only the first gets the Workflow Task.

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

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.
Each PR with a change that users see needs a fragment.
@moetemp
moetemp marked this pull request as ready for review November 14, 2026 00:56
@moetemp
moetemp requested a review from a team as a code owner November 14, 2026 00:56
@moetemp
moetemp added this pull request to stack #2130 November 14, 2026 01:00
@moetemp
moetemp removed this pull request from stack #2130 November 15, 2026 08:27
@moetemp
moetemp changed the base branch from main to moe/fix-flaky-worker-shutdown-tests November 15, 2026 18:50
@moetemp
moetemp force-pushed the moe/activity-workflow-task-info branch 2 times, most recently from 1a718b8 to 88cc83e Compare November 15, 2026 20:23

This branch has not been deployed

No deployments
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