Repository navigation
fix: cancel output observation when its page closes - #4578
Merged
Merged
Conversation
Closing a context during the response body read leaves an event-listener error in the shared Playwright connection, which the next Browser.new_page call reports as a disposed response. Treat errors after page closure as cancellation across the entire route callback, while preserving errors from live pages and the existing fetch-failure network diagnostic. The regression orders context closure at the body-read boundary and fails on the old code with Browser.new_page: Response has been disposed. Departed-sample output capture remains intact. Closes #4231
This was referenced Oct 29, 2026
leaf-agent
added a commit
that referenced
this pull request
Oct 29, 2026
Render checks now cancel their route handlers before closing the page, so an unfinished output-observer body read cannot leave `Response has been disposed` in Playwright's shared connection and break the next `Browser.new_page()` call. This covers page checks, widget checks, and exceptional version cleanup through one helper using `page.unroute_all(behavior="ignoreErrors")`. #4578 guarded the callback with `page.is_closed()`, but context closure disposes fetched responses before that flag becomes true. The revised regression holds the real request-context disposal boundary open until the observer reads its disposed response. Both page-check and widget-check cases fail before this fix with the exact reported diagnostic and pass afterward. The callback-local guard is removed; live callback failures still propagate, and output observation from removed or navigated samples is preserved. Validation: 9 focused browser cases and 6 render-gate model checks passed; Ruff lint and formatting, ty, and Python compilation passed. The browser selection includes both originally reported cases, entry-route lifetime, fetch-failure reporting, classic authored scripts, and departed-sample output capture. Review and CI follow-up use the queued workflows with `await_ci: false`. Closes #4231 — automated triage Co-authored-by: leaf-agent <[email protected]>
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.
Closing a render-check context while the output observer reads a fetched runtime entry can leave
Response has been disposedin Playwright's shared connection. The next test then fails atBrowser.new_page, hiding the originating callback. The observer now treats Playwright errors after its page closes as cancellation across the whole entry callback; errors on live pages still propagate, and fetch failures still abort their browser request.The regression holds the response-body boundary until context closure, then opens another page on the same browser. It fails before the fix with the reported
Browser.new_page: Response has been disposedand passes afterward. This preserves #4205's output observation, including invalid publications from removed and navigated sample documents.Validation: the regression, both originally reported cases, the entry-route lifetime case, fetch-failure reporting, and both departed-sample cases passed (7 distinct cases). Ruff checks, formatting, and Python compilation passed. The separate package-output check fails on unchanged main with a
LayerCompositionargument mismatch, tracked in #4577.Closes #4231 — automated triage