Skip to content

Keep converter serialization context when external storage is enabled - #2050

Merged
tconley1428 merged 1 commit into
temporalio:mainfrom
parbhatkapila4:fix/extstore-serialization-context
Oct 30, 2026
Merged

tconley1428 merged 1 commit into
temporalio:mainfrom
parbhatkapila4:fix/extstore-serialization-context

Conversation

@parbhatkapila4

Copy link
Copy Markdown
Contributor

What was changed

With external storage configured, the payload converter and failure converter lose their serialization context. _with_contexts calls with_context() and then _with_store_context(). The second step uses dataclasses.replace, which reruns __post_init__ and builds new payload and failure converters from their classes, so the context-bound instances are dropped. Only the codec keeps its context, because it's an init field.

So any converter that implements WithSerializationContext gets None instead of the workflow or activity context on client calls and in the workflow and activity workers, as soon as external storage is set. This happens for every payload, not just those that go to storage.

The fix keeps the current converters on the clone, as with_context() does.

How was this tested

Parametrized test_payload_conversion_calls_follow_expected_sequence_and_contexts to also run with external storage (in-memory driver). On main, the new case fails with "Unexpected context type: NoneType" in the payload converter. With the fix, both cases pass. The rest of test_serialization_context.py and the extstore and converter tests pass the same as on main.

@parbhatkapila4
parbhatkapila4 requested a review from a team as a code owner October 30, 2026 14:30
@tconley1428
tconley1428 merged commit 9bc323c into temporalio:main Oct 30, 2026
20 checks passed
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