Files
OmniRoute/src/shared/constants/quotaAutoPing.ts
Paco Cartones 393c305a71 fix(providers): resolve the Codex auto-ping model from the live catalog instead of a retired id (#12361)
The opt-in Codex quota auto-ping pinned gpt-5.1-codex-mini. OpenAI shut that model down on 2026-07-23 and the repo's own lifecycle registry already rejects it on the request path, but the scheduler never consulted that gate — every window slide sent a dead id, hit the 15-minute failure cooldown, and retried the same id forever. The ping model now resolves per tick from the provider catalog through isModelSelectable(), the same gate chatCore uses, with the registry import kept lazy because this module sits on the instrumentation boot path (#12074). When nothing is selectable the provider is paused before any throttle slot, usage read or executor call, with one warning per state change.

Validated in a combined worktree with all 25 PRs of this batch boarded together: typecheck:core clean, 443/443 node-runner tests plus 14/14 vitest across every test file the batch touches, and check-changelog-integrity, check:cycles (418 files), check:provider-consistency (272 REGISTRY entries, 355 canonical providers), check:docs-counts, check:docs-sync (42 locales) and check-file-size all green.

Thanks @pacocartones.
2026-09-02 03:12:51 -03:00

53 lines
2.2 KiB
TypeScript

/**
* quotaAutoPing.ts — config for the opt-in Codex quota auto-ping (#6977).
*
* Phase 1 (this file): Codex only — resetAt is inferred by watching the
* "session" window slide forward (Codex has no explicit reset event; an
* inactive window quietly rolls to a fresh one on the next usage read).
* Antigravity (2 buckets, no upstream reference) is a follow-up — see the
* PR body for #6977.
*/
export const QUOTA_AUTOPING_TICK_INTERVAL_MS = 60_000;
// How long a connection must stay quiet after a failed ping before we retry it.
export const QUOTA_AUTOPING_FAILURE_COOLDOWN_MS = 15 * 60 * 1000;
// Once a resetAt is observed and cached, skip re-fetching usage until we're
// within this window of it (Codex resetAt slides constantly while idle, so we
// still poll every tick, but this bounds how eagerly we ping right after a slide).
export const QUOTA_AUTOPING_REFRESH_AHEAD_MS = 5 * 60 * 1000;
export type QuotaAutoPingProviderConfig = {
settingsKey: string;
quotaKey: string;
/** Codex has no fixed reset schedule — ping whenever resetAt slides forward. */
pingWhenResetAtSlides: true;
/** Minimum forward drift (ms) before a slide counts as "the window rolled". */
resetAtDriftMs: number;
/** Never re-ping the same connection more often than this, even across resets. */
minPingIntervalMs: number;
/** Skip the ping when a non-session quota (e.g. weekly) is already exhausted. */
skipWhenBlockingQuotaExhausted: true;
// The ping model is deliberately NOT part of this config (#11905): a pinned id
// outlives its vendor lifecycle (`gpt-5.1-codex-mini` was shut down 2026-07-23
// while still hardcoded here). It is resolved per tick from the live provider
// catalog + lifecycle registry — see resolveQuotaAutoPingModel in
// src/lib/services/quotaAutoPing.ts.
pingText: string;
pingInstructions: string;
pingReasoningEffort: string;
};
export const QUOTA_AUTOPING_PROVIDERS: Record<"codex", QuotaAutoPingProviderConfig> = {
codex: {
settingsKey: "codexAutoPing",
quotaKey: "session",
pingWhenResetAtSlides: true,
resetAtDriftMs: 30_000,
minPingIntervalMs: 10 * 60 * 1000,
skipWhenBlockingQuotaExhausted: true,
pingText: "hi",
pingInstructions: "Reply with OK.",
pingReasoningEffort: "none",
},
};