Add Standalone Activities support to Temporal Nexus Operation Handler - #748
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f807fc513
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3f807fc to
84020ad
Compare
4f25c95 to
8520a4b
Compare
| options.RequestId = nexusStartContext.RequestId; | ||
|
|
||
| // Do the start call | ||
| var handle = await client.StartActivityAsync( |
There was a problem hiding this comment.
In the Go implementation, we check for timeout presence to raise a handler error and surface the validation error. Is that necessary here as well?
There was a problem hiding this comment.
The SDK already does some of this validation, Started a discussion in slack on where we want to do the validation.
jmaeagle99
left a comment
There was a problem hiding this comment.
Mostly rename requests and I think there is opportunity for unifying the token types or at least refactoring to be more symmetrical and untied from handles (which can all be deferred).
| try | ||
| { | ||
| token = NexusWorkflowRunHandle.ParseToken(context.OperationToken); | ||
| tokenType = NexusWorkflowRunHandle.LoadTokenType(context.OperationToken); |
There was a problem hiding this comment.
I think the token parsing and related logic could use a refactor such that we use a discriminated union, something like:
[JsonPolymorphic(TypeDiscriminatorPropertyName = "t")]
[JsonDerivedType(typeof(WorkflowExecutionToken), 1)]
[JsonDerivedType(typeof(ActivityExecutionToken), 2)]
internal abstract record NexusOperationToken(string Namespace, int? Version);
Then when parsing the STJ, you'll get the exact token class out rather than having to pick out the t field yourself and then construct each type separately.
There was a problem hiding this comment.
I would be fine with deferring a refactor of this along with https://github.com/temporalio/sdk-dotnet/pull/748/changes/BASE..8520a4bcc34de23a824cf065f2e377f5f615a09b#r3477893944 as a separate change.
| { | ||
| NexusWorkflowRunHandle.WorkflowRunOperationTokenType => | ||
| CancelWorkflowRunAsync( | ||
| case NexusWorkflowRunHandle.WorkflowRunOperationTokenType: |
There was a problem hiding this comment.
Looking at the naming of the this token and helper methods vs the new one for standalone activities, they feel very asymmetrical when they really share a lot in common. For example, I think that the workflow run operation token should be separated from the handle notion and standard on either the "run" or "execution" name for both token types.
There was a problem hiding this comment.
I would be fine with deferring a refactor on this along with https://github.com/temporalio/sdk-dotnet/pull/748/changes/BASE..8520a4bcc34de23a824cf065f2e377f5f615a09b#r3477886756 as a separate change.
|
I assume that |
8ad5083 to
9133c5a
Compare
9133c5a to
fe2270f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 5306faa. Configure here.

What was changed
Add Standalone Activities support to Temporal Nexus Operation Handler
Why?
Allow calling Standalone Activities as a Nexus Operation
Checklist
Closes
How was this tested:
Note
Medium Risk
Touches experimental Nexus operation lifecycle (tokens, callbacks, cancel, link propagation) and extends standalone activity client RPC shaping; behavior is covered by new tests but cross-server link support may still vary.
Overview
Adds standalone activities as async Nexus operations via new
ITemporalNexusClient.StartActivityAsyncoverloads (expression and by-name), with activity-execution operation tokens, completion callbacks, and idempotent start plumbing aligned with workflow-backed operations.TemporalOperationHandlercancel now routes by token type and supports activity tokens; default cancel callsCancelAsyncon the underlying activity, with an overridableCancelActivityExecutionAsync.StartActivityOptionsgains internal fields for Nexus (request ID, links, callbacks, on-conflict options), and activity/workflow starts inside a Nexus handler attach outbound links from server responses (workflow start also falls back to a synthetic started-event link on older servers).Shared Nexus start logic is factored into
NexusOperationStartHelper; workflow docs now say task queue defaults to the operation queue when omitted. Activity proto links round-trip throughProtoLinkExtensions, and package-validation suppressions cover the new public API.Reviewed by Cursor Bugbot for commit abff167. Bugbot is set up for automated code reviews on this repo. Configure here.