mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-26 17:12:27 +03:00
feat(providers): restore per-connection upstream timeout tier (#10885)
Reconciliado com a release (conflito aditivo em targetTimeoutRunner.ts — combina o warning G3 já mergeado com a resolução de effectiveTimeoutMs deste PR) e revalidado: 41/41 testes focados passando (upstream-timeout-connection-tier, combo-target-timeout-runner, provider-specific-data-schema). CI vermelho é o base-red já rastreado em #9985. Obrigado!
This commit is contained in:
@@ -17,6 +17,7 @@ const CODEX_REASONING_EFFORT_VALUES = new Set(["none", "low", "medium", "high",
|
||||
const REQUEST_DEFAULT_SERVICE_TIER_VALUES = new Set(["default", "priority", "fast", "flex"]);
|
||||
const CODEX_FINGERPRINT_MODE_VALUES = new Set(["off", "device", "session", "full"]);
|
||||
const CACHE_PASSTHROUGH_VALUES = new Set(["strip", "openai-format", "claude-format"]);
|
||||
export const MAX_PROVIDER_SPECIFIC_TIMEOUT_MS = 86_400_000; // 24h — operator cap, anti-DoS
|
||||
|
||||
// #6880 — per-connection prompt-cache capability override, extracted so
|
||||
// validateProviderSpecificData() stays under the complexity gate.
|
||||
@@ -496,4 +497,23 @@ export function validateProviderSpecificData(
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Per-connection operator timeout tier: a slow model must not monopolize an
|
||||
// executor slot indefinitely. Bounded to 24h (anti-DoS); below 1ms is
|
||||
// meaningless.
|
||||
const timeoutMs = data.timeoutMs;
|
||||
if (timeoutMs !== undefined && timeoutMs !== null) {
|
||||
if (
|
||||
typeof timeoutMs !== "number" ||
|
||||
!Number.isInteger(timeoutMs) ||
|
||||
timeoutMs < 1 ||
|
||||
timeoutMs > MAX_PROVIDER_SPECIFIC_TIMEOUT_MS
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: `providerSpecificData.timeoutMs must be an integer between 1 and ${MAX_PROVIDER_SPECIFIC_TIMEOUT_MS}`,
|
||||
path: ["timeoutMs"],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user