From 7d5544493e80936d0d661f5b90e2ec49f0ccfe93 Mon Sep 17 00:00:00 2001 From: roboomp Date: Mon, 29 Jun 2026 11:06:17 +0000 Subject: [PATCH] fix(stats): skipped sync worker smoke on darwin smokeTestSyncWorker spawned a worker via createSyncWorker on every platform, so omp --smoke-test (and the macOS signing pre-launch run in scripts/ci-macos-sign.sh) still hit the Bun-worker re-entry path the serial macOS sync default avoids. Early-return on darwin and document the carve-out. Fixes #3733 --- packages/stats/CHANGELOG.md | 1 + packages/stats/src/aggregator.ts | 10 +++++++-- .../stats/test/smoke-worker-darwin.test.ts | 21 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 packages/stats/test/smoke-worker-darwin.test.ts diff --git a/packages/stats/CHANGELOG.md b/packages/stats/CHANGELOG.md index 5e2a32afd..de604061f 100644 --- a/packages/stats/CHANGELOG.md +++ b/packages/stats/CHANGELOG.md @@ -6,6 +6,7 @@ - Kept stats session sync on the serial parser path for `workers: 1` and macOS defaults, avoiding Bun worker re-entry aborts when launching `/stats` ([#3733](https://github.com/can1357/oh-my-pi/issues/3733)). - Replaced the native `Bun.JSONL.parseChunk` session parser path with a lenient JS line scanner, avoiding Bun aborts on large stats session files ([#3733](https://github.com/can1357/oh-my-pi/issues/3733)). +- Skipped the stats sync worker smoke probe on darwin so `omp --smoke-test` (and the macOS signing/notarization pre-launch run) no longer re-enters the Bun-worker abort surface the serial macOS sync now avoids ([#3733](https://github.com/can1357/oh-my-pi/issues/3733)). ## [16.2.3] - 2026-06-28 diff --git a/packages/stats/src/aggregator.ts b/packages/stats/src/aggregator.ts index 3f3c5439d..1aec92565 100644 --- a/packages/stats/src/aggregator.ts +++ b/packages/stats/src/aggregator.ts @@ -152,10 +152,16 @@ function dispatch(handle: WorkerHandle, request: SyncWorkerRequest): Promise { + if (process.platform === "darwin") return; const worker = createSyncWorker(); const { promise, resolve, reject } = Promise.withResolvers(); const timer = setTimeout(() => reject(new Error(`sync worker did not pong within ${timeoutMs}ms`)), timeoutMs); diff --git a/packages/stats/test/smoke-worker-darwin.test.ts b/packages/stats/test/smoke-worker-darwin.test.ts new file mode 100644 index 000000000..b1a23d0f8 --- /dev/null +++ b/packages/stats/test/smoke-worker-darwin.test.ts @@ -0,0 +1,21 @@ +import { afterEach, describe, expect, it, vi } from "bun:test"; +import { smokeTestSyncWorker } from "@oh-my-pi/omp-stats/aggregator"; +import { installStatsTestIsolation } from "./helpers/temp-agent"; + +installStatsTestIsolation("@pi-stats-smoke-darwin-"); + +afterEach(() => { + vi.restoreAllMocks(); +}); + +describe("smokeTestSyncWorker", () => { + it("skips the worker spawn on darwin so omp --smoke-test stays off the macOS abort surface", async () => { + vi.spyOn(process, "platform", "get").mockReturnValue("darwin"); + const workerSpy = vi.spyOn(globalThis, "Worker").mockImplementation(() => { + throw new Error("worker should not be created on darwin"); + }); + + await expect(smokeTestSyncWorker()).resolves.toBeUndefined(); + expect(workerSpy).not.toHaveBeenCalled(); + }); +});