From 16ce78233f06c1dfad9278261999591474ab27db Mon Sep 17 00:00:00 2001 From: Azade Date: Tue, 6 Jan 2026 15:19:59 +0000 Subject: [PATCH] fix(browser): patch playwright-core for Bun WebSocket compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bun's WebSocket implementation doesn't fully support Playwright's CDP connection because Playwright bundles its own 'ws' module. This causes connectOverCDP to timeout. The patch makes Playwright use the native 'ws' module when running under Bun, which works with Bun's WebSocket shim. Fixes browser snapshot/act timeouts after PR #278 (tsx → bun migration). Ref: https://github.com/oven-sh/bun/issues/9911 --- package.json | 8 +++++++- patches/playwright-core@1.57.0.patch | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 patches/playwright-core@1.57.0.patch diff --git a/package.json b/package.json index 1e2ba8f6d..f246cb8e9 100644 --- a/package.json +++ b/package.json @@ -152,7 +152,8 @@ }, "patchedDependencies": { "@mariozechner/pi-ai": "patches/@mariozechner__pi-ai.patch", - "qrcode-terminal": "patches/qrcode-terminal.patch" + "qrcode-terminal": "patches/qrcode-terminal.patch", + "playwright-core@1.57.0": "patches/playwright-core@1.57.0.patch" } }, "vitest": { @@ -186,5 +187,10 @@ "apps/macos/.build/**", "dist/Clawdbot.app/**" ] + }, + "patchedDependencies": { + "@mariozechner/pi-ai": "patches/@mariozechner__pi-ai.patch", + "qrcode-terminal": "patches/qrcode-terminal.patch", + "playwright-core@1.57.0": "patches/playwright-core@1.57.0.patch" } } diff --git a/patches/playwright-core@1.57.0.patch b/patches/playwright-core@1.57.0.patch new file mode 100644 index 000000000..97e5ad3ae --- /dev/null +++ b/patches/playwright-core@1.57.0.patch @@ -0,0 +1,13 @@ +diff --git a/lib/utilsBundle.js b/lib/utilsBundle.js +index 7dd8831f29c19f2e20468508b77b0a3f9d204ae6..c50a1ac2b3439a5b2fbf8afa61c369360710071f 100644 +--- a/lib/utilsBundle.js ++++ b/lib/utilsBundle.js +@@ -59,7 +59,7 @@ const program = require("./utilsBundleImpl").program; + const ProgramOption = require("./utilsBundleImpl").ProgramOption; + const progress = require("./utilsBundleImpl").progress; + const SocksProxyAgent = require("./utilsBundleImpl").SocksProxyAgent; +-const ws = require("./utilsBundleImpl").ws; ++const ws = "Bun" in globalThis ? require("ws") : require("./utilsBundleImpl").ws; + const wsServer = require("./utilsBundleImpl").wsServer; + const wsReceiver = require("./utilsBundleImpl").wsReceiver; + const wsSender = require("./utilsBundleImpl").wsSender;