fix(sdk): serialize context Error and ReplayChildren#478
Merged
Conversation
Operation.to_dict dropped Error and ReplayChildren from ContextDetails and emitted only Result. The read path (ContextDetails.from_dict) and the checkpoint update serializer already handle both fields, so serialized operation state did not round trip through Operation.to_dict. Include Error and ReplayChildren when present. A serialized child context failure now reconstructs the correct error class on replay, and a large payload child context keeps its ReplayChildren marker. The impact is confined to code that serializes operation state to feed a handler, which the local test runner does. Normal published SDK execution does not call Operation.to_dict on this path, so core runtime behavior for callers is unchanged. Closes #477
nvasiu
approved these changes
Jun 17, 2026
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
Operation.to_dictnow includesErrorandReplayChildreninContextDetailswhen they are set. It previously emitted onlyResult.Why
ContextDetails.from_dictreadsResult,Error, andReplayChildren, and the checkpoint update serializer writes them.Operation.to_dictwas the only place that droppedErrorandReplayChildren, so serialized operation state did not round trip.Scope of impact
This does not change core SDK runtime behavior for callers.
Operation.to_dictserializes operation state to feed a handler, which the local test runner does. Normal published SDK execution does not call it on that path. The impact is confined to the local test runner, where a serialized child context failure reconstructed as a generic error and a large payload child context lost itsReplayChildrenmarker.Testing
Two unit tests added in
tests/lambda_service_test.py. One assertsErrorandReplayChildrenappear when set. One asserts they are omitted when absent. Full core suite passes (1272), types clean (63 files), format clean.Closes #477