Implement new task queue kind to send worker commands#9899
Merged
Conversation
Replace Kind() == STICKY checks with IsEphemeral() where the behavior applies to all ephemeral partition types (sticky, and future types like worker-commands), not just sticky queues specifically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6fd76ef to
872065b
Compare
7d9ffcf to
a51f55b
Compare
This was referenced Apr 10, 2026
a163283 to
2b99d6a
Compare
a51f55b to
d3d045d
Compare
…ants These are used in IsEphemeral() code paths that apply to all ephemeral partition types, not just sticky queues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2b99d6a to
8e2ff4f
Compare
d3d045d to
6a515ee
Compare
81d28e9 to
fb145ab
Compare
a1a9cca to
994395c
Compare
Replace the single IsEphemeral() method on the Partition interface with four specific property methods: HasTTLExpiry(), SupportsFairness(), SupportsVersioning(), and SupportsPartitions(). Each call site now uses the property that governs its behavior, making it clearer why a check exists and easier to set correct values for new partition types. PartitionCount() returns 1 when SupportsPartitions() is false, enforcing the single-partition constraint explicitly. Describe task queue checks use Kind() == NORMAL since only user-facing queues can be described — this is about the queue's visibility, not a specific property. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
994395c to
2a7094c
Compare
fb145ab to
5f7413c
Compare
The name field was always identical to taskQueue.Name() since worker-commands queues have no separate identity like sticky queues do. Add tests for PartitionFromProto with WORKER_COMMANDS kind and for partition property methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…s-partition-metrics # Conflicts: # common/metrics/task_queues.go # common/tqid/task_queue_id.go # go.mod # go.sum # service/matching/db.go # service/matching/matching_engine.go
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>
ShahabT
approved these changes
Apr 16, 2026
dnr
approved these changes
Apr 16, 2026
Co-authored-by: David Reiss <david@temporal.io>
The internal TaskQueuePartition proto's oneof doesn't have a worker-commands variant yet. Add a TODO noting this gap for when the admin RPCs need to support worker-commands partitions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Without this, loading a worker-commands partition manager would panic in PersistenceName due to unhandled type switch case. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The test confirms that PersistenceName panics without the WorkerCommandsPartition case (reproduced before fix). Also fixes an unused variable from merge in UnsafePartitionFromProto. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…s-partition-metrics
Update TestDispatchCancelToWorker to poll the control queue with the correct Kind instead of NORMAL. This exercises the full WorkerCommandsPartition code path through matching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add WorkerCommandsPartitionId empty message and use it as a new variant in the TaskQueuePartition oneof, so internal RPCs can represent worker-commands partitions. Handle the new variant in PartitionFromPartitionProto. Also update the TaskQueuePartition comment to describe it as the internal equivalent of the public TaskQueue proto. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
91fff51 to
34b0229
Compare
…s-partition-metrics # Conflicts: # api/taskqueue/v1/message.pb.go
dnr
reviewed
Apr 20, 2026
temporal-nick
pushed a commit
that referenced
this pull request
Apr 21, 2026
## What Add support for `TASK_QUEUE_KIND_WORKER_COMMANDS` in the matching service. This is a new task queue kind for server-to-worker communication (e.g. activity cancellations). It is represented by a new `WorkerCommandsPartition` type in the `tqid` package — analogous to how `StickyPartition` represents sticky queues. Also adds a distinct `partition` metric tag for worker-commands queues so their traffic can be distinguished from user-facing normal queues in metrics. Depends on [#9900](#9900). ## Why Worker_Commands queue kind has different properties compared to a normal user defined queue. So we created a separate kind. This allows us to distinguish task queue metrics based on whether they are internal or user created queue. ## How did you test it? Unit tests covering metric tag generation for normal, sticky, and worker-commands partitions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: David Reiss <david@temporal.io>
rkannan82
added a commit
that referenced
this pull request
May 1, 2026
## What Use `TASK_QUEUE_KIND_WORKER_COMMANDS` enum check instead of string prefix matching on the task queue to determine if its internal queue. ## Why PR #9899 introduced `TASK_QUEUE_KIND_WORKER_COMMANDS`. The original code (PR #9760) predated this and relied on the `/temporal-sys/` name prefix as a workaround. ## How did you test it? Existing tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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
Add support for
TASK_QUEUE_KIND_WORKER_COMMANDSin the matching service. This is a new task queue kind for server-to-worker communication (e.g. activity cancellations). It is represented by a newWorkerCommandsPartitiontype in thetqidpackage — analogous to howStickyPartitionrepresents sticky queues.Also adds a distinct
partitionmetric tag for worker-commands queues so their traffic can be distinguished from user-facing normal queues in metrics.Depends on #9900.
Why
Worker_Commands queue kind has different properties compared to a normal user defined queue. So we created a separate kind. This allows us to distinguish task queue metrics based on whether they are internal or user created queue.
How did you test it?
Unit tests covering metric tag generation for normal, sticky, and worker-commands partitions.
🤖 Generated with Claude Code