Summary
Some websites detect and block headless browsers via navigator properties, canvas fingerprinting, and WebGL capability checks. Running Playwright in headed mode with Xvfb provides a real rendering pipeline that bypasses these detections. The official playwright/mcp image already ships with Xvfb and X11 libraries.
This is the errand-desktop counterpart to the same change in the errand backend repo.
Changes Required
- Override the Playwright MCP container entrypoint to start Xvfb before the MCP server process
- Remove the
--headless flag from command args
- Set
DISPLAY=:99 environment variable for the Xvfb virtual display
- Add
ShmSize support to ContainerConfig and DockerRuntime for Chrome shared memory (2GB)
- Entrypoint becomes:
sh -c "Xvfb :99 ... & sleep 1 && DISPLAY=:99 exec node /app/cli.js ..."
Files Affected
ContainerEngine.swift — Command override for playwright service
ContainerRuntime.swift — Add shmSize to ContainerConfig
DockerRuntime.swift — Pass ShmSize in HostConfig
Notes
- ~100-150MB more memory per Playwright container, plus 2GB shared memory allocation
- The Playwright MCP server interface and port remain identical
OpenSpec Change
merge-worker-add-playwright - 4/6 tasks complete
Summary
Some websites detect and block headless browsers via navigator properties, canvas fingerprinting, and WebGL capability checks. Running Playwright in headed mode with Xvfb provides a real rendering pipeline that bypasses these detections. The official
playwright/mcpimage already ships with Xvfb and X11 libraries.This is the errand-desktop counterpart to the same change in the errand backend repo.
Changes Required
--headlessflag from command argsDISPLAY=:99environment variable for the Xvfb virtual displayShmSizesupport toContainerConfigandDockerRuntimefor Chrome shared memory (2GB)sh -c "Xvfb :99 ... & sleep 1 && DISPLAY=:99 exec node /app/cli.js ..."Files Affected
ContainerEngine.swift— Command override for playwright serviceContainerRuntime.swift— Add shmSize to ContainerConfigDockerRuntime.swift— Pass ShmSize in HostConfigNotes
OpenSpec Change
merge-worker-add-playwright- 4/6 tasks complete