feat: context aware replay status#488
Merged
Merged
Conversation
zhongkechen
reviewed
Jun 24, 2026
zhongkechen
reviewed
Jun 24, 2026
Contributor
|
Tests failing |
zhongkechen
previously approved these changes
Jun 29, 2026
yaythomas
reviewed
Jun 29, 2026
Contributor
Author
|
need to merge the change of #496 |
added 2 commits
June 30, 2026 13:02
- Add replay status for map and parallel branches - Use per-context replay for hooks - Add logging assertion for examples
zhongkechen
approved these changes
Jun 30, 2026
| def run_in_child_handler() -> ResultType: | ||
| return self.execute_item(child_context, executable) | ||
|
|
||
| result: ResultType = child_handler( |
Contributor
There was a problem hiding this comment.
Do we need wrap this call with self._replay_aware() like the other operations in context?
Contributor
Author
There was a problem hiding this comment.
no, the replay status is already checked and flipped above.
executor call child_handler directly (skip context) so we cannot directly reuse replay_aware annotation
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: first piece of #389
Summary
Track replay status per-context instead of as a single execution-wide flag.
Changes
context.py:DurableContextowns its replay status, seeded from itscreator and refined per-operation via a
_replay_aware()context manager.Added public
context.is_replaying().logger.py:Loggerconsults a per-contextis_replayingcallableinstead of holding
ExecutionState.state.py: removed the global replay machinery (track_replay,is_replaying,_visited_operations); addedhas_prior_operations()forexecution-level first-invocation detection.
execution.py: seeds the root context's status; useshas_prior_operations()for the pluginis_first_invocationflag.concurrency/executor.py: branches track their own status; removed theper-branch
track_replaycall.Replay boundary behavior
_replay_aware()flips REPLAY→NEW at three points:immediately after a
waitare treated as new, not suppressed).The third case fixes a regression where a log right after a
waitwassilently dropped on replay.
Testing
Logging from examples:
Invocation 1 (requestId 8b1e9590) — first run, suspends at parent wait
Invocation 2 (requestId a46ca6bd) — parent wait fired
Invocation 3 (requestId 22d99bc2) — child wait fired
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.