From 76c9a48a73d0aacceb225b6cf34fc29af99df138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Pa=C5=9Bko?= Date: Thu, 21 May 2026 16:00:23 +0200 Subject: [PATCH 1/3] fix: broken playwright path in the binary --- package.json | 3 ++- patches/playwright-core@1.59.1.patch | 21 +++++++++++++++++++++ pnpm-lock.yaml | 7 +++++-- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 patches/playwright-core@1.59.1.patch diff --git a/package.json b/package.json index b126c0dbc0..f1808a78ca 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,8 @@ ], "patchedDependencies": { "@earendil-works/pi-coding-agent": "patches/@earendil-works__pi-coding-agent.patch", - "@earendil-works/pi-tui": "patches/@earendil-works__pi-tui.patch" + "@earendil-works/pi-tui": "patches/@earendil-works__pi-tui.patch", + "playwright-core@1.59.1": "patches/playwright-core@1.59.1.patch" } } } diff --git a/patches/playwright-core@1.59.1.patch b/patches/playwright-core@1.59.1.patch new file mode 100644 index 0000000000..6c608e80fa --- /dev/null +++ b/patches/playwright-core@1.59.1.patch @@ -0,0 +1,21 @@ +diff --git a/lib/server/utils/nodePlatform.js b/lib/server/utils/nodePlatform.js +index 80d88fedf2c4d2b7bea8cfd4b9c8db454dedaa1d..ca0a8d6aa6ac9f66e2a18e2970cb3be12b02c6f7 100644 +--- a/lib/server/utils/nodePlatform.js ++++ b/lib/server/utils/nodePlatform.js +@@ -64,7 +64,15 @@ let boxedStackPrefixes = []; + function setBoxedStackPrefixes(prefixes) { + boxedStackPrefixes = prefixes; + } +-const coreDir = import_path.default.dirname(require.resolve("../../../package.json")); ++// Wrapped in try-catch for Bun compiled binaries: require.resolve() with ++// relative paths gets converted to absolute build-machine paths that don't ++// exist at runtime. coreDir is only used for stack-trace filtering so an ++// empty fallback is safe. ++// Upstream: https://github.com/microsoft/playwright/issues/XXXXX (TODO: file) ++let coreDir = ""; ++try { ++ coreDir = import_path.default.dirname(require.resolve("../../../package.json")); ++} catch {} + const nodePlatform = { + name: "node", + boxedStackPrefixes: () => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dcd7bdfaa9..747976da1e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ patchedDependencies: '@earendil-works/pi-tui': hash: e432fee0f54b7321d104a08ff5a38561d9c2cd3b002f34e6b8cbc2377889c9d2 path: patches/@earendil-works__pi-tui.patch + playwright-core@1.59.1: + hash: c3cf1b35f0627fac95ff87378468a27499e77c12786dc429c25481e11fedf7ff + path: patches/playwright-core@1.59.1.patch importers: @@ -3571,11 +3574,11 @@ snapshots: pkce-challenge@5.0.1: {} - playwright-core@1.59.1: {} + playwright-core@1.59.1(patch_hash=c3cf1b35f0627fac95ff87378468a27499e77c12786dc429c25481e11fedf7ff): {} playwright@1.59.1: dependencies: - playwright-core: 1.59.1 + playwright-core: 1.59.1(patch_hash=c3cf1b35f0627fac95ff87378468a27499e77c12786dc429c25481e11fedf7ff) optionalDependencies: fsevents: 2.3.2 From ac3cc419361743e4ab1f8e4af0721f704380fcde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Pa=C5=9Bko?= Date: Thu, 21 May 2026 16:35:30 +0200 Subject: [PATCH 2/3] cr fix --- patches/playwright-core@1.59.1.patch | 14 ++++++++------ pnpm-lock.yaml | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/patches/playwright-core@1.59.1.patch b/patches/playwright-core@1.59.1.patch index 6c608e80fa..45230e652b 100644 --- a/patches/playwright-core@1.59.1.patch +++ b/patches/playwright-core@1.59.1.patch @@ -1,21 +1,23 @@ diff --git a/lib/server/utils/nodePlatform.js b/lib/server/utils/nodePlatform.js -index 80d88fedf2c4d2b7bea8cfd4b9c8db454dedaa1d..ca0a8d6aa6ac9f66e2a18e2970cb3be12b02c6f7 100644 +index 80d88fedf2c4d2b7bea8cfd4b9c8db454dedaa1d..18eb6371f9efc3d0b0beef3b28815f98a902d4c2 100644 --- a/lib/server/utils/nodePlatform.js +++ b/lib/server/utils/nodePlatform.js -@@ -64,7 +64,15 @@ let boxedStackPrefixes = []; +@@ -64,7 +64,17 @@ let boxedStackPrefixes = []; function setBoxedStackPrefixes(prefixes) { boxedStackPrefixes = prefixes; } -const coreDir = import_path.default.dirname(require.resolve("../../../package.json")); +// Wrapped in try-catch for Bun compiled binaries: require.resolve() with +// relative paths gets converted to absolute build-machine paths that don't -+// exist at runtime. coreDir is only used for stack-trace filtering so an -+// empty fallback is safe. ++// exist at runtime. The __dirname fallback computes the same playwright-core ++// root structurally (this file lives at playwright-core/lib/server/utils/). +// Upstream: https://github.com/microsoft/playwright/issues/XXXXX (TODO: file) -+let coreDir = ""; ++let coreDir; +try { + coreDir = import_path.default.dirname(require.resolve("../../../package.json")); -+} catch {} ++} catch { ++ coreDir = import_path.default.resolve(__dirname, "../../.."); ++} const nodePlatform = { name: "node", boxedStackPrefixes: () => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 747976da1e..ec690b99b3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,7 +12,7 @@ patchedDependencies: hash: e432fee0f54b7321d104a08ff5a38561d9c2cd3b002f34e6b8cbc2377889c9d2 path: patches/@earendil-works__pi-tui.patch playwright-core@1.59.1: - hash: c3cf1b35f0627fac95ff87378468a27499e77c12786dc429c25481e11fedf7ff + hash: 5467c614923562b25446c3fb250e5d51e49f453894d68c4dce7dab93fa3baf88 path: patches/playwright-core@1.59.1.patch importers: @@ -3574,11 +3574,11 @@ snapshots: pkce-challenge@5.0.1: {} - playwright-core@1.59.1(patch_hash=c3cf1b35f0627fac95ff87378468a27499e77c12786dc429c25481e11fedf7ff): {} + playwright-core@1.59.1(patch_hash=5467c614923562b25446c3fb250e5d51e49f453894d68c4dce7dab93fa3baf88): {} playwright@1.59.1: dependencies: - playwright-core: 1.59.1(patch_hash=c3cf1b35f0627fac95ff87378468a27499e77c12786dc429c25481e11fedf7ff) + playwright-core: 1.59.1(patch_hash=5467c614923562b25446c3fb250e5d51e49f453894d68c4dce7dab93fa3baf88) optionalDependencies: fsevents: 2.3.2 From e62131d6ef86364fd7d30b86281fb307c8997451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Pa=C5=9Bko?= Date: Thu, 21 May 2026 21:00:01 +0200 Subject: [PATCH 3/3] fix: narrow catch to MODULE_NOT_FOUND and add upstream Bun issue link Address review feedback: - Narrow bare catch to only handle MODULE_NOT_FOUND, re-throw unexpected errors (corrupt installs, permission errors) - Replace TODO placeholder with actual upstream link: https://github.com/oven-sh/bun/pull/29066 --- patches/playwright-core@1.59.1.patch | 9 +++++---- pnpm-lock.yaml | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/patches/playwright-core@1.59.1.patch b/patches/playwright-core@1.59.1.patch index 45230e652b..81d44c2d87 100644 --- a/patches/playwright-core@1.59.1.patch +++ b/patches/playwright-core@1.59.1.patch @@ -1,8 +1,8 @@ diff --git a/lib/server/utils/nodePlatform.js b/lib/server/utils/nodePlatform.js -index 80d88fedf2c4d2b7bea8cfd4b9c8db454dedaa1d..18eb6371f9efc3d0b0beef3b28815f98a902d4c2 100644 +index 80d88fedf2c4d2b7bea8cfd4b9c8db454dedaa1d..670f37ff62fd984361b7cfac62e54064a416139d 100644 --- a/lib/server/utils/nodePlatform.js +++ b/lib/server/utils/nodePlatform.js -@@ -64,7 +64,17 @@ let boxedStackPrefixes = []; +@@ -64,7 +64,18 @@ let boxedStackPrefixes = []; function setBoxedStackPrefixes(prefixes) { boxedStackPrefixes = prefixes; } @@ -11,11 +11,12 @@ index 80d88fedf2c4d2b7bea8cfd4b9c8db454dedaa1d..18eb6371f9efc3d0b0beef3b28815f98 +// relative paths gets converted to absolute build-machine paths that don't +// exist at runtime. The __dirname fallback computes the same playwright-core +// root structurally (this file lives at playwright-core/lib/server/utils/). -+// Upstream: https://github.com/microsoft/playwright/issues/XXXXX (TODO: file) ++// Upstream: https://github.com/oven-sh/bun/pull/29066 +let coreDir; +try { + coreDir = import_path.default.dirname(require.resolve("../../../package.json")); -+} catch { ++} catch (e) { ++ if (e.code !== 'MODULE_NOT_FOUND') throw e; + coreDir = import_path.default.resolve(__dirname, "../../.."); +} const nodePlatform = { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ec690b99b3..c075824508 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,7 +12,7 @@ patchedDependencies: hash: e432fee0f54b7321d104a08ff5a38561d9c2cd3b002f34e6b8cbc2377889c9d2 path: patches/@earendil-works__pi-tui.patch playwright-core@1.59.1: - hash: 5467c614923562b25446c3fb250e5d51e49f453894d68c4dce7dab93fa3baf88 + hash: 1f27acbc8250451c9eea2efa9b19956afcb881a2b7a69ad4550cf8e59f15e102 path: patches/playwright-core@1.59.1.patch importers: @@ -3574,11 +3574,11 @@ snapshots: pkce-challenge@5.0.1: {} - playwright-core@1.59.1(patch_hash=5467c614923562b25446c3fb250e5d51e49f453894d68c4dce7dab93fa3baf88): {} + playwright-core@1.59.1(patch_hash=1f27acbc8250451c9eea2efa9b19956afcb881a2b7a69ad4550cf8e59f15e102): {} playwright@1.59.1: dependencies: - playwright-core: 1.59.1(patch_hash=5467c614923562b25446c3fb250e5d51e49f453894d68c4dce7dab93fa3baf88) + playwright-core: 1.59.1(patch_hash=1f27acbc8250451c9eea2efa9b19956afcb881a2b7a69ad4550cf8e59f15e102) optionalDependencies: fsevents: 2.3.2