From 88284181118f42bcf1d601b640315fee3691f997 Mon Sep 17 00:00:00 2001 From: zwffff Date: Tue, 3 Mar 2026 00:33:07 +0800 Subject: [PATCH] test(subagent-announce): fix flaky Windows-only test failure (#31298) (openclaw#31370) thanks @zwffff Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check (fails on main baseline issues in extensions/googlechat and extensions/phone-control) - pnpm test:e2e src/agents/subagent-announce.format.e2e.test.ts Co-authored-by: zwffff <5809959+zwffff@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> --- CHANGELOG.md | 1 + src/agents/subagent-announce.format.e2e.test.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76b5ebd370a..afda3f951bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Docs: https://docs.openclaw.ai ### Fixes +- Tests/Subagent announce: set `OPENCLAW_TEST_FAST=1` before importing `subagent-announce` format suites so module-level fast-mode constants are captured deterministically on Windows CI, preventing timeout flakes in nested completion announce coverage. (#31370) Thanks @zwffff. - Gateway/Node dangerous-command parity: include `sms.send` in default onboarding node `denyCommands`, share onboarding deny defaults with the gateway dangerous-command source of truth, and include `sms.send` in phone-control `/phone arm writes` handling so SMS follows the same break-glass flow as other dangerous node commands. Thanks @zpbrent. - Zalo/Pairing auth tests: add webhook regression coverage asserting DM pairing-store reads/writes remain account-scoped, preventing cross-account authorization bleed in multi-account setups. (#26121) Thanks @bmendonca3. - Logging: use local time for logged timestamps instead of UTC, aligning log output with documented local timezone behavior and avoiding confusion during local diagnostics. (#28434) Thanks @liuy. diff --git a/src/agents/subagent-announce.format.e2e.test.ts b/src/agents/subagent-announce.format.e2e.test.ts index c82151e6515..e30b313f49d 100644 --- a/src/agents/subagent-announce.format.e2e.test.ts +++ b/src/agents/subagent-announce.format.e2e.test.ts @@ -147,8 +147,13 @@ describe("subagent announce formatting", () => { let runSubagentAnnounceFlow: (typeof import("./subagent-announce.js"))["runSubagentAnnounceFlow"]; beforeAll(async () => { - ({ runSubagentAnnounceFlow } = await import("./subagent-announce.js")); + // Set FAST_TEST_MODE before importing the module to ensure the module-level + // constant picks it up. This fixes flaky Windows CI failures where the test + // timeout budget is too tight without fast mode enabled. + // See: https://github.com/openclaw/openclaw/issues/31298 previousFastTestEnv = process.env.OPENCLAW_TEST_FAST; + process.env.OPENCLAW_TEST_FAST = "1"; + ({ runSubagentAnnounceFlow } = await import("./subagent-announce.js")); }); afterAll(() => { @@ -160,7 +165,8 @@ describe("subagent announce formatting", () => { }); beforeEach(() => { - vi.stubEnv("OPENCLAW_TEST_FAST", "1"); + // OPENCLAW_TEST_FAST is set in beforeAll before module import + // to ensure the module-level constant picks it up. agentSpy .mockClear() .mockImplementation(async (_req: AgentCallRequest) => ({ runId: "run-main", status: "ok" }));