Repository navigation
fix(core): reject checkpoints at virtual child ids - #778
Merged
zhongkechen merged 2 commits intoOct 16, 2026
Merged
Conversation
A virtual child context never writes a checkpoint of its own, so a checkpoint at its operation id can only come from a non-virtual child in an earlier invocation. Replay accepted that checkpoint, because virtualness is not part of the operation identity, and returned the cached result (or re-raised the cached error) without running the virtual body. - ChildOperationExecutor.check_result_status raises NonDeterministicExecutionError for any checkpoint at a virtual child's id, after the identity check and before terminal handling. - run_in_child_context passes is_virtual through _operation_replay_aware to _replay_aware, which runs the same check before the replay and update plugin hooks fire. - Add an executor unit test, a context test showing the error comes before the replay and update plugin hooks, and a composed durable_execution test that replays a non-virtual child as virtual.
Contributor
|
/ai review |
Contributor
Codex AI reviewNo actionable findings in the PR changes. Residual test risk: regression tests were inspected but not executed, as required by the review constraints. Reviewed commit |
zhongkechen
approved these changes
Oct 16, 2026
This was referenced Oct 16, 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.
Issue #, if available: Closes #704
Description of changes:
A virtual child context never writes a checkpoint of its own, so a checkpoint at its operation id can only come from a non-virtual child in an earlier invocation.
is_virtualis not part ofOperationIdentifier, so that checkpoint passed the identity checks andcheck_result_status()returned the cached result (or re-raised the cached error) without running the virtual body.ChildOperationExecutor.check_result_status(): for a virtual child, any checkpoint at its id raisesNonDeterministicExecutionError("... checkpoint contains a non-virtual child context but current child context is virtual", in the style of the FLAT message from fix(core): validate replay operation identity #698), after the identity check and before terminal handling. The check is the newChildOperationExecutor.validate_virtual_checkpoint().DurableContext.run_in_child_context(): passesis_virtualthrough_operation_replay_aware()to_replay_aware(), which runs the same check right aftervalidate_checkpoint(), before the replay or update plugin hook fires.Outside replay, a virtual child or FLAT branch that finds a checkpoint at its id now fails with this error instead of using it. While replaying, FLAT branches still hit
_validate_branch_checkpoint_nesting()first.Testing:
operation/child_test.py: a virtual child over a SUCCEEDED (with and without ReplayChildren), FAILED or STARTED checkpoint raises the error; the user function never runs and nothing is checkpointed.context_test.py: with a realPluginExecutor, a STARTED and an updated SUCCEEDED checkpoint fail before any replay or update hook.execution_test.py: a composeddurable_executiontest replays a non-virtual SUCCEEDED, FAILED or STARTED child as virtual and fails withNonDeterministicExecutionError; the body never runs and nothing is checkpointed.All 9 new cases fail on
main. The context test also fails with the_replay_awarecheck removed.Locally (Windows, Python 3.13, Hatch 1.16.5):
hatch run dev-core:covreaches 98.28% (gate 98%), withcontext.pyandchild.pyat 100%; the only failures are two Windows-only timestamp tests that also fail onmain.hatch run dev-core:typecheck, thetypes:checkscript (mypy, all checked packages) andhatch fmt --checkare clean. No conformance tests were added or changed.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.