From c6eef4792433c969cd70109883d0fa07bb0911a4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 24 Apr 2026 06:12:52 +0100 Subject: [PATCH] test: repair live release backports --- src/agents/models.profiles.live.test.ts | 14 +++++-- .../gateway-codex-harness.live.test.ts | 38 +++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/agents/models.profiles.live.test.ts b/src/agents/models.profiles.live.test.ts index 46ce99f4fd1..da5349210f5 100644 --- a/src/agents/models.profiles.live.test.ts +++ b/src/agents/models.profiles.live.test.ts @@ -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, ); }); diff --git a/src/gateway/gateway-codex-harness.live.test.ts b/src/gateway/gateway-codex-harness.live.test.ts index 5936a0920e5..648927a4168 100644 --- a/src/gateway/gateway-codex-harness.live.test.ts +++ b/src/gateway/gateway-codex-harness.live.test.ts @@ -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;