mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 19:02:17 +03:00
Every Codex quota read goes through throttleQuotaFetch() — the #6009/#6058 gate that spaces genuine upstream calls so many accounts behind one IP do not fire in the same second, which is the pattern documented to have got a Codex OAuth token revoked. The auto-ping scheduler called getCodexUsage() directly, so the one Codex path that runs unattended every 60s per connection was the one skipping the mitigation written for Codex. The tick walks connections sequentially but without spacing, so N enabled connections still produce N upstream usage requests within a few hundred ms. Gate the read on the same throttle, injected through deps like every other effect in this module. Placed after the skip checks so a connection filtered out by the circuit breaker, a cooldown or the failure cache does not consume a slot and delay the connections that do reach the network. This does not change the polling cadence. Codex sets pingWhenResetAtSlides because its resetAt slides forward while the window is idle, so the per-tick re-fetch is deliberate and is left alone. Closes #11904