From a3dcaa1a68c01c77fbbab1dd851309ba1c705d90 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 26 Sep 2026 14:49:12 -0700 Subject: [PATCH] fix(googlechat): preload setup lifecycle runtime fixture The setup mock imports the real monitor lazily. Cold transforms exceed the one-second lifecycle assertion wait, then the late monitor call contaminates the next test. Load the mock in beforeAll; retain the real webhook resolver, all lifecycle assertions, and existing deadlines. No runtime behavior changes. Adapts the fix proposed in #159189. Main reproduced two failures both alone and in the original 109-file messaging CI shard. Validation: 20 cold-cache standalone runs (30 tests each), three original-shard runs (1,179 tests each), check:changed with extension test types and lint, and Codex review through P2. Standalone cold runs took 19-72 seconds including compiler preparation. Co-authored-by: Gabriel Bogdanovsky <96370799+TeaCup404@users.noreply.github.com> --- extensions/googlechat/src/setup.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extensions/googlechat/src/setup.test.ts b/extensions/googlechat/src/setup.test.ts index fd11f2aefdac..a04ffb5769c9 100644 --- a/extensions/googlechat/src/setup.test.ts +++ b/extensions/googlechat/src/setup.test.ts @@ -23,7 +23,7 @@ import { tempWorkspaceSync, type TempWorkspaceSync, } from "openclaw/plugin-sdk/temp-path"; -import { afterAll, afterEach, describe, expect, it, vi } from "vitest"; +import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest"; import { listGoogleChatAccountIds, resolveGoogleChatAccount, @@ -91,6 +91,11 @@ async function waitForGoogleChatMonitorStarted() { } describe("googlechat setup", () => { + beforeAll(async () => { + // Keep cold monitor imports out of the lifecycle assertion's wait budget. + await import("./channel.runtime.js"); + }); + afterEach(() => { vi.clearAllMocks(); vi.unstubAllEnvs();