Skip to content

Propagate Nexus serialization context to workflow, update and activit… - #1717

Merged
JoshuaFrenchwood merged 1 commit into
mainfrom
propagate-nexus-serialization-context
Oct 27, 2026
Merged

JoshuaFrenchwood merged 1 commit into
mainfrom
propagate-nexus-serialization-context

Conversation

@JoshuaFrenchwood

@JoshuaFrenchwood JoshuaFrenchwood commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

Added an optional propagated_nexus_serialization_context field
(temporal.api.nexus.v1.PropagatedSerializationContext) to three messages Core sends to
language SDKs, and filled it in from what the server already returns:

  • InitializeWorkflow: from WorkflowExecutionStartedEventAttributes. Each run after
    continue-as-new gets it from its own started event.
  • DoUpdate: from the update request, so it's also set when the update is replayed from history.
  • Activity Start: from PollActivityTaskQueueResponse. It's only set for standalone
    activities and is left empty for local activities.

Why?

When a Nexus operation handler starts a workflow, sends a workflow update, or starts a
standalone activity, the result and failure of that execution go back to the Nexus caller. The
caller decodes them with the operation's NexusSerializationContext, but the worker encodes them
with the workflow or activity context. A codec that depends on the context, such as
per-endpoint encryption, then can't decode them.

Checklist

  1. Closes

  2. How was this tested:

  • New unit tests showing the context is passed through:
    • start_from_poll_resp_propagates_nexus_serialization_context
    • start_workflow_from_attribs_propagates_nexus_serialization_context
    • update_activation_has_propagated_nexus_serialization_context (the update arrives as a protocol message on a mocked poll)
  • cargo test -p temporalio-sdk-core --lib (534 passed), cargo test -p temporalio-protos --lib
    and cargo test -p temporalio-sdk --lib all pass.
  1. Any docs updates needed?

@JoshuaFrenchwood
JoshuaFrenchwood requested a review from a team as a code owner October 27, 2026 20:20
@JoshuaFrenchwood JoshuaFrenchwood added the skip-changelog PR changes do not require changelog updates label Oct 27, 2026
// Serialization context of the Nexus operation handler that started this activity, if any.
// Only set for standalone activities. Lang should use it to serialize the activity's result and
// failure, which are returned to the Nexus caller.
temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 20;

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.

It seems like this is added but not actually used?

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.

Yes nothing in this repo uses it currently. The SDKs built on Core (Python, TypeScript, .NET) will use it to encode the activity's result and failure with the Nexus serialization context of the handler that started it.

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.

Ah, I see. And we can't add that to the Rust SDK yet because we don't have Nexus in the Rust SDK completely yet. Makes sense

@JoshuaFrenchwood
JoshuaFrenchwood merged commit d28e7be into main Oct 27, 2026
32 of 33 checks passed
@JoshuaFrenchwood
JoshuaFrenchwood deleted the propagate-nexus-serialization-context branch October 27, 2026 23:08
JoshuaFrenchwood added a commit to temporalio/sdk-typescript that referenced this pull request Oct 30, 2026
Picks up temporalio/sdk-rust#1717, which passes the Nexus serialization
context propagated by the server to lang on InitializeWorkflow, DoUpdate
and the activity Start task.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog PR changes do not require changelog updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants