refactor(live-tests): stabilize docker live suites
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
|||||||
import { isModernModelRef } from "./live-model-filter.js";
|
import { isModernModelRef } from "./live-model-filter.js";
|
||||||
import { getApiKeyForModel } from "./model-auth.js";
|
import { getApiKeyForModel } from "./model-auth.js";
|
||||||
import { ensureClawdbotModelsJson } from "./models-config.js";
|
import { ensureClawdbotModelsJson } from "./models-config.js";
|
||||||
|
import { isRateLimitErrorMessage } from "./pi-embedded-helpers/errors.js";
|
||||||
|
|
||||||
const LIVE = process.env.LIVE === "1" || process.env.CLAWDBOT_LIVE_TEST === "1";
|
const LIVE = process.env.LIVE === "1" || process.env.CLAWDBOT_LIVE_TEST === "1";
|
||||||
const DIRECT_ENABLED = Boolean(process.env.CLAWDBOT_LIVE_MODELS?.trim());
|
const DIRECT_ENABLED = Boolean(process.env.CLAWDBOT_LIVE_MODELS?.trim());
|
||||||
@@ -440,6 +441,15 @@ describeLive("live models (profile keys)", () => {
|
|||||||
logProgress(`${progressLabel}: skip (minimax empty response)`);
|
logProgress(`${progressLabel}: skip (minimax empty response)`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
allowNotFoundSkip &&
|
||||||
|
model.provider === "opencode" &&
|
||||||
|
isRateLimitErrorMessage(message)
|
||||||
|
) {
|
||||||
|
skipped.push({ model: id, reason: message });
|
||||||
|
logProgress(`${progressLabel}: skip (rate limit)`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
logProgress(`${progressLabel}: failed`);
|
logProgress(`${progressLabel}: failed`);
|
||||||
failures.push({ model: id, error: message });
|
failures.push({ model: id, error: message });
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
} from "@mariozechner/pi-coding-agent";
|
} from "@mariozechner/pi-coding-agent";
|
||||||
import { describe, it } from "vitest";
|
import { describe, it } from "vitest";
|
||||||
import { resolveClawdbotAgentDir } from "../agents/agent-paths.js";
|
import { resolveClawdbotAgentDir } from "../agents/agent-paths.js";
|
||||||
|
import { resolveAgentWorkspaceDir } from "../agents/agent-scope.js";
|
||||||
import {
|
import {
|
||||||
type AuthProfileStore,
|
type AuthProfileStore,
|
||||||
ensureAuthProfileStore,
|
ensureAuthProfileStore,
|
||||||
@@ -30,7 +31,6 @@ import {
|
|||||||
GATEWAY_CLIENT_MODES,
|
GATEWAY_CLIENT_MODES,
|
||||||
GATEWAY_CLIENT_NAMES,
|
GATEWAY_CLIENT_NAMES,
|
||||||
} from "../utils/message-channel.js";
|
} from "../utils/message-channel.js";
|
||||||
import { resolveUserPath } from "../utils.js";
|
|
||||||
import { GatewayClient } from "./client.js";
|
import { GatewayClient } from "./client.js";
|
||||||
import { renderCatNoncePngBase64 } from "./live-image-probe.js";
|
import { renderCatNoncePngBase64 } from "./live-image-probe.js";
|
||||||
import { startGatewayServer } from "./server.js";
|
import { startGatewayServer } from "./server.js";
|
||||||
@@ -377,6 +377,7 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) {
|
|||||||
|
|
||||||
const token = `test-${randomUUID()}`;
|
const token = `test-${randomUUID()}`;
|
||||||
process.env.CLAWDBOT_GATEWAY_TOKEN = token;
|
process.env.CLAWDBOT_GATEWAY_TOKEN = token;
|
||||||
|
const agentId = "dev";
|
||||||
|
|
||||||
const hostAgentDir = resolveClawdbotAgentDir();
|
const hostAgentDir = resolveClawdbotAgentDir();
|
||||||
const hostStore = ensureAuthProfileStore(hostAgentDir, {
|
const hostStore = ensureAuthProfileStore(hostAgentDir, {
|
||||||
@@ -400,9 +401,7 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) {
|
|||||||
process.env.CLAWDBOT_AGENT_DIR = tempAgentDir;
|
process.env.CLAWDBOT_AGENT_DIR = tempAgentDir;
|
||||||
process.env.PI_CODING_AGENT_DIR = tempAgentDir;
|
process.env.PI_CODING_AGENT_DIR = tempAgentDir;
|
||||||
|
|
||||||
const workspaceDir = resolveUserPath(
|
const workspaceDir = resolveAgentWorkspaceDir(params.cfg, agentId);
|
||||||
params.cfg.agents?.defaults?.workspace ?? path.join(os.homedir(), "clawd"),
|
|
||||||
);
|
|
||||||
await fs.mkdir(workspaceDir, { recursive: true });
|
await fs.mkdir(workspaceDir, { recursive: true });
|
||||||
const nonceA = randomUUID();
|
const nonceA = randomUUID();
|
||||||
const nonceB = randomUUID();
|
const nonceB = randomUUID();
|
||||||
@@ -452,7 +451,7 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) {
|
|||||||
`[${params.label}] anthropic keys loaded: ${anthropicKeys.length}`,
|
`[${params.label}] anthropic keys loaded: ${anthropicKeys.length}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const sessionKey = `agent:dev:${params.label}`;
|
const sessionKey = `agent:${agentId}:${params.label}`;
|
||||||
const failures: Array<{ model: string; error: string }> = [];
|
const failures: Array<{ model: string; error: string }> = [];
|
||||||
let skippedCount = 0;
|
let skippedCount = 0;
|
||||||
const total = params.candidates.length;
|
const total = params.candidates.length;
|
||||||
@@ -996,9 +995,8 @@ describeLive("gateway live (dev agent, profile keys)", () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const workspaceDir = resolveUserPath(
|
const agentId = "dev";
|
||||||
cfg.agents?.defaults?.workspace ?? path.join(os.homedir(), "clawd"),
|
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
||||||
);
|
|
||||||
await fs.mkdir(workspaceDir, { recursive: true });
|
await fs.mkdir(workspaceDir, { recursive: true });
|
||||||
const nonceA = randomUUID();
|
const nonceA = randomUUID();
|
||||||
const nonceB = randomUUID();
|
const nonceB = randomUUID();
|
||||||
@@ -1021,7 +1019,7 @@ describeLive("gateway live (dev agent, profile keys)", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const sessionKey = "agent:dev:live-zai-fallback";
|
const sessionKey = `agent:${agentId}:live-zai-fallback`;
|
||||||
|
|
||||||
await client.request<Record<string, unknown>>("sessions.patch", {
|
await client.request<Record<string, unknown>>("sessions.patch", {
|
||||||
key: sessionKey,
|
key: sessionKey,
|
||||||
|
|||||||
Reference in New Issue
Block a user