Fix browse daemon ownership across handoff - #2346
Draft
s-ai-alpha wants to merge 1 commit into
Draft
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
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.
What changed
handofffrom shutting down when the short-lived launch CLI exits.SIGTERM.Browserobject has noprocess()accessor.Root cause
The parent watchdog and
SIGTERMhandler derived lifecycle ownership from the browser's current mode. Afterhandoffchanged a headless browser to headed mode, the already-exited one-shot CLI appeared to own the now-visible browser. The next watchdog tick shut the daemon and browser down.Separately, disconnect handling assumed a Puppeteer-style
Browser.process()method that Playwright's public API does not provide.Impact
Headless-to-headed handoff remains alive until the user closes it or explicit cleanup runs. Ordinary Playwright disconnects no longer throw from the exit-classification path.
Validation
Covered by:
browse/test/daemon-ownership-policy.test.tsbrowse/test/watchdog.test.tsbrowse/test/browser-manager-unit.test.tsThe original lifecycle reproduction was also repeated across the 15-second watchdog boundary: the same daemon PID and URL remained healthy after handoff.