fix: parse qa suite concurrency env strictly · openclaw/openclaw@2cde331
steipete
·
2026-05-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -34,6 +34,17 @@ describe("qa suite planning helpers", () => {
|
34 | 34 | expect(normalizeQaSuiteConcurrency(2.8, 10)).toBe(2); |
35 | 35 | expect(normalizeQaSuiteConcurrency(20, 3)).toBe(3); |
36 | 36 | expect(normalizeQaSuiteConcurrency(0, 3)).toBe(1); |
| 37 | + |
| 38 | +process.env.OPENCLAW_QA_SUITE_CONCURRENCY = "3"; |
| 39 | +expect(normalizeQaSuiteConcurrency(undefined, 10)).toBe(3); |
| 40 | + |
| 41 | +process.env.OPENCLAW_QA_SUITE_CONCURRENCY = "0"; |
| 42 | +expect(normalizeQaSuiteConcurrency(undefined, 10)).toBe(1); |
| 43 | + |
| 44 | +for (const value of ["0x10", "1e2", "2.5"]) { |
| 45 | +process.env.OPENCLAW_QA_SUITE_CONCURRENCY = value; |
| 46 | +expect(normalizeQaSuiteConcurrency(undefined, 10)).toBe(10); |
| 47 | +} |
37 | 48 | } finally { |
38 | 49 | if (previous === undefined) { |
39 | 50 | delete process.env.OPENCLAW_QA_SUITE_CONCURRENCY; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import path from "node:path"; |
| 2 | +import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime"; |
2 | 3 | import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime"; |
3 | 4 | import { ensureRepoBoundDirectory, resolveRepoRelativeOutputDir } from "./cli-paths.js"; |
4 | 5 | import type { QaCliBackendAuthMode } from "./gateway-child.js"; |
@@ -176,11 +177,11 @@ function normalizeQaSuiteConcurrency(
|
176 | 177 | scenarioCount: number, |
177 | 178 | defaultConcurrency = DEFAULT_QA_SUITE_CONCURRENCY, |
178 | 179 | ) { |
179 | | -const envValue = Number(process.env.OPENCLAW_QA_SUITE_CONCURRENCY); |
| 180 | +const envValue = parseStrictNonNegativeInteger(process.env.OPENCLAW_QA_SUITE_CONCURRENCY); |
180 | 181 | const raw = |
181 | 182 | typeof value === "number" && Number.isFinite(value) |
182 | 183 | ? value |
183 | | - : Number.isFinite(envValue) |
| 184 | + : envValue !== undefined |
184 | 185 | ? envValue |
185 | 186 | : defaultConcurrency; |
186 | 187 | return Math.max(1, Math.min(Math.floor(raw), Math.max(1, scenarioCount))); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。