mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-26 00:52:18 +03:00
Merged — locally validated (30/30 focused tests: chatcore-codex-account-pool, codex-account-cooldown-write, codex-account-pool, providers-route-codex-account-pool, resilience-explain-codex-account, sse-auth-codex-account-pool; typecheck:core clean; file-size/complexity/cognitive-complexity/changelog gates all green). Merges clean against the current release tip with zero conflicts. Great refactor — extracting persistCodexQuotaState out of chatCore.ts into a proper codexAccount/ module with virtual quota pool isolation is a solid improvement. Thanks!
30 lines
852 B
TypeScript
30 lines
852 B
TypeScript
import { persistCodexChildCooldown } from "../../services/codexAccount/index.ts";
|
|
|
|
type CodexFailoverCredentials = {
|
|
connectionId?: string | null;
|
|
providerSpecificData?: unknown;
|
|
};
|
|
|
|
export async function markCodexScopeRateLimited(params: {
|
|
failedConnectionId: string;
|
|
model: string | null;
|
|
rateLimitedUntil: string;
|
|
credentials?: CodexFailoverCredentials | null;
|
|
}): Promise<void> {
|
|
const persisted = params.model
|
|
? await persistCodexChildCooldown({
|
|
connectionId: params.failedConnectionId,
|
|
model: params.model,
|
|
rateLimitedUntil: params.rateLimitedUntil,
|
|
}).catch(() => null)
|
|
: null;
|
|
|
|
if (
|
|
persisted &&
|
|
params.credentials &&
|
|
String(params.credentials.connectionId) === params.failedConnectionId
|
|
) {
|
|
params.credentials.providerSpecificData = persisted.providerSpecificData;
|
|
}
|
|
}
|