Skip to content

Add attributes needed by server to propagate control tasks to worker#711

Merged
rkannan82 merged 9 commits intomasterfrom
kannan/add-worker-instance-key-to-wft-complete
Apr 6, 2026
Merged

Add attributes needed by server to propagate control tasks to worker#711
rkannan82 merged 9 commits intomasterfrom
kannan/add-worker-instance-key-to-wft-complete

Conversation

@rkannan82
Copy link
Copy Markdown
Contributor

@rkannan82 rkannan82 commented Feb 9, 2026

What changed?

Added worker_control_task_queue to poll requests:

Added worker_instance_key and worker_control_task_queue to:

  • RespondWorkflowTaskCompletedRequest: This API is used to eagerly fetch activity.

Why?
To enable server to send control tasks to worker. Each worker provides a worker_control_task_queue (a dedicated per-worker Nexus task queue) so the server can send control tasks directly to it.

Example flow:

  • User cancels a workflow.
  • Server sends activity cancellation tasks to all workers that could be processing activities belonging to that workflow.
  • Worker will receive the cancellation message even when activity heartbeat is not enabled.

Breaking changes: None
Server PR

@rkannan82 rkannan82 requested review from a team as code owners February 9, 2026 19:18
@rkannan82 rkannan82 force-pushed the kannan/add-worker-instance-key-to-wft-complete branch from 76cff4d to d940f4e Compare February 9, 2026 19:18
@rkannan82 rkannan82 marked this pull request as draft February 9, 2026 19:20
@rkannan82 rkannan82 marked this pull request as ready for review February 9, 2026 19:28
@rkannan82 rkannan82 force-pushed the kannan/add-worker-instance-key-to-wft-complete branch from d940f4e to 6fb0a9a Compare February 11, 2026 02:33
@rkannan82 rkannan82 changed the title Add worker_instance_key to RespondWorkflowTaskCompletedRequest Add attributes needed by server to propagate nexus tasks to worker Feb 11, 2026
@rkannan82 rkannan82 requested a review from cretz February 11, 2026 02:54
@rkannan82 rkannan82 force-pushed the kannan/add-worker-instance-key-to-wft-complete branch from 6fb0a9a to 3425c98 Compare February 11, 2026 02:55
Copy link
Copy Markdown
Contributor

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No big blockers, though I noticed the "Server PR" section of the PR template was removed from the description of this PR. I do think we should wait for most of server impl to understand this has everything needed (no use merging before then).

@rkannan82 rkannan82 force-pushed the kannan/add-worker-instance-key-to-wft-complete branch from 98f7a60 to 61952c9 Compare February 11, 2026 21:20
Copy link
Copy Markdown
Contributor

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but mentioned in last review, the "Server PR" section removed from description template, would like to see implementation get a bit further and linked if possible

@rkannan82
Copy link
Copy Markdown
Contributor Author

No big blockers, though I noticed the "Server PR" section of the PR template was removed from the description of this PR. I do think we should wait for most of server impl to understand this has everything needed (no use merging before then).

Chad, How can I make progress on the server PRs without submitting this API change? I might have asked this before, but what is the recommended protocol? Should I have started the server PRs in my own repo (forked) and have that reference this unsubmitted

LGTM, but mentioned in last review, the "Server PR" section removed from description template, would like to see implementation get a bit further and linked if possible

I added the server PR to the description. temporalio/temporal#9231

@rkannan82 rkannan82 requested a review from cretz February 12, 2026 18:59
This enables the server to track which worker is executing eager-dispatched
activities, allowing activity cancellation to be routed correctly.
@rkannan82 rkannan82 force-pushed the kannan/add-worker-instance-key-to-wft-complete branch from 61952c9 to 98350a9 Compare February 12, 2026 19:46
@cretz
Copy link
Copy Markdown
Contributor

cretz commented Feb 12, 2026

Should I have started the server PRs in my own repo (forked) and have that reference this unsubmitted

Yeah, basically this. It just means you have a PR mostly done but referencing your API branch instead of API master. It's just a good way to make sure we don't "oh yeah" during implementation (even when we think we're so sure what we want from he API). May be able to ask server peers on common approach here, e.g. feature branches.

Copy link
Copy Markdown
Contributor

@yuandrew yuandrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but agree with Chad on server-side PR being close to merging before this goes in

@rkannan82 rkannan82 changed the title Add attributes needed by server to propagate nexus tasks to worker Add attributes needed by server to propagate control tasks to worker Apr 6, 2026
rkannan82 and others added 2 commits April 6, 2026 11:27
Clarify that this is a dedicated per-worker Nexus task queue for
receiving control tasks like activity cancellation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…edRequest

resource_id already uses field 18. Renumber worker_instance_key to 19
and worker_control_task_queue to 20.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rkannan82 rkannan82 enabled auto-merge (squash) April 6, 2026 18:33
@rkannan82 rkannan82 requested review from yycptt and removed request for cretz April 6, 2026 18:33
@rkannan82 rkannan82 merged commit 9461f7b into master Apr 6, 2026
4 checks passed
@rkannan82 rkannan82 deleted the kannan/add-worker-instance-key-to-wft-complete branch April 6, 2026 23:06
rkannan82 added a commit to temporalio/temporal that referenced this pull request Apr 6, 2026
Resolves merge conflicts in executions.proto, mutable_state_impl_test.go,
and go.sum. Updates api-go replace directive to 5423d0dd678a which includes
the worker control task queue attributes from temporalio/api#711.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rkannan82 added a commit to temporalio/temporal that referenced this pull request Apr 7, 2026
Match the comment style from temporalio/api#711.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
spkane31 pushed a commit that referenced this pull request Apr 9, 2026
…711)

<!-- Describe what has changed in this PR -->
**What changed?**

Added worker_control_task_queue to poll requests:
- PollActivityTaskQueueRequest
- PollWorkflowTaskQueueRequest
Note: worker_instance_key was already added to these requests in #686.

Added worker_instance_key and worker_control_task_queue to: 
- RespondWorkflowTaskCompletedRequest: This API is used to eagerly fetch
activity.

<!-- Tell your future self why have you made these changes -->
**Why?**
To enable server to send control tasks to worker. Each worker provides a
worker_control_task_queue (a dedicated per-worker Nexus task queue) so
the server can send control tasks directly to it.

Example flow:
- User cancels a workflow.
- Server sends activity cancellation tasks to all workers that could be
processing activities belonging to that workflow.
- Worker will receive the cancellation message even when activity
heartbeat is not enabled.

<!-- Are there any breaking changes on binary or code level? -->
Breaking changes: None
[Server PR](temporalio/temporal#9231)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

5 participants