diff --git a/src/agents/models.profiles.live.test.ts b/src/agents/models.profiles.live.test.ts index 7def3441a..c257c24f1 100644 --- a/src/agents/models.profiles.live.test.ts +++ b/src/agents/models.profiles.live.test.ts @@ -496,7 +496,10 @@ describeLive("live models (profile keys)", () => { throw new Error(msg || "model returned error with no message"); } - if (ok.text.length === 0 && model.provider === "google") { + if ( + ok.text.length === 0 && + (model.provider === "google" || model.provider === "google-gemini-cli") + ) { skipped.push({ model: id, reason: "no text returned (likely unavailable model id)", diff --git a/src/gateway/gateway-models.profiles.live.test.ts b/src/gateway/gateway-models.profiles.live.test.ts index 3b2888da4..09c4226c3 100644 --- a/src/gateway/gateway-models.profiles.live.test.ts +++ b/src/gateway/gateway-models.profiles.live.test.ts @@ -40,6 +40,11 @@ const THINKING_LEVEL = "high"; const THINKING_TAG_RE = /<\s*\/?\s*(?:think(?:ing)?|thought|antthinking)\s*>/i; const FINAL_TAG_RE = /<\s*\/?\s*final\s*>/i; const ANTHROPIC_MAGIC_STRING_TRIGGER_REFUSAL = "ANTHROPIC_MAGIC_STRING_TRIGGER_REFUSAL"; +const GATEWAY_LIVE_DEFAULT_TIMEOUT_MS = 20 * 60 * 1000; +const GATEWAY_LIVE_UNBOUNDED_TIMEOUT_MS = 60 * 60 * 1000; +const GATEWAY_LIVE_MAX_TIMEOUT_MS = 2 * 60 * 60 * 1000; +const GATEWAY_LIVE_MAX_MODELS = resolveGatewayLiveMaxModels(); +const GATEWAY_LIVE_SUITE_TIMEOUT_MS = resolveGatewayLiveSuiteTimeoutMs(GATEWAY_LIVE_MAX_MODELS); const describeLive = LIVE || GATEWAY_LIVE ? describe : describe.skip; @@ -64,6 +69,27 @@ function toInt(value: string | undefined, fallback: number): number { return Number.isFinite(parsed) ? parsed : fallback; } +function resolveGatewayLiveMaxModels(): number { + const gatewayMax = toInt(process.env.OPENCLAW_LIVE_GATEWAY_MAX_MODELS, -1); + if (gatewayMax >= 0) { + return gatewayMax; + } + // Reuse shared live-model cap when gateway-specific cap is not provided. + return Math.max(0, toInt(process.env.OPENCLAW_LIVE_MAX_MODELS, 0)); +} + +function resolveGatewayLiveSuiteTimeoutMs(maxModels: number): number { + if (maxModels <= 0) { + return GATEWAY_LIVE_UNBOUNDED_TIMEOUT_MS; + } + // Gateway live runs multiple probes per model; scale timeout by model cap. + const estimated = 5 * 60 * 1000 + maxModels * 90 * 1000; + return Math.max( + GATEWAY_LIVE_DEFAULT_TIMEOUT_MS, + Math.min(GATEWAY_LIVE_MAX_TIMEOUT_MS, estimated), + ); +} + function capByProviderSpread( items: T[], maxItems: number, @@ -1144,7 +1170,7 @@ describeLive("gateway live (dev agent, profile keys)", () => { const useModern = !rawModels || rawModels === "modern" || rawModels === "all"; const useExplicit = Boolean(rawModels) && !useModern; const filter = useExplicit ? parseFilter(rawModels) : null; - const maxModels = toInt(process.env.OPENCLAW_LIVE_GATEWAY_MAX_MODELS, 0); + const maxModels = GATEWAY_LIVE_MAX_MODELS; const wanted = filter ? all.filter((m) => filter.has(`${m.provider}/${m.id}`)) : all.filter((m) => isModernModelRef({ provider: m.provider, id: m.id })); @@ -1224,7 +1250,7 @@ describeLive("gateway live (dev agent, profile keys)", () => { logProgress("[minimax-anthropic] missing minimax provider config; skipping"); } }, - 20 * 60 * 1000, + GATEWAY_LIVE_SUITE_TIMEOUT_MS, ); it("z.ai fallback handles anthropic tool history", async () => {