Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
355
test/image-generation.runtime.live.test.ts
Normal file
355
test/image-generation.runtime.live.test.ts
Normal file
@@ -0,0 +1,355 @@
|
||||
// Live image generation runtime tests cover image provider runtime behavior.
|
||||
import {
|
||||
registerProviderPlugin,
|
||||
requireRegisteredProvider,
|
||||
} from "openclaw/plugin-sdk/plugin-test-runtime";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveDefaultAgentDir } from "../src/agents/agent-scope.js";
|
||||
import { isBillingErrorMessage } from "../src/agents/embedded-agent-helpers/failover-matches.js";
|
||||
import { collectProviderApiKeys } from "../src/agents/live-auth-keys.js";
|
||||
import { isLiveProfileKeyModeEnabled, isLiveTestEnabled } from "../src/agents/live-test-helpers.js";
|
||||
import { resolveApiKeyForProvider } from "../src/agents/model-auth.js";
|
||||
import { loadConfig, type OpenClawConfig } from "../src/config/config.js";
|
||||
import {
|
||||
DEFAULT_LIVE_IMAGE_MODELS,
|
||||
parseCaseFilter,
|
||||
parseCsvFilter,
|
||||
parseProviderModelMap,
|
||||
redactLiveApiKey,
|
||||
resolveConfiguredLiveImageModels,
|
||||
resolveLiveImageAuthStore,
|
||||
} from "../src/image-generation/live-test-helpers.js";
|
||||
import { isTruthyEnvValue } from "../src/infra/env.js";
|
||||
import { getShellEnvAppliedKeys } from "../src/infra/shell-env.js";
|
||||
import { encodePngRgba, fillPixel } from "../src/media/png-encode.js";
|
||||
import { maybeLoadShellEnvForGenerationProviders } from "../src/test-utils/generation-live-test-helpers.js";
|
||||
import { loadBundledProviderPlugin as loadBundledProviderPluginFromTestHelper } from "./helpers/media-generation/bundled-provider-builders.js";
|
||||
|
||||
const LIVE = isLiveTestEnabled();
|
||||
const REQUIRE_PROFILE_KEYS =
|
||||
isLiveProfileKeyModeEnabled() || isTruthyEnvValue(process.env.OPENCLAW_LIVE_REQUIRE_PROFILE_KEYS);
|
||||
const describeLive = LIVE ? describe : describe.skip;
|
||||
const providerFilter = parseCsvFilter(process.env.OPENCLAW_LIVE_IMAGE_GENERATION_PROVIDERS);
|
||||
const caseFilter = parseCaseFilter(process.env.OPENCLAW_LIVE_IMAGE_GENERATION_CASES);
|
||||
const envModelMap = parseProviderModelMap(process.env.OPENCLAW_LIVE_IMAGE_GENERATION_MODELS);
|
||||
const DEFAULT_LIVE_IMAGE_GENERATION_TIMEOUT_MS = 120_000;
|
||||
const LIVE_IMAGE_GENERATION_TIMEOUT_MS = resolvePositiveIntegerEnv(
|
||||
process.env.OPENCLAW_LIVE_IMAGE_GENERATION_TIMEOUT_MS,
|
||||
DEFAULT_LIVE_IMAGE_GENERATION_TIMEOUT_MS,
|
||||
);
|
||||
|
||||
type LiveProviderCase = {
|
||||
pluginId: string;
|
||||
pluginName: string;
|
||||
providerId: string;
|
||||
defaultEditEnabled?: boolean;
|
||||
};
|
||||
|
||||
type LiveImageCase = {
|
||||
id: string;
|
||||
providerId: string;
|
||||
modelRef: string;
|
||||
prompt: string;
|
||||
size?: string;
|
||||
resolution?: "1K" | "2K" | "4K";
|
||||
inputImages?: Array<{ buffer: Buffer; mimeType: string; fileName?: string }>;
|
||||
};
|
||||
|
||||
function resolvePositiveIntegerEnv(raw: string | undefined, fallback: number): number {
|
||||
if (!raw) {
|
||||
return fallback;
|
||||
}
|
||||
const parsed = Number(raw);
|
||||
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : fallback;
|
||||
}
|
||||
|
||||
function loadBundledProviderPlugin(
|
||||
pluginId: string,
|
||||
): ReturnType<typeof loadBundledProviderPluginFromTestHelper> {
|
||||
return loadBundledProviderPluginFromTestHelper(pluginId);
|
||||
}
|
||||
|
||||
const PROVIDER_CASES: LiveProviderCase[] = [
|
||||
{
|
||||
pluginId: "deepinfra",
|
||||
pluginName: "DeepInfra Provider",
|
||||
providerId: "deepinfra",
|
||||
},
|
||||
{
|
||||
pluginId: "fal",
|
||||
pluginName: "fal Provider",
|
||||
providerId: "fal",
|
||||
},
|
||||
{
|
||||
pluginId: "google",
|
||||
pluginName: "Google Provider",
|
||||
providerId: "google",
|
||||
},
|
||||
{
|
||||
pluginId: "minimax",
|
||||
pluginName: "MiniMax Provider",
|
||||
providerId: "minimax",
|
||||
},
|
||||
{
|
||||
pluginId: "microsoft-foundry",
|
||||
pluginName: "Microsoft Foundry Provider",
|
||||
providerId: "microsoft-foundry",
|
||||
defaultEditEnabled: false,
|
||||
},
|
||||
{
|
||||
pluginId: "openai",
|
||||
pluginName: "OpenAI Provider",
|
||||
providerId: "openai",
|
||||
},
|
||||
{
|
||||
pluginId: "openrouter",
|
||||
pluginName: "OpenRouter Provider",
|
||||
providerId: "openrouter",
|
||||
},
|
||||
{
|
||||
pluginId: "vydra",
|
||||
pluginName: "Vydra Provider",
|
||||
providerId: "vydra",
|
||||
},
|
||||
{
|
||||
pluginId: "xai",
|
||||
pluginName: "xAI Provider",
|
||||
providerId: "xai",
|
||||
},
|
||||
]
|
||||
.filter((entry) => (providerFilter ? providerFilter.has(entry.providerId) : true))
|
||||
.toSorted((left, right) => left.providerId.localeCompare(right.providerId));
|
||||
|
||||
function createEditReferencePng(): Buffer {
|
||||
const width = 192;
|
||||
const height = 192;
|
||||
const buf = Buffer.alloc(width * height * 4, 255);
|
||||
|
||||
for (let y = 0; y < height; y += 1) {
|
||||
for (let x = 0; x < width; x += 1) {
|
||||
fillPixel(buf, x, y, width, 245, 248, 255, 255);
|
||||
}
|
||||
}
|
||||
|
||||
for (let y = 24; y < 168; y += 1) {
|
||||
for (let x = 24; x < 168; x += 1) {
|
||||
fillPixel(buf, x, y, width, 255, 189, 89, 255);
|
||||
}
|
||||
}
|
||||
|
||||
for (let y = 48; y < 144; y += 1) {
|
||||
for (let x = 48; x < 144; x += 1) {
|
||||
fillPixel(buf, x, y, width, 41, 47, 54, 255);
|
||||
}
|
||||
}
|
||||
|
||||
return encodePngRgba(buf, width, height);
|
||||
}
|
||||
|
||||
function withPluginsEnabled(cfg: OpenClawConfig): OpenClawConfig {
|
||||
return {
|
||||
...cfg,
|
||||
plugins: {
|
||||
...cfg.plugins,
|
||||
enabled: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function resolveProviderModelForLiveTest(providerId: string, modelRef: string): string {
|
||||
const slash = modelRef.indexOf("/");
|
||||
if (slash <= 0 || slash === modelRef.length - 1) {
|
||||
return modelRef;
|
||||
}
|
||||
return modelRef.slice(0, slash) === providerId ? modelRef.slice(slash + 1) : modelRef;
|
||||
}
|
||||
|
||||
function formatProviderFilter(filter: Set<string> | null): string {
|
||||
return filter ? [...filter].toSorted((a, b) => a.localeCompare(b)).join(", ") : "";
|
||||
}
|
||||
|
||||
function expectImageLiveSweepPassed(params: {
|
||||
attempted: string[];
|
||||
failures: string[];
|
||||
providerFilter: Set<string> | null;
|
||||
skipped: string[];
|
||||
}): void {
|
||||
if (params.attempted.length === 0) {
|
||||
expect(params.failures).toStrictEqual([]);
|
||||
if (params.providerFilter && params.providerFilter.size > 0) {
|
||||
throw new Error(
|
||||
`[live:image-generation] requested provider filter produced no live attempts: ${formatProviderFilter(params.providerFilter)}; skipped=${params.skipped.join(", ") || "none"}`,
|
||||
);
|
||||
}
|
||||
console.warn("[live:image-generation] no provider had usable auth; skipping assertions");
|
||||
return;
|
||||
}
|
||||
expect(params.failures).toStrictEqual([]);
|
||||
}
|
||||
|
||||
function buildLiveCases(params: {
|
||||
providerId: string;
|
||||
modelRef: string;
|
||||
editEnabled: boolean;
|
||||
}): LiveImageCase[] {
|
||||
const generatePrompt =
|
||||
"Create a minimal flat illustration of an orange cat face sticker on a white background.";
|
||||
const editPrompt =
|
||||
"Change ONLY the background to a pale blue gradient. Keep the subject, framing, and style identical.";
|
||||
const cases: LiveImageCase[] = [
|
||||
{
|
||||
id: `${params.providerId}:generate`,
|
||||
providerId: params.providerId,
|
||||
modelRef: params.modelRef,
|
||||
prompt: generatePrompt,
|
||||
size: "1024x1024",
|
||||
},
|
||||
];
|
||||
if (params.editEnabled) {
|
||||
const providerModel = resolveProviderModelForLiveTest(params.providerId, params.modelRef);
|
||||
const useReferenceResolution = !(
|
||||
params.providerId === "fal" && providerModel.startsWith("krea/v2/")
|
||||
);
|
||||
cases.push({
|
||||
id: `${params.providerId}:edit`,
|
||||
providerId: params.providerId,
|
||||
modelRef: params.modelRef,
|
||||
prompt: editPrompt,
|
||||
...(useReferenceResolution ? { resolution: "1K" as const } : {}),
|
||||
inputImages: [
|
||||
{
|
||||
buffer: createEditReferencePng(),
|
||||
mimeType: "image/png",
|
||||
fileName: "reference.png",
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
return cases;
|
||||
}
|
||||
|
||||
describeLive("image generation live (provider sweep)", () => {
|
||||
it(
|
||||
"generates images for every configured image-generation variant with available auth",
|
||||
async () => {
|
||||
const cfg = withPluginsEnabled(loadConfig());
|
||||
const configuredModels = resolveConfiguredLiveImageModels(cfg);
|
||||
const agentDir = resolveDefaultAgentDir(cfg);
|
||||
const attempted: string[] = [];
|
||||
const skipped: string[] = [];
|
||||
const failures: string[] = [];
|
||||
|
||||
maybeLoadShellEnvForGenerationProviders(PROVIDER_CASES.map((entry) => entry.providerId));
|
||||
|
||||
for (const providerCase of PROVIDER_CASES) {
|
||||
const modelRef =
|
||||
envModelMap.get(providerCase.providerId) ??
|
||||
configuredModels.get(providerCase.providerId) ??
|
||||
DEFAULT_LIVE_IMAGE_MODELS[providerCase.providerId];
|
||||
if (!modelRef) {
|
||||
skipped.push(`${providerCase.providerId}: no model configured`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const hasLiveKeys = collectProviderApiKeys(providerCase.providerId).length > 0;
|
||||
const authStore = resolveLiveImageAuthStore({
|
||||
requireProfileKeys: REQUIRE_PROFILE_KEYS,
|
||||
hasLiveKeys,
|
||||
});
|
||||
let authLabel;
|
||||
try {
|
||||
const auth = await resolveApiKeyForProvider({
|
||||
provider: providerCase.providerId,
|
||||
cfg,
|
||||
agentDir,
|
||||
store: authStore,
|
||||
});
|
||||
authLabel = `${auth.source} ${redactLiveApiKey(auth.apiKey)}`;
|
||||
} catch {
|
||||
skipped.push(`${providerCase.providerId}: no usable auth`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const { imageProviders } = await registerProviderPlugin({
|
||||
plugin: loadBundledProviderPlugin(providerCase.pluginId),
|
||||
id: providerCase.pluginId,
|
||||
name: providerCase.pluginName,
|
||||
});
|
||||
const provider = requireRegisteredProvider(
|
||||
imageProviders,
|
||||
providerCase.providerId,
|
||||
"image provider",
|
||||
);
|
||||
const providerModel = resolveProviderModelForLiveTest(providerCase.providerId, modelRef);
|
||||
const liveCases = buildLiveCases({
|
||||
providerId: providerCase.providerId,
|
||||
modelRef,
|
||||
editEnabled:
|
||||
providerCase.defaultEditEnabled ?? provider.capabilities.edit?.enabled ?? false,
|
||||
}).filter((entry) => (caseFilter ? caseFilter.has(entry.id.toLowerCase()) : true));
|
||||
|
||||
for (const testCase of liveCases) {
|
||||
const startedAt = Date.now();
|
||||
console.error(
|
||||
`[live:image-generation] starting ${testCase.id} model=${providerModel} auth=${authLabel}`,
|
||||
);
|
||||
try {
|
||||
const result = await provider.generateImage({
|
||||
provider: providerCase.providerId,
|
||||
model: providerModel,
|
||||
prompt: testCase.prompt,
|
||||
cfg,
|
||||
agentDir,
|
||||
authStore,
|
||||
size: testCase.size,
|
||||
resolution: testCase.resolution,
|
||||
inputImages: testCase.inputImages,
|
||||
timeoutMs: LIVE_IMAGE_GENERATION_TIMEOUT_MS,
|
||||
});
|
||||
|
||||
expect(result.images.length).toBeGreaterThan(0);
|
||||
expect(result.images[0]?.mimeType.startsWith("image/")).toBe(true);
|
||||
expect(result.images[0]?.buffer.byteLength).toBeGreaterThan(512);
|
||||
attempted.push(`${testCase.id}:${result.model} (${authLabel})`);
|
||||
console.error(
|
||||
`[live:image-generation] done ${testCase.id} ms=${Date.now() - startedAt} images=${result.images.length}`,
|
||||
);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
if (isBillingErrorMessage(message)) {
|
||||
skipped.push(`${testCase.id} (${authLabel}): billing drift`);
|
||||
console.warn(
|
||||
`[live:image-generation] skip ${testCase.id} ms=${Date.now() - startedAt} reason=billing drift error=${message}`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
failures.push(`${testCase.id} (${authLabel}): ${message}`);
|
||||
console.error(
|
||||
`[live:image-generation] failed ${testCase.id} ms=${Date.now() - startedAt} error=${message}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(
|
||||
`[live:image-generation] attempted=${attempted.join(", ") || "none"} skipped=${skipped.join(", ") || "none"} failures=${failures.join(" | ") || "none"} shellEnv=${getShellEnvAppliedKeys().join(", ") || "none"}`,
|
||||
);
|
||||
|
||||
expectImageLiveSweepPassed({ attempted, failures, providerFilter, skipped });
|
||||
},
|
||||
15 * 60_000,
|
||||
);
|
||||
});
|
||||
|
||||
describe("image generation live provider filter coverage", () => {
|
||||
it("fails filtered sweeps when no requested provider is attempted", () => {
|
||||
expect(() =>
|
||||
expectImageLiveSweepPassed({
|
||||
attempted: [],
|
||||
failures: [],
|
||||
providerFilter: new Set(["openai"]),
|
||||
skipped: ["openai: no usable auth"],
|
||||
}),
|
||||
).toThrow(/requested provider filter produced no live attempts: openai/u);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user