Skip to content

Decision: mount Playwright MCP in agent turns, or drop it from the sandbox image? #4730

Open

Description

@yannickmonney

Context

The sandbox image installs @playwright/mcp with its browser (services/sandbox-runtime/Dockerfile:328-378). The exec builder mounts it only when a turn's spec sets mcp.browser (services/platform/lib/harnesses/exec-builder.ts:494-507,654-660), and no production caller sets it: services/platform/backend/core/chat/external_turn_shared.ts:475-477 passes mcp: { bridgeUrl } only, and browser: 'headless' appears only in test helpers. So no production agent turn ever gets the browser tools — while services/sandbox-runtime/README.md:142-148 says every managed agent turn lists the Playwright MCP server. Verified on main at 73d03a9.

One dependency to keep in mind: render_fetch.ts resolves playwright-core from inside the MCP package first (services/platform/backend/core/node_only/sandbox/render_fetch.ts:497-501).

Options

  1. Mount it — set mcp.browser: 'headless' for managed turns (the lazy launcher keeps turns that never open a browser cheap), so agents can test the web apps they build.
  2. Drop it — remove @playwright/mcp from the image (~120 MB), keep a standalone playwright-core for render_fetch, and correct the README.

Either way, the README has to match what ships.

Activity

  1. added
    needs discussion
    improvement
    on Oct 10, 2026
  2. yannickmonney commented on Nov 14, 2026

    @yannickmonney
    ContributorAuthor

    Decision

    Mount it. buildExternalTurnExec (external_turn_shared.ts), the one builder every production harness turn goes through (tasks, automations, and chat through its task handover), sets mcp.browser: 'headless' on every turn whose harness declares capabilities.mcp: true. That applies on both the gateway lane and the subscription lane. The connectors bridge keeps being mounted as it is today. Hermes and Cursor (capabilities.mcp: false) get no browser. @playwright/mcp and its Chromium stay in the sandbox image, and render_fetch keeps resolving playwright-core the way it does now.

    Answers

    • Mount or drop? Mount.
    • Gateway turns only? No. Subscription turns get it too. The browser carries no credential, and every turn runs in the same isolated sandbox with filtered egress.
    • render_fetch's dependency? Unchanged.
    • README? Yes. It must state the exact rule (every turn on a harness that mounts MCP servers, not Hermes or Cursor), and a builder test enforces it.

    Rationale
    Everything except the final wiring already exists: the proxy-aware launcher, the lazy launcher (a turn that never opens a browser starts no server), the recorded argument manifests, the vision-polyfill arguments and the localhost-testing flags. No caller ever set mcp.browser, and that is the whole gap. Dropping the package saves far less than 120 MB, because render_fetch and the visual-aspect-analyzer skill still need Chromium and playwright-core. The browser runs inside the locked-down session container through the egress filter and holds no credential, so mounting it adds no exposure.

    Implementation units

    1. feat(platform): mount Playwright MCP on every MCP-capable turn (base: main, S).
      • Builder change, with tests on both serving lanes, with and without a bridge.
      • Hermes and Cursor carry no browser.
      • Vision-polyfill arguments on claude-code; plain arguments on codex.
      • Correct services/sandbox-runtime/README.md.
    2. test(sandbox): real-sandbox integration test (base: main, M, after unit 1).
      • The lazy tools/list is answered without starting the server.
      • browser_navigate to a localhost server inside the sandbox succeeds.
      • An egress-blocked URL is refused.
      • Add a manual-test box or an automation row.
  3. added
    agent-ready
    and removed
    needs discussion
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyimprovement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions