Skip to content

Add Standalone Activity support to Temporal Nexus Operation Handler#2381

Open
Quinn-With-Two-Ns wants to merge 8 commits into
temporalio:mainfrom
Quinn-With-Two-Ns:NEXUS-382
Open

Add Standalone Activity support to Temporal Nexus Operation Handler#2381
Quinn-With-Two-Ns wants to merge 8 commits into
temporalio:mainfrom
Quinn-With-Two-Ns:NEXUS-382

Conversation

@Quinn-With-Two-Ns

@Quinn-With-Two-Ns Quinn-With-Two-Ns commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

What was changed

Add Standalone Activity support to Temporal Nexus Operation Handler

Why?

Allows starting Standalone Activities from Nexus Operation Handlers

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

Note

Medium Risk
Touches experimental Nexus/standalone-activity integration and extends the activity start RPC path with callbacks and conflict attachment; behavior depends on server features, with several integration checks gated or skipped until NEXUS-400.

Overview
Nexus operation handlers can now return async operations backed by stand-alone activities, parallel to the existing workflow-run path.

temporalnexus.StartActivity / StartUntypedActivity schedule client.ExecuteActivity, propagate Nexus request ID, completion callbacks, and links, attach on-conflict behavior for USE_EXISTING, emit an activity-execution operation token (type 2), and add handler links from the start response. NewTemporalOperation gains CancelActivityExecution (default: cancel via activity handle) and cancel routing by token type.

The internal activity client wires RequestId, CompletionCallbacks, Links, OnConflictOptions, and captures StartActivityExecution.Link via SDK-only setters on ClientStartActivityOptions.

Link_Activity is supported in Nexus link conversion and in convertNexusLinks.

CI sets DISABLE_ACTIVITY_BACKED_NEXUS_TESTS for docker-compose integration runs. A dedicated integration suite covers success, cancel, failures, timeouts, retries, shared activity + dual callbacks, and orphaned completion when the caller workflow is terminated; some link and LastHeartbeatDetails assertions are skipped pending server work (NEXUS-400).

Reviewed by Cursor Bugbot for commit e792df2. Bugbot is set up for automated code reviews on this repo. Configure here.

@Quinn-With-Two-Ns Quinn-With-Two-Ns changed the title Nexus 382 Add Standalone Activity support to Temporal Nexus Operation Handler Jun 16, 2026
@Quinn-With-Two-Ns Quinn-With-Two-Ns marked this pull request as ready for review June 16, 2026 16:06
@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner June 16, 2026 16:06
Comment thread temporalnexus/temporal_operation.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56fa028ede

ℹ️ 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".

Comment thread temporalnexus/temporal_operation.go Outdated
Comment thread test/integration_test.go

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 2284fed. Configure here.

Comment thread temporalnexus/temporal_operation.go Outdated
Comment thread temporalnexus/temporal_operation.go
Comment thread temporalnexus/temporal_operation.go Outdated
args ...any,
) (TemporalOperationResult[R], error) {
if nc.asyncStarted != nil && !nc.asyncStarted.CompareAndSwap(false, true) {
return TemporalOperationResult[R]{}, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeBadRequest, "only one async operation can be started per operation invocation")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe we should consider defining this error as a package var for re-use as we add more functionality to NexusClient?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I made the message a var we can reuse, I couldn't do the whole error because it is mutable

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.

2 participants