Repository navigation
refactor(browser): split Playwright session manager - #113585
Merged
Merged
Conversation
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 26, 2026
This was referenced Oct 9, 2026
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 Problem This Solves
The Playwright session manager had grown to 2,435 lines, combining shared page state, dialog transitions, role-ref caching, CDP connection ownership, safe navigation, download capture, forced disconnect, and tab actions behind one grandfathered max-lines suppression. Peter explicitly requested this behavior-neutral split so those lifecycle boundaries can be reviewed independently.
Why This Change Was Made
This keeps
pw-session.tsas the stable facade and moves the existing implementation into focused modules for shared contracts/state, dialogs, downloads, connection retirement/selection, navigation policy, and page actions. The max-lines suppression and baseline entry are removed; every production module is at most 589 lines.The split follows the Chrome MCP lifecycle precedent in #113114. Process and ownership comments moved with the exact code they protect: in-flight connection retirement, closing-generation retention, navigation quarantine versus destructive close, selected-page route draining, and forced CDP disconnect all remain beside their implementations. Shared maps, weak sets, and error identity are still singletons rather than duplicated per module.
User Impact
No user-visible behavior changes. Browser connections, stale-page recovery, role refs, observed dialogs, downloads, SSRF quarantine, navigation cleanup, forced cancellation, and remote tab operations retain the same ordering and outcomes; maintainers can review each lifecycle independently.
Evidence
node scripts/run-vitest.mjs extensions/browser/src/browser/pw-session.test.ts extensions/browser/src/browser/pw-session.connections.test.ts extensions/browser/src/browser/pw-session.dialogs.test.ts extensions/browser/src/browser/pw-session.get-page-for-targetid.test.ts extensions/browser/src/browser/pw-session.create-page.navigation-guard.test.ts extensions/browser/src/browser/pw-session.assert-navigation-safety.test.ts extensions/browser/src/browser/pw-session.termination-cdp-ssrf.test.ts— 112/112 passed on Blacksmith Testboxtbx_01kyc6ypd5mrczsvqzwdyc8749(Actions run https://github.com/openclaw/openclaw/actions/runs/30151534347).node scripts/check-changed.mjs -- <touched paths>— passed on Blacksmith Testboxtbx_01kyc6h97gw3rg5hqd6xrfrbkb(Actions run https://github.com/openclaw/openclaw/actions/runs/30151322006), including extension production/test typechecks, formatting, extension/script lint, max-lines and env-var ratchets, plugin boundaries, and zero runtime import cycles.node scripts/check-deadcode-exports.mjs— production, full-tree, and script unused-export scans passed with zero entries on Blacksmith Testboxtbx_01kyc7528c6vggka5e48jsekx4(Actions run https://github.com/openclaw/openclaw/actions/runs/30151634427).$HOME/.claude/skills/autoreview/scripts/autoreview --mode branch --base origin/main— clean after the final rebase.AI-assisted: Codex implemented and reviewed this maintainer-requested refactor. No agent transcript is attached because public transcript insertion requires separate explicit approval.