From 157ee9c5fade8ba6cf5dc7f59117cb3c4e33df18 Mon Sep 17 00:00:00 2001 From: hugo-ccabral Date: Mon, 24 Aug 2026 21:20:38 -0300 Subject: [PATCH 1/2] fix(lighthouse): resolve the per-run TEMP dir to an absolute path Every Lighthouse measurement failed on Windows with "Unable to connect to Chrome", wiping out the entire vitals section of benchmark reports (8/8 measurements errored on a real farmrio run, all 3 retries each). measureLighthouseOnce builds a per-run temp dir and hands it to the spawned lighthouse process as TEMP/TMP. That dir descends from --output, which defaults to the RELATIVE "./parity-output", so TEMP was relative too. chrome-launcher feeds os.tmpdir() straight into Chrome's --user-data-dir, and Chrome cannot resolve a relative profile dir, so it dies during launch and chrome-launcher surfaces the misleading "Unable to connect to Chrome". Bisected by replicating the exact spawn() options and flipping only this path: relative -> no report + "Unable to connect to Chrome"; absolute -> report written. Shell, concurrency and Playwright contention were each ruled out as causes. Note this is easy to miss from a terminal: typing the same command in a shell exports TEMP through MSYS/cmd path normalization, which makes it absolute before Chrome ever sees it. Only the programmatic spawn preserves the relative form. Fixes lighthouse for every consumer (benchmark, vitals, checks), not just the benchmark path. Co-Authored-By: Claude Opus 5 --- packages/parity/src/engine/lighthouse.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/parity/src/engine/lighthouse.ts b/packages/parity/src/engine/lighthouse.ts index 3c96417..a9d37bf 100644 --- a/packages/parity/src/engine/lighthouse.ts +++ b/packages/parity/src/engine/lighthouse.ts @@ -13,7 +13,7 @@ // run gets its own writable TEMP. import { spawn } from "node:child_process"; import { mkdirSync, readFileSync } from "node:fs"; -import { join } from "node:path"; +import { join, resolve } from "node:path"; import type { AgentA11yAudit, LhOpportunity, LhScores } from "../types/schema.ts"; export type { AgentA11yAudit, LhOpportunity, LhScores }; @@ -173,7 +173,12 @@ async function measureLighthouseOnce( // dir and can hit EPERM there (Windows AV/ACL flakiness) — give this run its // own writable TEMP so chrome-launcher's tmp dir creation lands somewhere // uncontended instead of fighting --chrome-flags quoting. - const runTemp = join(opts.outDir, `.tmp-${opts.id}-a${attempt}`); + // MUST be absolute: this becomes TEMP/TMP for the spawned lighthouse, whose + // chrome-launcher feeds os.tmpdir() straight into Chrome's --user-data-dir. + // outDir descends from --output, which defaults to the RELATIVE "./parity-output", + // and Chrome cannot resolve a relative profile dir — it dies on launch and + // chrome-launcher reports the misleading "Unable to connect to Chrome". + const runTemp = resolve(opts.outDir, `.tmp-${opts.id}-a${attempt}`); mkdirSync(runTemp, { recursive: true }); const args = [ "--yes", From 05de19d90a961871aaabe9902811670c6aeeaad3 Mon Sep 17 00:00:00 2001 From: hugo-ccabral Date: Mon, 24 Aug 2026 21:20:52 -0300 Subject: [PATCH 2/2] perf(benchmark): measure the three Lighthouse pages sequentially Independent of the TEMP bug fixed in the previous commit: the benchmark ran its home/PLP/PDP Lighthouse passes through Promise.all, so each side had 3 Chrome instances measuring at once, both sides overlap, and Playwright still holds its own browsers open. Lighthouse measures CPU under a 4x throttle, so three concurrent passes inflate each other's LCP/TBT numbers. The vitals command already accounts for this, defaulting --lighthouse-concurrency to cores/2 capped at 2; the benchmark path never got the same treatment, which undercuts the prod-vs-cand comparison the report exists to make. Trades vitals-phase wall-clock for numbers that mean something. Applied to both journey shapes (commerce and content). Drop this commit if the speed matters more than the precision. Co-Authored-By: Claude Opus 5 --- packages/parity/src/engine/benchmark.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/parity/src/engine/benchmark.ts b/packages/parity/src/engine/benchmark.ts index 0eed2ef..cbe1f31 100644 --- a/packages/parity/src/engine/benchmark.ts +++ b/packages/parity/src/engine/benchmark.ts @@ -1447,11 +1447,14 @@ export async function runSideBenchmark(opts: RunSideOptions): Promise