workflow: fix replay failures for disposed hooks - #419
Merged
Merged
Conversation
fantix
force-pushed
the
fantix/workflow-disposed-hook-replay
branch
from
September 25, 2026 15:52
3e00321 to
f1612b1
Compare
fantix
force-pushed
the
fantix/workflow-disposed-hook-replay
branch
from
September 25, 2026 21:33
17da093 to
2fe1a48
Compare
fantix
added this pull request to stack #422
September 25, 2026 21:47
fantix
marked this pull request as ready for review
September 25, 2026 21:47
Move the existing subscription check into the hook_received handler, without changing behavior.
During replay, a workflow can dispose a hook before its recorded registration is replayed. Looking only in active suspensions then incorrectly treats that hook as missing. Use self.hooks to find disposed hooks when replaying registration events and checking for operation mismatches.
msullivan
approved these changes
Sep 27, 2026
Comment on lines
+1245
to
+1247
| if hook is None: | ||
| # Internal step-cancellation hooks only live in suspensions. | ||
| hook = self.suspensions[event.correlation_id] |
Contributor
There was a problem hiding this comment.
Should we put the step-cancellation hooks in hooks instead/also?
Member
Author
There was a problem hiding this comment.
Yes! Let me do that in a new PR.
Draft
This branch was successfully 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.
This PR fixes a bug where disposing a hook can incorrectly cause workflow replay to fail, as in the following example (step and hook definitions omitted):
await inventory.approval.dispose(), removing the hook from active suspensions.context.suspensions), so it incorrectly reports the hook as missing.This PR fixes to look up disposed hooks in the hook registry (
context.hooks) so their registration events can still be processed.