From d7001b870feb03cdfd36b39f6bf28cff7d9be5fd Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Thu, 4 Jun 2026 14:30:34 +0800 Subject: [PATCH] fix: add markResourceTiming polyfill to performance shim for Node.js v22 undici compatibility Node.js v22 undici internal calls performance.markResourceTiming() after every fetch. The performance shim was missing this method, causing TypeError crashes in ACP mode when running with Node.js. --- src/utils/performanceShim.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/performanceShim.ts b/src/utils/performanceShim.ts index 174518bb6..2044d74ee 100644 --- a/src/utils/performanceShim.ts +++ b/src/utils/performanceShim.ts @@ -135,6 +135,9 @@ const shim = { clearResourceTimings: (() => {}) as typeof performance.clearResourceTimings, setResourceTimingBufferSize: (() => {}) as typeof performance.setResourceTimingBufferSize, + // Node.js v22 undici internal calls this after every fetch — must exist to + // avoid TypeError: markResourceTiming is not a function + markResourceTiming: (() => {}) as any, // Delegate read-only properties to the original get timeOrigin() { return original.timeOrigin @@ -148,7 +151,7 @@ const shim = { toJSON() { return original.toJSON() }, -} as typeof performance +} as unknown as typeof performance /** * Install the shim onto globalThis.performance. Safe to call multiple times.