Skip to content

Commit beccdde

Browse files
committed
fix(qa): isolate patched suite scenarios
1 parent a80476f commit beccdde

9 files changed

Lines changed: 235 additions & 22 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Docs: https://docs.openclaw.ai
2929

3030
- fix(integrations): enforce channel read target allowlists [AI]. (#84982) Thanks @pgondhi987.
3131
- Agents/code-mode: expose outer code-mode `exec` source through the `command` hook alias with `toolKind`/`toolInputKind` discriminators so exec-shaped policies can distinguish code-mode cells. (#83483) Thanks @Kaspre.
32+
- QA-Lab: isolate multi-scenario suite workers when scenarios need startup config patches, preventing message-routing config from leaking into unrelated scenarios.
33+
- QA-Lab: make the commitments heartbeat-target-none scenario request an immediate heartbeat instead of waiting for the next scheduled heartbeat.
3234
- Gateway CLI: surface local post-challenge connect assembly failures immediately instead of waiting for the wrapper timeout. Fixes #68944. (#85253) Thanks @samzong.
3335
- Agents/exec: treat denied exec approvals as terminal instead of feeding them back into agent follow-up work, and recognize Chinese stop phrases in abort handling. Fixes #69386. (#85194) Thanks @samzong.
3436
- CLI/agents: abort accepted Gateway-backed `openclaw agent` runs on SIGINT/SIGTERM so cron and supervisor timeouts do not leave remote agent work alive. Fixes #71710. (#84381) Thanks @Kaspre.

‎extensions/qa-lab/src/lab-server.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ export async function startQaLabServer(
547547
const { runQaSuite } = await import("./suite.js");
548548
const result = await runQaSuite({
549549
lab: labHandle ?? undefined,
550+
startLab: startQaLabServer,
550551
outputDir: createQaRunOutputDir(repoRoot),
551552
providerMode: selection.providerMode,
552553
primaryModel: selection.primaryModel,

‎extensions/qa-lab/src/qa-channel-transport.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function createQaChannelReportNotes(params: QaTransportReportParams) {
102102
provider.kind === "mock"
103103
? `Runs against qa-channel + qa-lab bus + real gateway child + ${params.providerMode} provider.`
104104
: `Runs against qa-channel + qa-lab bus + real gateway child + live frontier models (${params.primaryModel}, ${params.alternateModel})${params.fastMode ? " with fast mode enabled" : ""}.`,
105-
params.concurrency > 1
105+
params.isolatedWorkers === true
106106
? `Scenarios run in isolated gateway workers with concurrency ${params.concurrency}.`
107107
: "Scenarios run serially in one gateway worker.",
108108
"Cron uses a one-minute schedule assertion plus forced execution for fast verification.",

‎extensions/qa-lab/src/qa-transport.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type QaTransportReportParams = {
3030
alternateModel: string;
3131
fastMode: boolean;
3232
concurrency: number;
33+
isolatedWorkers?: boolean;
3334
};
3435

3536
export type QaTransportGatewayConfig = Pick<OpenClawConfig, "channels" | "messages">;

‎extensions/qa-lab/src/suite-planning.test.ts‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
resolveQaSuiteOutputDir,
1414
scenarioRequiresControlUi,
1515
selectQaSuiteScenarios,
16+
shouldUseIsolatedQaSuiteScenarioWorkers,
1617
} from "./suite-planning.js";
1718
import { makeQaSuiteTestScenario } from "./suite-test-helpers.js";
1819

@@ -302,6 +303,46 @@ describe("qa suite planning helpers", () => {
302303
});
303304
});
304305

306+
it("isolates multi-scenario serial runs when a scenario needs startup config", () => {
307+
const scenarios = [
308+
makeQaSuiteTestScenario("baseline"),
309+
makeQaSuiteTestScenario("message-tool-mode", {
310+
gatewayConfigPatch: {
311+
messages: {
312+
groupChat: {
313+
visibleReplies: "message_tool",
314+
},
315+
},
316+
},
317+
}),
318+
];
319+
320+
expect(
321+
shouldUseIsolatedQaSuiteScenarioWorkers({
322+
scenarios,
323+
concurrency: 1,
324+
}),
325+
).toBe(true);
326+
});
327+
328+
it("does not isolate plain serial scenario runs", () => {
329+
expect(
330+
shouldUseIsolatedQaSuiteScenarioWorkers({
331+
scenarios: [makeQaSuiteTestScenario("first"), makeQaSuiteTestScenario("second")],
332+
concurrency: 1,
333+
}),
334+
).toBe(false);
335+
});
336+
337+
it("keeps concurrent runs on isolated workers", () => {
338+
expect(
339+
shouldUseIsolatedQaSuiteScenarioWorkers({
340+
scenarios: [makeQaSuiteTestScenario("first"), makeQaSuiteTestScenario("second")],
341+
concurrency: 2,
342+
}),
343+
).toBe(true);
344+
});
345+
305346
it("enables Control UI only for Control UI scenario workers", () => {
306347
expect(
307348
scenarioRequiresControlUi(

‎extensions/qa-lab/src/suite-planning.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ function collectQaSuiteGatewayRuntimeOptions(
152152
return forwardHostHome ? { forwardHostHome: true } : undefined;
153153
}
154154

155+
function shouldUseIsolatedQaSuiteScenarioWorkers(params: {
156+
scenarios: ReturnType<typeof readQaBootstrapScenarioCatalog>["scenarios"];
157+
concurrency: number;
158+
}) {
159+
return (
160+
params.scenarios.length > 1 &&
161+
(params.concurrency > 1 ||
162+
params.scenarios.some((scenario) => isQaPlainObject(scenario.gatewayConfigPatch)))
163+
);
164+
}
165+
155166
function scenarioRequiresControlUi(scenario: QaSeedScenario) {
156167
return normalizeLowercaseStringOrEmpty(scenario.surface) === "control-ui";
157168
}
@@ -268,5 +279,6 @@ export {
268279
resolveQaSuiteOutputDir,
269280
scenarioRequiresControlUi,
270281
selectQaSuiteScenarios,
282+
shouldUseIsolatedQaSuiteScenarioWorkers,
271283
splitModelRef,
272284
};

‎extensions/qa-lab/src/suite.test.ts‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { afterEach, describe, expect, it, vi } from "vitest";
2+
import type { QaLabServerHandle } from "./lab-server.types.js";
3+
import { makeQaSuiteTestScenario } from "./suite-test-helpers.js";
24
import { qaSuiteProgressTesting, runQaSuite } from "./suite.js";
35

46
const fetchWithSsrFGuardMock = vi.hoisted(() => vi.fn());
@@ -12,6 +14,19 @@ afterEach(() => {
1214
vi.useRealTimers();
1315
});
1416

17+
function makeQaSuiteTestLabHandle(): QaLabServerHandle {
18+
return {
19+
baseUrl: "http://127.0.0.1:43123",
20+
listenUrl: "http://127.0.0.1:43123",
21+
state: {} as QaLabServerHandle["state"],
22+
setControlUi: vi.fn(),
23+
setScenarioRun: vi.fn(),
24+
setLatestReport: vi.fn(),
25+
runSelfCheck: vi.fn(async () => ({}) as Awaited<ReturnType<QaLabServerHandle["runSelfCheck"]>>),
26+
stop: vi.fn(async () => {}),
27+
};
28+
}
29+
1530
describe("qa suite", () => {
1631
it("rejects unsupported transport ids before starting the lab", async () => {
1732
const startLab = vi.fn();
@@ -254,6 +269,84 @@ describe("qa suite", () => {
254269
});
255270
});
256271

272+
it("forwards run options into isolated scenario worker params", () => {
273+
const startLab = vi.fn();
274+
const scenario = makeQaSuiteTestScenario("patched-control-ui", {
275+
surface: "control-ui",
276+
gatewayConfigPatch: {
277+
messages: {
278+
groupChat: {
279+
visibleReplies: "message_tool",
280+
},
281+
},
282+
},
283+
});
284+
285+
expect(
286+
qaSuiteProgressTesting.buildQaIsolatedScenarioWorkerParams({
287+
repoRoot: "/repo",
288+
outputDir: "/repo/.artifacts/qa-e2e/scenarios/patched-control-ui",
289+
providerMode: "mock-openai",
290+
transportId: "qa-channel",
291+
primaryModel: "mock-openai/gpt-5.5",
292+
alternateModel: "mock-openai/gpt-5.5-alt",
293+
fastMode: true,
294+
scenario,
295+
startLab,
296+
input: {
297+
thinkingDefault: "minimal",
298+
claudeCliAuthMode: "subscription",
299+
enabledPluginIds: ["acpx"],
300+
transportReadyTimeoutMs: 180_000,
301+
forcedRuntime: "codex",
302+
},
303+
}),
304+
).toMatchObject({
305+
scenarioIds: ["patched-control-ui"],
306+
concurrency: 1,
307+
startLab,
308+
controlUiEnabled: true,
309+
thinkingDefault: "minimal",
310+
claudeCliAuthMode: "subscription",
311+
enabledPluginIds: ["acpx"],
312+
transportReadyTimeoutMs: 180_000,
313+
forcedRuntime: "codex",
314+
});
315+
});
316+
317+
it("keeps caller-owned serial labs on shared workers without a launcher", () => {
318+
const scenarios = [
319+
makeQaSuiteTestScenario("baseline"),
320+
makeQaSuiteTestScenario("message-tool-mode", {
321+
gatewayConfigPatch: {
322+
messages: {
323+
groupChat: {
324+
visibleReplies: "message_tool",
325+
},
326+
},
327+
},
328+
}),
329+
];
330+
const lab = makeQaSuiteTestLabHandle();
331+
const startLab = vi.fn();
332+
333+
expect(
334+
qaSuiteProgressTesting.shouldRunQaSuiteWithIsolatedScenarioWorkers({
335+
scenarios,
336+
concurrency: 1,
337+
lab,
338+
}),
339+
).toBe(false);
340+
expect(
341+
qaSuiteProgressTesting.shouldRunQaSuiteWithIsolatedScenarioWorkers({
342+
scenarios,
343+
concurrency: 1,
344+
lab,
345+
startLab,
346+
}),
347+
).toBe(true);
348+
});
349+
257350
it("remaps mock-openai model refs onto the app-server OpenAI provider for codex cells only", () => {
258351
expect(
259352
qaSuiteProgressTesting.remapModelRefForForcedRuntime({

0 commit comments

Comments
 (0)