Skip to content

Commit db53379

Browse files
authored
fix(qa): reject incomplete evidence runs (#126407)
* fix(qa): enforce terminal evidence lifecycle * test(qa): mark CPU fixture summary completed * fix(qa): fence calls after flow timeout
1 parent f685030 commit db53379

38 files changed

Lines changed: 1124 additions & 363 deletions

‎extensions/qa-lab/src/character-eval.test.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ async function makeSuiteResult(params: {
9797
resultStatus?: "pass" | "fail";
9898
summaryStatus?: "pass" | "fail";
9999
summaryFailedCount?: number;
100+
runStatus?: "running" | "completed";
100101
}) {
101102
const resultStatus = params.resultStatus ?? "pass";
102103
const summaryStatus = params.summaryStatus ?? resultStatus;
@@ -107,6 +108,7 @@ async function makeSuiteResult(params: {
107108
summaryPath,
108109
`${JSON.stringify(
109110
{
111+
run: { status: params.runStatus ?? "completed" },
110112
counts: {
111113
total: 1,
112114
passed: summaryFailedCount > 0 ? 0 : 1,
@@ -614,6 +616,30 @@ describe("runQaCharacterEval", () => {
614616
expect(result.runs[0]?.error).toBeUndefined();
615617
});
616618

619+
it("rejects a candidate whose suite summary is still running", async () => {
620+
const model = "openai/gpt-5.6-luna";
621+
const result = await runQaCharacterEval({
622+
repoRoot: tempRoot,
623+
outputDir: path.join(tempRoot, "character"),
624+
models: [model],
625+
judgeModels: [model],
626+
runSuite: async (params) =>
627+
makeSuiteResult({
628+
outputDir: params.outputDir,
629+
model,
630+
transcript: "USER Alice: hi\n\nASSISTANT openclaw: partial reply",
631+
runStatus: "running",
632+
}),
633+
runJudge: makeRunJudge([{ model, rank: 1, score: 0.5, summary: "failed" }]),
634+
});
635+
636+
expect(result.runs[0]).toMatchObject({
637+
model,
638+
status: "fail",
639+
error: expect.stringContaining("still running"),
640+
});
641+
});
642+
617643
it.each([
618644
{ description: "user-only conversation", transcript: "USER Alice: hello?" },
619645
{ description: "report-only fallback", transcript: "# Character scenario report" },

‎extensions/qa-lab/src/cli.runtime.test.ts‎

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ describe("qa cli runtime", () => {
321321
await fs.writeFile(
322322
suiteSummaryPath,
323323
JSON.stringify({
324+
run: { status: "completed" },
324325
counts: {
325326
total: 1,
326327
passed: 1,
@@ -334,6 +335,7 @@ describe("qa cli runtime", () => {
334335
await fs.writeFile(
335336
telegramSummaryPath,
336337
JSON.stringify({
338+
run: { status: "completed" },
337339
counts: {
338340
total: 1,
339341
passed: 1,
@@ -487,6 +489,7 @@ describe("qa cli runtime", () => {
487489
await fs.writeFile(
488490
suiteSummaryPath,
489491
JSON.stringify({
492+
run: { status: "completed" },
490493
counts: { total: 1, passed: 0, failed: 0, skipped: 1 },
491494
scenarios: [optionalScenario],
492495
}),
@@ -511,6 +514,7 @@ describe("qa cli runtime", () => {
511514
await fs.writeFile(
512515
suiteSummaryPath,
513516
JSON.stringify({
517+
run: { status: "completed" },
514518
counts: { total: 2, passed: 1, failed: 0, skipped: 0 },
515519
scenarios: [{ status: "pass" }],
516520
}),
@@ -534,6 +538,7 @@ describe("qa cli runtime", () => {
534538
await fs.writeFile(
535539
suiteSummaryPath,
536540
JSON.stringify({
541+
run: { status: "completed" },
537542
counts: { total: 1, passed: 1, failed: 0, skipped: 0 },
538543
scenarios: [{ status: "pass" }],
539544
evidence: { entries: [{ result: { status: "fail" } }] },
@@ -560,6 +565,7 @@ describe("qa cli runtime", () => {
560565
await fs.writeFile(
561566
suiteSummaryPath,
562567
JSON.stringify({
568+
run: { status: "completed" },
563569
counts: { total: 1, passed: 1, failed: 0, skipped: 0 },
564570
scenarios: [{ status: "pass" }],
565571
evidence: {
@@ -596,6 +602,7 @@ describe("qa cli runtime", () => {
596602
await fs.writeFile(
597603
suiteSummaryPath,
598604
JSON.stringify({
605+
run: { status: "completed" },
599606
counts: { total: 2, passed: 1, failed: 0, skipped: 1 },
600607
scenarios: [QA_PASSING_SUITE_SCENARIO, optionalScenario],
601608
}),
@@ -628,6 +635,7 @@ describe("qa cli runtime", () => {
628635
await fs.writeFile(
629636
suiteSummaryPath,
630637
JSON.stringify({
638+
run: { status: "completed" },
631639
counts: { total: 1, passed: 0, failed: 0, skipped: 1 },
632640
scenarios: [optionalScenario],
633641
}),
@@ -693,6 +701,7 @@ describe("qa cli runtime", () => {
693701
await fs.writeFile(
694702
suiteSummaryPath,
695703
JSON.stringify({
704+
run: { status: "completed" },
696705
counts: { total: 0, passed: 0, failed: 0, skipped: 0 },
697706
scenarios: [],
698707
}),
@@ -702,6 +711,7 @@ describe("qa cli runtime", () => {
702711
await fs.writeFile(
703712
suiteSummaryPath,
704713
JSON.stringify({
714+
run: { status: "completed" },
705715
counts:
706716
summary === "required-skip"
707717
? { total: 1, passed: 0, failed: 0, skipped: 1 }
@@ -986,6 +996,7 @@ describe("qa cli runtime", () => {
986996
await fs.writeFile(
987997
suiteSummaryPath,
988998
JSON.stringify({
999+
run: { status: "completed" },
9891000
counts: { total: 2, passed: 1, failed: 0, skipped: 1 },
9901001
scenarios: [QA_PASSING_SUITE_SCENARIO, optionalScenario],
9911002
}),
@@ -1765,6 +1776,7 @@ describe("qa cli runtime", () => {
17651776
await fs.writeFile(
17661777
telegramSummaryPath,
17671778
JSON.stringify({
1779+
run: { status: "completed" },
17681780
counts: { total: 1, passed: 1, failed: 0 },
17691781
scenarios: [{ status: "fail" }],
17701782
}),
@@ -1793,6 +1805,7 @@ describe("qa cli runtime", () => {
17931805
await fs.writeFile(
17941806
telegramSummaryPath,
17951807
JSON.stringify({
1808+
run: { status: "completed" },
17961809
counts: { total: 1, passed: 0, failed: 1 },
17971810
scenarios: [{ status: "fail" }],
17981811
}),
@@ -1856,6 +1869,7 @@ describe("qa cli runtime", () => {
18561869
await fs.writeFile(
18571870
suiteSummaryPath,
18581871
JSON.stringify({
1872+
run: { status: "completed" },
18591873
counts: {
18601874
total: 1,
18611875
passed: 0,
@@ -1888,6 +1902,7 @@ describe("qa cli runtime", () => {
18881902
await fs.writeFile(
18891903
suiteSummaryPath,
18901904
JSON.stringify({
1905+
run: { status: "completed" },
18911906
counts: { total: 1, passed: 0, failed: 0, skipped: 1 },
18921907
scenarios: [
18931908
{
@@ -1927,6 +1942,7 @@ describe("qa cli runtime", () => {
19271942
await fs.writeFile(
19281943
suiteSummaryPath,
19291944
JSON.stringify({
1945+
run: { status: "completed" },
19301946
counts: { total: 2, passed: 1, failed: 0, skipped: 1 },
19311947
scenarios: [QA_PASSING_SUITE_SCENARIO, optionalScenario],
19321948
}),
@@ -1954,6 +1970,7 @@ describe("qa cli runtime", () => {
19541970
await fs.writeFile(
19551971
suiteSummaryPath,
19561972
JSON.stringify({
1973+
run: { status: "completed" },
19571974
counts: { total: 1, passed: 0, failed: 0, skipped: 1 },
19581975
scenarios: [
19591976
{
@@ -1989,6 +2006,7 @@ describe("qa cli runtime", () => {
19892006
await fs.writeFile(
19902007
suiteSummaryPath,
19912008
JSON.stringify({
2009+
run: { status: "completed" },
19922010
counts: {
19932011
total: 1,
19942012
passed: 0,
@@ -2022,6 +2040,7 @@ describe("qa cli runtime", () => {
20222040
await fs.writeFile(
20232041
suiteSummaryPath,
20242042
JSON.stringify({
2043+
run: { status: "completed" },
20252044
counts: {
20262045
total: 1,
20272046
passed: 0,
@@ -2120,6 +2139,7 @@ describe("qa cli runtime", () => {
21202139
await fs.writeFile(
21212140
suiteSummaryPath,
21222141
JSON.stringify({
2142+
run: { status: "completed" },
21232143
counts: {
21242144
total: 1,
21252145
passed: 0,
@@ -2184,6 +2204,7 @@ describe("qa cli runtime", () => {
21842204
await fs.writeFile(
21852205
suiteSummaryPath,
21862206
JSON.stringify({
2207+
run: { status: "completed" },
21872208
counts: {
21882209
total: 1,
21892210
passed: 0,
@@ -2216,6 +2237,7 @@ describe("qa cli runtime", () => {
22162237
await fs.writeFile(
22172238
suiteSummaryPath,
22182239
JSON.stringify({
2240+
run: { status: "completed" },
22192241
counts: {
22202242
total: 1,
22212243
passed: 0,
@@ -2440,13 +2462,15 @@ describe("qa cli runtime", () => {
24402462
await fs.writeFile(
24412463
path.join(repoRoot, "candidate.json"),
24422464
JSON.stringify({
2465+
run: { status: "completed" },
24432466
scenarios: [{ name: "Approval turn tool followthrough", status: "pass" }],
24442467
}),
24452468
"utf8",
24462469
);
24472470
await fs.writeFile(
24482471
path.join(repoRoot, "baseline.json"),
24492472
JSON.stringify({
2473+
run: { status: "completed" },
24502474
scenarios: [{ name: "Approval turn tool followthrough", status: "pass" }],
24512475
}),
24522476
"utf8",
@@ -2511,6 +2535,7 @@ describe("qa cli runtime", () => {
25112535
],
25122536
counts: { total: 1, passed: 1, failed: 0 },
25132537
run: {
2538+
status: "completed",
25142539
providerMode: "mock-openai",
25152540
primaryModel: "openai/gpt-5.6-luna",
25162541
runtimePair: ["openclaw", "codex"],
@@ -2586,6 +2611,7 @@ describe("qa cli runtime", () => {
25862611
],
25872612
counts: { total: 1, passed: 1, failed: 0 },
25882613
run: {
2614+
status: "completed",
25892615
providerMode: "live-frontier",
25902616
primaryModel: "openai/gpt-5.6-luna",
25912617
runtimePair: ["openclaw", "codex"],
@@ -2680,6 +2706,27 @@ describe("qa cli runtime", () => {
26802706
expectWriteContains(stdoutWrite, "codex-native-workspace");
26812707
});
26822708

2709+
it("rejects null tool coverage summary JSON", async () => {
2710+
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), "qa-tool-coverage-null-"));
2711+
await fs.writeFile(path.join(repoRoot, "runtime-summary.json"), "null\n", "utf8");
2712+
const priorExitCode = process.exitCode;
2713+
process.exitCode = undefined;
2714+
try {
2715+
await expect(
2716+
runQaCoverageReportCommand({
2717+
repoRoot,
2718+
tools: true,
2719+
summary: "runtime-summary.json",
2720+
json: true,
2721+
}),
2722+
).rejects.toMatchObject({ code: "summary_not_completed" });
2723+
expect(process.exitCode).toBeUndefined();
2724+
} finally {
2725+
process.exitCode = priorExitCode;
2726+
await fs.rm(repoRoot, { recursive: true, force: true });
2727+
}
2728+
});
2729+
26832730
it("writes a curated mock JSONL replay report and summary", async () => {
26842731
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), "qa-jsonl-replay-cli-"));
26852732
try {
@@ -2767,7 +2814,7 @@ describe("qa cli runtime", () => {
27672814
},
27682815
},
27692816
],
2770-
run: { runtimePair: ["openclaw", "codex"] },
2817+
run: { status: "completed", runtimePair: ["openclaw", "codex"] },
27712818
}),
27722819
"utf8",
27732820
);
@@ -3069,6 +3116,7 @@ describe("qa cli runtime", () => {
30693116
await fs.writeFile(
30703117
summaryPath,
30713118
JSON.stringify({
3119+
run: { status: "completed" },
30723120
counts: {
30733121
total: 2,
30743122
passed: 1,
@@ -3108,6 +3156,7 @@ describe("qa cli runtime", () => {
31083156
await fs.writeFile(
31093157
summaryPath,
31103158
JSON.stringify({
3159+
run: { status: "completed" },
31113160
counts: {
31123161
total: 2,
31133162
passed: 1,
@@ -3142,6 +3191,38 @@ describe("qa cli runtime", () => {
31423191
}
31433192
});
31443193

3194+
it("rejects a running multipass summary", async () => {
3195+
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), "qa-multipass-summary-"));
3196+
const summaryPath = path.join(repoRoot, "qa-suite-summary.json");
3197+
await fs.writeFile(
3198+
summaryPath,
3199+
JSON.stringify({
3200+
run: { status: "running" },
3201+
counts: { total: 1, passed: 1, failed: 0, skipped: 0 },
3202+
scenarios: [{ status: "pass" }],
3203+
}),
3204+
"utf8",
3205+
);
3206+
runQaMultipass.mockResolvedValueOnce({
3207+
outputDir: repoRoot,
3208+
reportPath: path.join(repoRoot, "qa-suite-report.md"),
3209+
summaryPath,
3210+
hostLogPath: path.join(repoRoot, "multipass-host.log"),
3211+
bootstrapLogPath: path.join(repoRoot, "multipass-guest-bootstrap.log"),
3212+
guestScriptPath: path.join(repoRoot, "multipass-guest-run.sh"),
3213+
vmName: "openclaw-qa-test",
3214+
scenarioIds: ["channel-chat-baseline"],
3215+
});
3216+
3217+
try {
3218+
await expect(
3219+
runQaSuiteCommand({ repoRoot: "/tmp/openclaw-repo", runner: "multipass" }),
3220+
).rejects.toMatchObject({ code: "summary_not_completed" });
3221+
} finally {
3222+
await fs.rm(repoRoot, { recursive: true, force: true });
3223+
}
3224+
});
3225+
31453226
it("rejects malformed multipass summary JSON", async () => {
31463227
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), "qa-multipass-summary-"));
31473228
const summaryPath = path.join(repoRoot, "qa-suite-summary.json");
@@ -3198,7 +3279,11 @@ describe("qa cli runtime", () => {
31983279
it("rejects partial multipass summary JSON without failure fields", async () => {
31993280
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), "qa-multipass-summary-"));
32003281
const summaryPath = path.join(repoRoot, "qa-suite-summary.json");
3201-
await fs.writeFile(summaryPath, JSON.stringify({ counts: { total: 2, passed: 2 } }), "utf8");
3282+
await fs.writeFile(
3283+
summaryPath,
3284+
JSON.stringify({ run: { status: "completed" }, counts: { total: 2, passed: 2 } }),
3285+
"utf8",
3286+
);
32023287
runQaMultipass.mockResolvedValueOnce({
32033288
outputDir: repoRoot,
32043289
reportPath: path.join(repoRoot, "qa-suite-report.md"),
@@ -3230,6 +3315,7 @@ describe("qa cli runtime", () => {
32303315
await fs.writeFile(
32313316
summaryPath,
32323317
JSON.stringify({
3318+
run: { status: "completed" },
32333319
counts: {
32343320
total: 2,
32353321
passed: 1,

0 commit comments

Comments
 (0)