Skip to content

gut: remove Playwright automation framework from browser subsystem (MBP audit) #2304

@alexey-pelykh

Description

@alexey-pelykh

Context

Per the Middleware Boundary Principle, RemoteClaw's browser MCP tool (`browser_request`) routes through paired nodes — that's infrastructure. But `src/browser/` also contains a full Playwright automation framework (14,221 lines, 69% of the directory) that is generic browser automation, not node-bound routing.

The node-routing layer (5,543 lines: bridge server, extension relay, profiles, config, security, CDP layer, basic+tabs routes) has a clean boundary from the Playwright layer. `server-context.ts` has soft deps on Playwright (already handles `PwAiModule | null`).

Found during MBP deep dive audit of `src/browser/`.

Scope

Delete Playwright layer (~14,221 lines, 74 files):

  • All `pw-` files: pw-session.ts, pw-ai.ts, pw-ai-module.ts, pw-ai-state.ts, pw-role-snapshot.ts, pw-tools-core..ts (16 prod + tests)
  • All `routes/agent.*` files: agent.ts, agent.shared.ts, agent.act.ts, agent.act.shared.ts, agent.act.hooks.ts, agent.act.download.ts, agent.snapshot.ts, agent.storage.ts, routes/output-paths.ts (9 prod + tests)
  • Chrome process management: chrome.ts, chrome.executables.ts, chrome.profile-decoration.ts + tests
  • Client action wrappers: client-actions.ts, client-actions-core.ts, client-actions-observe.ts, client-actions-state.ts
  • Automation utilities: screenshot.ts, paths.ts, session-tab-registry.ts, form-fields.ts, safe-filename.ts, output-atomic.ts, proxy-files.ts, trash.ts + tests

Clean up KEEP files:

  • `server-context.ts`: Remove Playwright fallback paths (listPagesViaPlaywright, createPageViaPlaywright) — CDP-only or error
  • `routes/index.ts`: Remove agent route registration, keep basic + tabs only

Acceptance Criteria

  • No `pw-*` files remain in src/browser/
  • No `routes/agent.*` files remain
  • No `chrome.*` process management files remain (chrome binary detection, launch, decoration)
  • `server-context.ts` has no Playwright imports
  • `routes/index.ts` registers only basic + tabs routes
  • Node-routing layer intact: bridge-server, extension-relay, profiles, config, security, CDP, client, basic+tabs routes
  • Build passes
  • Tests pass

Size

~14,221 lines removed. Node-routing layer (~5,543 lines) preserved.

Metadata

Metadata

Assignees

Labels

gutRemoving dead upstream subsystems

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions