Skip to content

refactor(browser): split Playwright session manager - #113585

Merged
steipete merged 1 commit into
mainfrom
bench6/pw-session-split
Jul 25, 2026
Merged

steipete merged 1 commit into
mainfrom
bench6/pw-session-split

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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.ts as 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

AI-assisted: Codex implemented and reviewed this maintainer-requested refactor. No agent transcript is attached because public transcript insertion requires separate explicit approval.

@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Jul 25, 2026
@steipete
steipete marked this pull request as ready for review July 25, 2026 08:48
@steipete
steipete merged commit aba0b12 into main Jul 25, 2026
175 of 178 checks passed
@steipete
steipete deleted the bench6/pw-session-split branch July 25, 2026 08:58
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant