Skip to content

Add Nexus worker service for server-to-worker commands - #708

Merged
rkannan82 merged 12 commits into
masterfrom
kannan/activity-cancel
Apr 7, 2026
Merged

Add Nexus worker service for server-to-worker commands#708
rkannan82 merged 12 commits into
masterfrom
kannan/activity-cancel

Conversation

@rkannan82

@rkannan82rkannan82 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Defines a Nexus service for server-to-worker communication, starting with activity cancellation support.

Design Decision

We chose a generic command API (ExecuteCommandsRequest with oneof command types) instead of a cancel-specific API. This allows a future optimization to batch multiple commands (cancel, pause, etc) in a single request and deliver to a worker in one RPC.

Files

  • temporal/api/nexusservices/workerservice/v1/request_response.proto - request response definitions
  • nexus-rpc/temporal-proto-models-nexusrpc.yaml - Nexus service definition

Related

@rkannan82
rkannan82 requested review from a team as code ownersFebruary 3, 2026 21:30
@rkannan82
rkannan82force-pushed the kannan/activity-cancel branch 3 times, most recently from 4b2e0d1 to 54edb8eCompareFebruary 3, 2026 21:42
Comment threadtemporal/api/worker/v1/message.proto Outdated
Comment threadtemporal/api/worker/v1/message.proto Outdated
Comment threadtemporal/api/worker/v1/message.proto Outdated
Comment threadtemporal/api/worker/v1/message.proto Outdated
Comment threadtemporal/api/worker/v1/message.proto Outdated
Comment threadtemporal/api/worker/v1/message.proto Outdated
Comment threadtemporal/api/worker/v1/message.proto Outdated
@rkannan82
rkannan82force-pushed the kannan/activity-cancel branch 2 times, most recently from afb40a2 to b920471CompareFebruary 4, 2026 05:43
@rkannan82rkannan82 changed the title Add API to send control tasks from server to workerAdd Nexus request and response payloads to cancel activitiesFeb 4, 2026
@rkannan82
rkannan82 requested a review from cretzFebruary 4, 2026 05:50
@rkannan82
rkannan82force-pushed the kannan/activity-cancel branch from b920471 to 84c0bacCompareFebruary 4, 2026 05:51
@rkannan82
rkannan82 marked this pull request as draft February 4, 2026 05:55
@rkannan82
rkannan82 removed the request for review from ShahabTFebruary 5, 2026 18:05

@cretzcretz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, though would want to see end-to-end working including in an SDK if possible before approving

Comment threadtemporal/api/worker/v1/worker_nexus_service_commands.proto Outdated
Comment threadtemporal/api/worker/v1/worker_nexus_service_commands.proto Outdated
@rkannan82
rkannan82force-pushed the kannan/activity-cancel branch from 84c0bac to 28ea1ddCompareFebruary 11, 2026 21:20
@rkannan82
rkannan82 changed the base branch from master to kannan/add-worker-instance-key-to-wft-completeFebruary 11, 2026 21:23
@rkannan82
rkannan82 marked this pull request as ready for review February 12, 2026 19:39
@rkannan82
rkannan82force-pushed the kannan/activity-cancel branch from 7d3bfb7 to e0d0049CompareFebruary 12, 2026 19:43
This enables the server to track which worker is executing eager-dispatched
activities, allowing activity cancellation to be routed correctly.
@rkannan82
rkannan82force-pushed the kannan/add-worker-instance-key-to-wft-complete branch from 61952c9 to 98350a9CompareFebruary 12, 2026 19:46
@rkannan82
rkannan82force-pushed the kannan/activity-cancel branch from e0d0049 to 6c21af4CompareFebruary 12, 2026 19:47

@bergundybergundy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, don't merge this until you've generated the code and verified that this API works across SDK and server.

There will probably be a separate code generation project that will construct the YAML from protos to prevent the need to define services in separate places but this is a good start IMHO.

@cretzcretz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is our first Nexus service, so lots of things undecided. I added comments, but would like to hear others' opinions.

Comment threadtemporal/api/worker/v1/worker_service.nexusrpc.yaml Outdated
Comment threadtemporal/api/worker/v1/worker_service.nexusrpc.yaml Outdated
Comment threadtemporal/api/worker/v1/worker_service.nexusrpc.yaml Outdated
Comment threadtemporal/api/worker/v1/worker_service.nexusrpc.yaml
Comment threadtemporal/api/worker/v1/worker_service.nexusrpc.yaml
@rkannan82
rkannan82force-pushed the kannan/activity-cancel branch 2 times, most recently from 37ffb33 to 6c21af4CompareFebruary 27, 2026 22:19
@rkannan82rkannan82 changed the title Add Nexus request and response payloads to cancel activitiesAdd Nexus worker service for server-to-worker commandsFeb 27, 2026
Comment threadtemporal/api/nexusservices/workerservice/v1/request_response.proto Outdated
Comment threadtemporal/api/nexusservices/workerservice/v1/service.yaml Outdated
Comment threadtemporal/api/nexusservices/workerservice/v1/request_response.proto Outdated
Comment threadtemporal/api/nexusservices/workerservice/v1/request_response.proto Outdated
Comment threadtemporal/api/nexusservices/workerservice/v1/request_response.proto Outdated
Comment threadtemporal/api/nexusservices/workerservice/v1/request_response.proto Outdated
Comment threadtemporal/api/nexusservices/workerservice/v1/request_response.proto Outdated
@rkannan82
rkannan82force-pushed the kannan/activity-cancel branch from 32523fb to cfff488CompareMarch 13, 2026 18:09
- Rename WorkerCommandsRequest/Response to ExecuteCommandsRequest/Response
to match the operation name (bergundy feedback)
- Change operation name from executeCommands to ExecuteCommands (PascalCase)
- Add doc: results list must be 1:1 with commands list (Sushisource feedback)
Made-with: Cursor
Move WorkerCommand, CancelActivityCommand, WorkerCommandResult, and
CancelActivityResult to temporal.api.worker.v1 as top-level messages.
request_response.proto now only contains ExecuteCommandsRequest and
ExecuteCommandsResponse, following the repo convention. (bergundy feedback)
Made-with: Cursor
@rkannan82
rkannan82 requested a review from bergundyApril 6, 2026 17:12

@SushisourceSushisource left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking good to me

@bergundybergundy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just one comment on the location of the schema file.

Comment threadnexus-rpc/temporal-proto-models-nexusrpc.yaml
Base automatically changed from kannan/add-worker-instance-key-to-wft-complete to masterApril 6, 2026 23:06
rkannan82and others added 3 commits April 6, 2026 16:14
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Removed comment about service definition in request_response.proto.
@rkannan82
rkannan82 merged commit 43b4618 into masterApr 7, 2026
4 checks passed
@rkannan82
rkannan82 deleted the kannan/activity-cancel branch April 7, 2026 19:04
spkane31 pushed a commit that referenced this pull request Apr 9, 2026
## Summary
Defines a Nexus service for server-to-worker communication, starting
with activity cancellation support.
## Design Decision
We chose a **generic command API** (`ExecuteCommandsRequest` with
`oneof` command types) instead of a cancel-specific API. This allows a
future optimization to batch multiple commands (cancel, pause, etc) in a
single request and deliver to a worker in one RPC.
## Files
- `temporal/api/nexusservices/workerservice/v1/request_response.proto` -
request response definitions
- `nexus-rpc/temporal-proto-models-nexusrpc.yaml` - Nexus service
definition
## Related
- [Server PR](temporalio/temporal#9233)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for freeto 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

@rkannan82@bergundy@cretz@Sushisource@yuandrew