Add WorkerCommandsTask outbound task to dispatch worker commands via Nexus#9232
Merged
Add WorkerCommandsTask outbound task to dispatch worker commands via Nexus#9232
Conversation
9eea93d to
835d5bf
Compare
This was referenced Feb 5, 2026
d402868 to
54b6d1a
Compare
5bae03a to
a5e43dd
Compare
417606c to
6246c4e
Compare
f1e1ee5 to
e795849
Compare
fec3c41 to
1dd975d
Compare
yycptt
reviewed
Feb 12, 2026
proto/internal/temporal/server/api/persistence/v1/executions.proto
Outdated
Show resolved
Hide resolved
service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.go
Outdated
Show resolved
Hide resolved
service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.go
Outdated
Show resolved
Hide resolved
service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.go
Show resolved
Hide resolved
11c74b6 to
2cb3108
Compare
rkannan82
commented
Feb 12, 2026
d0f60d7 to
fa4be0a
Compare
89d2cf5 to
79e4e3e
Compare
bf3c061 to
1218cae
Compare
9231795 to
bc58c4f
Compare
04db6f1 to
b72cf9f
Compare
bc58c4f to
3eb028c
Compare
yycptt
reviewed
Feb 18, 2026
service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.go
Show resolved
Hide resolved
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7040cec to
0b36762
Compare
…l/persist-worker-key # Conflicts: # go.sum
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Main already has the direct dependency at the same version. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve conflicts: - task.proto: bump TASK_TYPE_WORKER_COMMANDS from 34 to 35 (34 taken by REPLICATION_DELETE_EXECUTION) - executions.proto: merge imports, keep both outbound task details and worker_control_task_queue field - mutable_state_impl_test.go: keep both new test functions - go.mod: update go.temporal.io/api to v1.62.8-0.20260407190616-8574d6aa8b01 - Regenerated .pb.go files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Semgrep found 1 No explicit |
…l/persist-worker-key
…orker-key' into kannan/activity-cancel/task-definition # Conflicts: # api/enums/v1/task.go-helpers.pb.go # api/enums/v1/task.pb.go # api/persistence/v1/executions.pb.go # go.mod # go.sum # proto/internal/temporal/server/api/enums/v1/task.proto # proto/internal/temporal/server/api/persistence/v1/executions.proto # service/matching/matching_engine_test.go # service/matching/task_queue_partition_manager.go # tests/query_workflow_test.go
rkannan82
added a commit
that referenced
this pull request
Apr 11, 2026
…worker (#9231) ## What changed? As part of RecordActivityTaskStarted flow, store worker_control_task_queue for an activity in the mutable state (ActivityInfo). Main changes: - executions.proto: Added the new worker_control_task_queue field. - mutable_state_impl.go: Update mutable state. - matching/forwarder.go: Propagate worker_control_task_queue when polls get forwarded. Otherwise, RecordActivityTaskStarted request will not have it set when invoked from a forwarded poll. ## Why? To support activity cancellation without activity heartbeat. Overall flow: - [This PR] Store worker attributes in ActivityInfo as part of RecordActivityTaskStarted call. - [#9232] When user cancels a workflow, create 1 or more tasks. Group all activities belonging to a worker into the task (for efficiency). - [#9233] Lookup the Nexus task queue for each worker, and send a Nexus operation for each transfer task. - [SDK] Worker will receive this cancel task and cancel the running activities. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [ ] covered by existing tests - [x] added new unit test(s) - [ ] added new functional test(s) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Base automatically changed from
kannan/activity-cancel/persist-worker-key
to
main
April 11, 2026 00:51
…l/task-definition # Conflicts: # go.mod # go.sum # service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler_test.go # tests/query_workflow_test.go
The pre-release version was missing ContinueAsNewInitialVersioningBehavior fields that landed in the released tag. The released v1.62.8 includes both our WorkerCommand proto and the versioning fields from main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reset matching_engine_test.go, task_queue_partition_manager.go, and protogen to match main — these were pulled in by duplicate merge commits and are not part of this PR's changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
yycptt
approved these changes
Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
New outbound task type (
WorkerCommandsTask) that carries worker commands to be dispatched to workers via Nexus. Uses the genericWorkerCommandproto (not cancel-activity-specific), so this task type can carry any future command types.Suggested review order: proto changes →
worker_commands_task.go→task_generator.go→workflow_task_completed_handler.goKey pieces:
TASK_TYPE_WORKER_COMMANDSenum,WorkerCommandsTaskinOutboundTaskInfowithrepeated WorkerCommand.worker_commands_task.go— implements outboundTaskandHasDestinationinterfaces.workflow_task_completed_handler.go,task_generator.go): WhenRequestCancelActivityTaskis processed for a started activity whose worker has a control queue, collects aCancelActivityCommandwith the activity's task token. Commands are batched by destination control queue and flushed as oneWorkerCommandsTaskper queue at the end of WFT processing.task_serializers.gofor persistence round-tripping.Dispatch is a no-op here — handled in #9233. Gated by dynamic config
EnableCancelActivityWorkerCommand(default: off).Why?
To support proactive activity cancellation without waiting for heartbeat. This is the task creation leg of the flow.
worker_control_task_queueinActivityInfoat activity start.RequestCancelActivityTask, batch commands by control queue intoWorkerCommandsTaskoutbound tasks.ExecuteCommandsoperation to the worker, with a 3-attempt retry cap.Gated by dynamic config
EnableCancelActivityWorkerCommand(default: off).How did you test it?
Unit tests cover task generation, command batching (including multi-queue batching), task serialization round-tripping, and the feature-flag-off path.