From a9b0371c83656e7c911c041c9bb827c83af068c8 Mon Sep 17 00:00:00 2001 From: James Russo Date: Mon, 16 Nov 2026 17:30:40 +0000 Subject: [PATCH] fix(cli): capture names its local page server's port in the bypass entry (#7965) Co-authored-by: Claude Opus 5.5 --- packages/cli/src/capture/launchCaptureBrowser.test.ts | 10 ++++++++++ packages/cli/src/capture/launchCaptureBrowser.ts | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/capture/launchCaptureBrowser.test.ts b/packages/cli/src/capture/launchCaptureBrowser.test.ts index bda3c78f9e..2f067e19ae 100644 --- a/packages/cli/src/capture/launchCaptureBrowser.test.ts +++ b/packages/cli/src/capture/launchCaptureBrowser.test.ts @@ -67,6 +67,16 @@ describe("capture browser transport lifecycle", () => { await session.close(); }); + // fails without the fix: a local page server on its scheme's default port gave a bypass entry with no port, which + // Chrome takes as every port on that host. + it("names a local page server's default port in its bypass entry", async () => { + const session = await launchCaptureBrowser({ ...options, localOrigin: "http://localhost" }); + expect(mocks.launch.mock.calls[0]?.[1].args).toContain( + "--proxy-bypass-list=<-loopback>;localhost:80", + ); + await session.close(); + }); + // A profile directory the OS refuses to empty stands in for Windows' locked Chrome lockfile. it.runIf(process.platform !== "win32" && process.getuid?.() !== 0)( "finishes a close whose profile directory cannot be removed, with a warning", diff --git a/packages/cli/src/capture/launchCaptureBrowser.ts b/packages/cli/src/capture/launchCaptureBrowser.ts index fe6a9c2a8d..fc626f7149 100644 --- a/packages/cli/src/capture/launchCaptureBrowser.ts +++ b/packages/cli/src/capture/launchCaptureBrowser.ts @@ -9,6 +9,7 @@ import { settleAcrossNavigation } from "./navigateForCapture.js"; import { browserProxyArgs, createPublicOnlyProfile, + pageServerDirectHost, startCaptureProxy, } from "@hyperframes/engine/public-network"; import { removeTreeBestEffortAsync } from "@hyperframes/core/remove-tree"; @@ -55,7 +56,7 @@ export async function launchCaptureBrowser(options: { ...captureBrowserArgs(options.disableWebgl, options.width, options.height), ...browserProxyArgs( proxy.url, - options.localOrigin ? new URL(options.localOrigin).host : undefined, + options.localOrigin ? pageServerDirectHost(options.localOrigin) : undefined, ), ], });