Repository navigation
fix(sdk-ts): observe rejected operations after pre-abort - #3360
Open
Elon-Jiang wants to merge 1 commit into
Open
Elon-Jiang wants to merge 1 commit into
Elon-Jiang wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: ffa251b The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 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
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
This branch has not been 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.
why
abortable(promise, signal)checks an already-aborted signal before attaching a handler to the supplied promise. The operation has already started by the time it is passed in. If it rejects immediately or later, the caller can correctly catch the cancellation error and still have Node terminate on the unhandled underlying rejection.Minimal repository reproduction (
node --unhandled-rejections=strict --input-type=module):The same failure was reproduced through the SDK's internal
resolveBrowserWebSocketUrlconsumer with an injected fetch that aborts its signal and rejects. No browser, external service, or credentials are needed for that reproduction.what changed
test plan
Base:
b7a4b899079f198a0ee78a6dcb62ad02f545cf49.packageContract.test.tsconsumer-typecheck failure was reproduced on the unchanged same base: both versions produce the identical 208 TypeScript dependency diagnostics (duplicate Node types and incompatible undici declarations). No full-suite pass is claimed.AI assistance was used to investigate, implement, and validate this patch.
Summary by cubic
Fixes
abortableso an already-aborted signal no longer leaves the underlying promise's rejection unhandled, which could terminate Node in strict mode after the caller caught the cancellation error.@browserbasehq/stagehand; no protocol or Python changes.Written for commit ffa251b. Summary will update on new commits.