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>
This commit is contained in:
Peter Steinberger 2026-09-26 14:49:12 -07:00
parent 3d903819c5
commit a3dcaa1a68

View file

@ -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();