Skip to content

Propagate Nexus serialization context to workflow updates - #3172

Merged
JoshuaFrenchwood merged 1 commit into
nexus-serialization-context-updatesfrom
nexus-serialization-context-workflow-update
Oct 29, 2026
Merged

JoshuaFrenchwood merged 1 commit into
nexus-serialization-context-updatesfrom
nexus-serialization-context-workflow-update

Conversation

@JoshuaFrenchwood

Copy link
Copy Markdown
Contributor

What was changed

Nexus operation handlers now propagate their NexusSerializationContext to the workflow updates
they send.

  • Workflow updates: the update request carries the context. The worker encodes the update's
    result, failure and rejection with it, and update handles decode with the context returned on the
    update and poll responses.
  • Update arguments keep the workflow context.

Why?

A Nexus handler returns the result and failure of the update it sends to the Nexus caller. The
caller decodes them with the operation's NexusSerializationContext, so a codec keyed on the
context couldn't decode them when they were encoded with the workflow context.

Checklist

  1. Closes

  2. How was this tested:

  • Unit tests for the client invoker's update request, completed update and poll.
  • WorkflowUpdateNexusSerializationContextTest: the in-memory server sends real updates with the
    context set, covering update result, failure, rejection and replay.
  • End-to-end NexusSerializationContextPropagationTest on the dev server: a caller workflow goes
    through a Nexus endpoint to a handler that sends a workflow update.
  1. Any docs updates needed?

@JoshuaFrenchwood
JoshuaFrenchwood requested a review from a team as a code owner October 27, 2026 20:52
@JoshuaFrenchwood
JoshuaFrenchwood force-pushed the nexus-serialization-context-workflow-update branch from 9cb96e2 to cee99cc Compare October 27, 2026 21:02

@Evanthx Evanthx 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!

@JoshuaFrenchwood
JoshuaFrenchwood force-pushed the nexus-serialization-context-workflow-update branch 2 times, most recently from f31c42b to 67e8832 Compare October 28, 2026 19:54
Comment on lines +16 to +21
* <p>When a handler starts a workflow, sends a workflow update or starts a standalone activity,
* this context is propagated to it through the server. They use it only for their result and
* failures, which are returned to the caller, and a standalone activity also uses it for its
* heartbeat details, which the server puts into its timeout failure. A workflow's input, memo,
* static summary and details, signals, queries and updates not sent by a handler keep the {@link
* WorkflowSerializationContext}, as do an update's arguments; a standalone activity's input and

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.

Same note as the PR underneath this one. Would be good to keep this more understandable for an end users mental model.

@JoshuaFrenchwood
JoshuaFrenchwood force-pushed the nexus-serialization-context-workflow-update branch from 67e8832 to 7e52351 Compare October 29, 2026 20:23
@JoshuaFrenchwood
JoshuaFrenchwood merged commit 655ef66 into main Oct 29, 2026
36 of 37 checks passed
@JoshuaFrenchwood
JoshuaFrenchwood deleted the nexus-serialization-context-workflow-update branch October 29, 2026 23:37
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.

3 participants