Repository navigation
Nexus serialization context workflows activities - #2043
Open
JoshuaFrenchwood wants to merge 5 commits into
Open
JoshuaFrenchwood wants to merge 5 commits into
JoshuaFrenchwood wants to merge 5 commits into
Conversation
Merged
JoshuaFrenchwood
force-pushed
the
nexus-serialization-context-workflows-activities
branch
from
October 29, 2026 18:35
2f4ac89 to
01025c0
Compare
Base automatically changed from
update-core-nexus-serialization-context
to
main
October 29, 2026 20:28
tconley1428
force-pushed
the
nexus-serialization-context-workflows-activities
branch
from
October 29, 2026 20:28
0336837 to
a72fa12
Compare
JoshuaFrenchwood
requested review from
Quinn-With-Two-Ns,
VegetarianOrc and
tconley1428
and removed request for
tconley1428
October 29, 2026 20:32
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
Nexus operation handlers now propagate their
NexusSerializationContextto the workflows and standalone activities they start.InitializeWorkflow. This happens at both the converter and codec layers, including fail-workflow commands. Input, memo, signals, queries and updates keep theWorkflowSerializationContext.ActivitySerializationContext. Heartbeat details are included because the server copies them into the heartbeat timeout failure returned to the Nexus caller.activity.Info.nexus_serialization_context: for async completion, the activity passes it to the completing client, which callsAsyncActivityHandle.with_context(...). That coverscomplete,fail,report_cancellationandheartbeat.WorkflowHandle.result()decodes the whole close event with it.ActivityHandle.result()anddescribe()(result, outcome failure, last failure, heartbeat details) use it.create_taskon the workflow event loop accepts theeager_startparameter that Python 3.14 added, so newer type stubs don't report an incompatible override.v1.9.3-nexus-serialization-context, which propagates the context.Why?
The result and failure of a workflow or standalone activity started by a Nexus handler are returned to the Nexus caller, which decodes them with the operation's
NexusSerializationContext. A codec keyed on the context, for example one that encrypts per endpoint or operation, couldn't decode them when they were encoded with the workflow or activity context.Async completion needs an explicit opt-in, because the completing client only has a task token and can't recover the context itself.
Checklist
Closes
How was this tested:
The tests in
tests/test_serialization_context.pyrun on the dev server with a strict codec. It marks payloads encoded under a Nexus context and asserts if a marked payload is decoded without that context.test_nexus_started_workflow_uses_nexus_context[result|failure|continue_as_new]: the caller result, plus a handle obtained by ID that relies on the server's context. It also checks that the started event carries the context, the input is unmarked and the close event is marked.test_nexus_started_activity_uses_nexus_context: both attempts seeInfo.nexus_serialization_context, and the retry decodes the previous attempt's heartbeat details.result()anddescribe()decode correctly, and the result and heartbeat payloads are marked.test_nexus_started_activity_failure_uses_nexus_context:result()anddescribe().outcome_failure()decode the failure details.test_nexus_started_activity_async_completion_with_context: client heartbeat and completion viawith_context(info.nexus_serialization_context).test_standalone_nexus_handle_obtained_by_id_uses_server_context: now passes with the strict codec.