Cancel timed-out Playwright executions - #327
Open
masnwilliams wants to merge 1 commit into
Open
Conversation
rgarcia
approved these changes
Aug 7, 2026
rgarcia
left a comment
Contributor
There was a problem hiding this comment.
reviewed — looks good. the timeout now interrupts the abandoned Playwright execution, reconnects cleanly for the next request, and the regression test covers both recovery and delayed page mutations.
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
proof
The reproduction starts a script that alternates
scrollIntoViewIfNeeded()between top and bottom targets every 500ms. After ten iterations it sets a marker tolate-finished. The request timeout is shorter than the script, so any marker or scroll changes after the timeout response are escaped execution.before:
mainThe API returned the timeout after approximately one second, but the script remained live:
{ "timeout": { "success": false, "elapsed_ms": 1004 }, "immediate": { "marker": "initial" }, "after_2_seconds": { "marker": "late" } }The post-timeout mutation reproduces consistently with both the production endpoint and a local Chromium daemon built from
main.after: this branch
Built the complete headless image from this branch (
sha256:b02c5efcc8a1e06933f38b163326b1f65f6dc144267c2706cee787ea48c01101) and ran the same alternating-scroll request through the image's/playwright/executeendpoint:{ "timeout": { "success": false, "elapsed_ms": 2015 }, "immediate": { "marker": "step-3", "scroll_y": 0 }, "after_4_seconds": { "marker": "step-3", "scroll_y": 0 } }The marker and scroll position remain unchanged after the timeout. The abandoned script does not reach
late-finishedor perform another scroll. A subsequent Playwright request reconnects and succeeds against the same browser page.The image-level regression also passes:
validation
TestPlaywrightExecuteTimeoutReturnsPromptlyAndRecoversagainst the built imagebun build server/runtime/playwright-daemon.ts --outfile=/tmp/playwright-daemon.js --target=node --external playwright-core --external patchright --external esbuildgo vet ./...go test -v -race $(go list ./... | grep -v /e2e$)