test: repair live release backports

This commit is contained in:
Peter Steinberger
2026-04-24 06:12:52 +01:00
parent bc9a53e533
commit c6eef47924
2 changed files with 48 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ import { Type } from "typebox";
import { describe, expect, it } from "vitest";
import { loadConfig } from "../config/config.js";
import { parseLiveCsvFilter } from "../media-generation/live-test-helpers.js";
import { runTasksWithConcurrency } from "../utils/run-with-concurrency.js";
import { resolveOpenClawAgentDir } from "./agent-paths.js";
import {
collectAnthropicApiKeys,
@@ -710,11 +711,11 @@ describeLive("live models (profile keys)", () => {
}
logProgress(`[live-models] running ${selectedCandidates.length} models`);
logProgress(
`[live-models] heartbeat=${formatElapsedSeconds(LIVE_HEARTBEAT_MS)} timeout=${formatElapsedSeconds(perModelTimeoutMs)}`,
`[live-models] heartbeat=${formatElapsedSeconds(LIVE_HEARTBEAT_MS)} timeout=${formatElapsedSeconds(perModelTimeoutMs)} concurrency=${LIVE_MODEL_CONCURRENCY}`,
);
const total = selectedCandidates.length;
for (const [index, entry] of selectedCandidates.entries()) {
const tasks = selectedCandidates.map((entry, index) => async () => {
const { model, apiKeyInfo } = entry;
const id = `${model.provider}/${model.id}`;
const progressLabel = `[live-models] ${index + 1}/${total} ${id}`;
@@ -1074,7 +1075,12 @@ describeLive("live models (profile keys)", () => {
break;
}
}
}
});
await runTasksWithConcurrency({
tasks,
limit: LIVE_MODEL_CONCURRENCY,
});
if (failures.length > 0) {
const preview = formatFailurePreview(failures, 20);
@@ -1085,6 +1091,6 @@ describeLive("live models (profile keys)", () => {
void skipped;
},
15 * 60 * 1000,
LIVE_TEST_TIMEOUT_MS,
);
});

View File

@@ -363,6 +363,44 @@ function findGuardianReviewStatus(events: CapturedAgentEvent[]): "approved" | "d
return status === "approved" || status === "denied" ? status : undefined;
}
function assertGuardianReviewStatus(params: {
events: CapturedAgentEvent[];
expectedStatus: "approved" | "denied";
label: string;
}): void {
const completedEvents = params.events.filter(
(event) => event.data?.phase === "completed" && event.data?.status,
);
if (completedEvents.length === 0 && !CODEX_HARNESS_REQUIRE_GUARDIAN_EVENTS) {
return;
}
expect(
completedEvents.some((event) => event.data?.status === params.expectedStatus),
`${params.label} expected Guardian status ${params.expectedStatus}; events=${JSON.stringify(
params.events,
)}`,
).toBe(true);
}
function assertGuardianReviewCompleted(params: {
events: CapturedAgentEvent[];
label: string;
}): CapturedAgentEvent | undefined {
const completedEvents = params.events.filter(
(event) => event.data?.phase === "completed" && event.data?.status,
);
if (completedEvents.length === 0 && !CODEX_HARNESS_REQUIRE_GUARDIAN_EVENTS) {
return undefined;
}
expect(
completedEvents.length,
`${params.label} expected a completed Guardian review event; events=${JSON.stringify(
params.events,
)}`,
).toBeGreaterThan(0);
return completedEvents.at(-1);
}
async function verifyCodexGuardianProbe(params: {
client: GatewayClient;
sessionKey: string;