fix(core): preserve durable cancellation recovery - #3578
Draft
LunarianDev wants to merge 23 commits into
Draft
Conversation
🦋 Changeset detectedLatest commit: 20790bb The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
@LunarianDev is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
Comment on lines
+879
to
+881
| await waitForAbortReaderCleanup( | ||
| cancelAbortReaders(...args, thisVal, hydratedInput.closureVars) | ||
| ); |
Contributor
There was a problem hiding this comment.
Suggested change
| await waitForAbortReaderCleanup( | |
| cancelAbortReaders(...args, thisVal, hydratedInput.closureVars) | |
| ); | |
| // | |
| // The wait is best-effort: `waitForAbortReaderCleanup` rejects on its | |
| // 250ms bound (a service-backed World's remote stream-cancel can exceed | |
| // this — the cancel may hit the network) or if `reader.cancel()` throws. | |
| // Neither outcome must fail the step: propagating it would (1) spuriously | |
| // fail/retry an otherwise-successful signal-bearing step, re-running user | |
| // code with duplicate side effects, and (2) mask a genuine user-code | |
| // error by skipping the `throw userCodeError` re-raise below, corrupting | |
| // retry classification (e.g. a FatalError becoming a generic cleanup | |
| // error). Swallow and log instead, matching the reader teardown's prior | |
| // fire-and-forget contract. The teardown is also tracked in `ops`, so a | |
| // slow-but-eventual cancel still gets a chance to settle in the flush | |
| // window below. | |
| try { | |
| await waitForAbortReaderCleanup( | |
| cancelAbortReaders(...args, thisVal, hydratedInput.closureVars) | |
| ); | |
| } catch (cleanupErr) { | |
| runtimeLogger.warn('Abort stream reader cleanup did not settle', { | |
| workflowRunId, | |
| stepId, | |
| error: | |
| cleanupErr instanceof Error | |
| ? cleanupErr.message | |
| : String(cleanupErr), | |
| }); | |
| } |
Abort-reader cleanup rejection (250ms timeout or reader.cancel() throw) is caught by the step's outer catch, spuriously failing/retrying a successful signal-bearing step and masking genuine user-code errors.
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.
Summary
Verification
Release boundary
This is a draft upstream repair. No package publication or downstream adoption is included.