From 40fb59e5f71f6ed9517738d54d6eda21302f391e Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 14 Jan 2026 09:52:39 +0000 Subject: [PATCH] refactor(live-tests): stabilize docker live suites --- src/agents/models.profiles.live.test.ts | 10 ++++++++++ src/gateway/gateway-models.profiles.live.test.ts | 16 +++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/agents/models.profiles.live.test.ts b/src/agents/models.profiles.live.test.ts index 81d2d8d50..92d107fe4 100644 --- a/src/agents/models.profiles.live.test.ts +++ b/src/agents/models.profiles.live.test.ts @@ -15,6 +15,7 @@ import { import { isModernModelRef } from "./live-model-filter.js"; import { getApiKeyForModel } from "./model-auth.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 DIRECT_ENABLED = Boolean(process.env.CLAWDBOT_LIVE_MODELS?.trim()); @@ -440,6 +441,15 @@ describeLive("live models (profile keys)", () => { logProgress(`${progressLabel}: skip (minimax empty response)`); break; } + if ( + allowNotFoundSkip && + model.provider === "opencode" && + isRateLimitErrorMessage(message) + ) { + skipped.push({ model: id, reason: message }); + logProgress(`${progressLabel}: skip (rate limit)`); + break; + } logProgress(`${progressLabel}: failed`); failures.push({ model: id, error: message }); break; diff --git a/src/gateway/gateway-models.profiles.live.test.ts b/src/gateway/gateway-models.profiles.live.test.ts index 3ccaeb427..c739d77a6 100644 --- a/src/gateway/gateway-models.profiles.live.test.ts +++ b/src/gateway/gateway-models.profiles.live.test.ts @@ -11,6 +11,7 @@ import { } from "@mariozechner/pi-coding-agent"; import { describe, it } from "vitest"; import { resolveClawdbotAgentDir } from "../agents/agent-paths.js"; +import { resolveAgentWorkspaceDir } from "../agents/agent-scope.js"; import { type AuthProfileStore, ensureAuthProfileStore, @@ -30,7 +31,6 @@ import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES, } from "../utils/message-channel.js"; -import { resolveUserPath } from "../utils.js"; import { GatewayClient } from "./client.js"; import { renderCatNoncePngBase64 } from "./live-image-probe.js"; import { startGatewayServer } from "./server.js"; @@ -377,6 +377,7 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) { const token = `test-${randomUUID()}`; process.env.CLAWDBOT_GATEWAY_TOKEN = token; + const agentId = "dev"; const hostAgentDir = resolveClawdbotAgentDir(); const hostStore = ensureAuthProfileStore(hostAgentDir, { @@ -400,9 +401,7 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) { process.env.CLAWDBOT_AGENT_DIR = tempAgentDir; process.env.PI_CODING_AGENT_DIR = tempAgentDir; - const workspaceDir = resolveUserPath( - params.cfg.agents?.defaults?.workspace ?? path.join(os.homedir(), "clawd"), - ); + const workspaceDir = resolveAgentWorkspaceDir(params.cfg, agentId); await fs.mkdir(workspaceDir, { recursive: true }); const nonceA = randomUUID(); const nonceB = randomUUID(); @@ -452,7 +451,7 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) { `[${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 }> = []; let skippedCount = 0; const total = params.candidates.length; @@ -996,9 +995,8 @@ describeLive("gateway live (dev agent, profile keys)", () => { return; } - const workspaceDir = resolveUserPath( - cfg.agents?.defaults?.workspace ?? path.join(os.homedir(), "clawd"), - ); + const agentId = "dev"; + const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId); await fs.mkdir(workspaceDir, { recursive: true }); const nonceA = randomUUID(); const nonceB = randomUUID(); @@ -1021,7 +1019,7 @@ describeLive("gateway live (dev agent, profile keys)", () => { }); try { - const sessionKey = "agent:dev:live-zai-fallback"; + const sessionKey = `agent:${agentId}:live-zai-fallback`; await client.request>("sessions.patch", { key: sessionKey,