test(live): scale gateway profile timeout

This commit is contained in:
Vincent Koc
2026-05-04 18:09:47 -07:00
parent 0747e63006
commit 16f9e83657

View File

@@ -158,8 +158,11 @@ 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;
// Gateway live runs multiple probes per model and may retry with another
// profile key before moving on, so the suite budget has to scale with the
// model timeout rather than only the first prompt.
const perModelBudgetMs = Math.max(3 * 60 * 1000, GATEWAY_LIVE_MODEL_TIMEOUT_MS * 3);
const estimated = 10 * 60 * 1000 + maxModels * perModelBudgetMs;
return Math.max(
GATEWAY_LIVE_DEFAULT_TIMEOUT_MS,
Math.min(GATEWAY_LIVE_MAX_TIMEOUT_MS, estimated),
@@ -533,6 +536,20 @@ describe("resolveGatewayLiveModelTimeoutMs", () => {
});
});
describe("resolveGatewayLiveSuiteTimeoutMs", () => {
it("leaves uncapped explicit sweeps bounded by the unbounded live timeout", () => {
expect(resolveGatewayLiveSuiteTimeoutMs(0)).toBe(GATEWAY_LIVE_UNBOUNDED_TIMEOUT_MS);
});
it("scales model-capped sweeps for multi-probe retries", () => {
expect(resolveGatewayLiveSuiteTimeoutMs(2)).toBeGreaterThan(GATEWAY_LIVE_DEFAULT_TIMEOUT_MS);
});
it("caps very large model sweeps", () => {
expect(resolveGatewayLiveSuiteTimeoutMs(999)).toBe(GATEWAY_LIVE_MAX_TIMEOUT_MS);
});
});
describe("resolveGatewayLiveMaxModels", () => {
const originalGatewayModels = process.env.OPENCLAW_LIVE_GATEWAY_MODELS;
const originalGatewayMax = process.env.OPENCLAW_LIVE_GATEWAY_MAX_MODELS;