From 95bf36fe2888bab05fba67dca6bb5b0684d48097 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 29 May 2026 12:09:25 +0100 Subject: [PATCH] test(release): align live provider timeouts --- .../gateway-models.profiles.live.test.ts | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/gateway/gateway-models.profiles.live.test.ts b/src/gateway/gateway-models.profiles.live.test.ts index 5093af774c0..9de2f4f81a7 100644 --- a/src/gateway/gateway-models.profiles.live.test.ts +++ b/src/gateway/gateway-models.profiles.live.test.ts @@ -276,6 +276,12 @@ function resolveGatewayLiveAgentWaitTimeoutMs( return Math.max(1_000, Math.min(modelTimeoutMs, Math.floor(agentRunTimeoutMs + waitGraceMs))); } +function resolveGatewayLiveProviderTimeoutSeconds( + modelTimeoutMs = GATEWAY_LIVE_MODEL_TIMEOUT_MS, +): number { + return Math.max(1, Math.ceil(modelTimeoutMs / 1_000)); +} + function isGatewayLiveProbeTimeout(error: string): boolean { return /probe timeout after \d+ms/i.test(error); } @@ -752,6 +758,12 @@ describe("resolveGatewayLiveAgentWaitTimeoutMs", () => { }); }); +describe("resolveGatewayLiveProviderTimeoutSeconds", () => { + it("matches provider timeout config to the harness model budget", () => { + expect(resolveGatewayLiveProviderTimeoutSeconds(180_001)).toBe(181); + }); +}); + describe("formatGatewayLiveAgentWaitFailure", () => { it("includes terminal attribution fields without requiring transcript text", () => { expect( @@ -1161,6 +1173,28 @@ describe("buildLiveGatewayConfig", () => { expect(cfg.models?.providers?.google?.models?.[0]?.contextWindow).toBe(128_000); }); + + it("keeps live provider request timeout aligned with the harness model budget", () => { + const cfg = buildLiveGatewayConfig({ + cfg: { + models: { + providers: { + google: { + api: "google-generative-ai", + baseUrl: "https://generativelanguage.googleapis.com", + models: [], + timeoutSeconds: 30, + }, + }, + }, + }, + candidates: [createGatewayLiveTestModel("google", "gemini-3.1-pro-preview")], + }); + + expect(cfg.models?.providers?.google?.timeoutSeconds).toBeGreaterThanOrEqual( + Math.ceil(GATEWAY_LIVE_MODEL_TIMEOUT_MS / 1_000), + ); + }); }); describe("enterProductionEnvForLiveRun", () => { @@ -2104,6 +2138,10 @@ function mergeLiveProviderConfig(params: { ...params.base, api: params.base?.api ?? params.discovered.api, baseUrl: params.base?.baseUrl ?? params.discovered.baseUrl, + timeoutSeconds: Math.max( + params.base?.timeoutSeconds ?? 0, + params.discovered.timeoutSeconds ?? 0, + ), models: [...mergedModels.values()], }; } @@ -2120,6 +2158,7 @@ function buildLiveProviderConfigs(candidates: Array): Record