From c3e13175d26acfd949ebc69efdf2928d36ec161f Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 22 Feb 2026 09:12:55 +0000 Subject: [PATCH] perf(test): bypass queue debounce in fast mode and tighten announce defaults --- .../subagent-announce.format.e2e.test.ts | 19 +++++++++++++++++-- src/utils/queue-helpers.ts | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/agents/subagent-announce.format.e2e.test.ts b/src/agents/subagent-announce.format.e2e.test.ts index 3835dc1e0..fa92ca989 100644 --- a/src/agents/subagent-announce.format.e2e.test.ts +++ b/src/agents/subagent-announce.format.e2e.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, expect, it, vi } from "vitest"; +import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js"; import { __testing as sessionBindingServiceTesting, @@ -61,7 +61,7 @@ let configOverride: ReturnType<(typeof import("../config/config.js"))["loadConfi }; const defaultOutcomeAnnounce = { task: "do thing", - timeoutMs: 1000, + timeoutMs: 10, cleanup: "keep" as const, waitForCompletion: false, startedAt: 10, @@ -141,7 +141,22 @@ vi.mock("../config/config.js", async (importOriginal) => { }); describe("subagent announce formatting", () => { + let previousFastTestEnv: string | undefined; + + beforeAll(() => { + previousFastTestEnv = process.env.OPENCLAW_TEST_FAST; + }); + + afterAll(() => { + if (previousFastTestEnv === undefined) { + delete process.env.OPENCLAW_TEST_FAST; + return; + } + process.env.OPENCLAW_TEST_FAST = previousFastTestEnv; + }); + beforeEach(() => { + vi.stubEnv("OPENCLAW_TEST_FAST", "1"); agentSpy .mockClear() .mockImplementation(async (_req: AgentCallRequest) => ({ runId: "run-main", status: "ok" })); diff --git a/src/utils/queue-helpers.ts b/src/utils/queue-helpers.ts index cb4889134..5a487f9bb 100644 --- a/src/utils/queue-helpers.ts +++ b/src/utils/queue-helpers.ts @@ -112,6 +112,9 @@ export function waitForQueueDebounce(queue: { debounceMs: number; lastEnqueuedAt: number; }): Promise { + if (process.env.OPENCLAW_TEST_FAST === "1") { + return Promise.resolve(); + } const debounceMs = Math.max(0, queue.debounceMs); if (debounceMs <= 0) { return Promise.resolve();