Question: are Codex usage fetches from /api/v1/me/status and the quota-cache background refresh paced by the #6009 throttle?
#15081
Replies: 1 comment
|
@MoralStrike Your reading is correct, on both paths. I checked each one against the current What is paced, and what isn't. Path 1: Path 2: the quota-cache background refresh. Real, and milder. Is it intentional? I found no comment or issue saying it was a decision. I read it as a gap: #6009 paced the dedicated fetchers, and these two callers were never routed through them. Nobody is recorded as having judged the 5-minute refresh low-risk. Question 3: gate inside Your report also gives a concrete way to check the fix: after it, a Tracked in #15172, credited to you. Thanks for checking the code before asking. |
Uh oh!
There was an error while loading. Please reload this page.
Hi! I'm working on a few large projects, so I currently run couple paid Codex accounts behind one OmniRoute instance. After reading #6009 and #12209, I've been trying to make sure my setup is respectful and doesn't spam bursts of
/wham/usagerequests from one IP. While reading the code, I found two paths where I couldn't find any pacing. There may well be a mechanism I'm not seeing, so I wanted to ask rather than assume.This comes from reading
mainat a58000c, not from watching live traffic, so please correct me if I've misread something.What I understand so far
throttleQuotaFetch()is called from the dedicated fetchers, e.g.codexQuotaFetcher.ts#L240, and from Auto-Ping since fix(providers): gate the Codex auto-ping usage read on the shared quota throttle #12209.providerLimits.ts#L645).getCodexUsage()callsfetch()directly (usage/codex.ts#L49), andgetUsageForProvider()dispatches to it without the throttle (usage.ts#L157). So I believe it's paced only when its caller paces it.Path 1:
/api/v1/me/statuswith the Shared Account Quota scoperesolveAccountQuotas()runsPromise.all(connections.map(resolveConnectionAccountQuota))(apiKeySelfService.ts#L353-L360). Each of those callsfetchAndPersistProviderLimits(id, "manual")(L318). If the key isn't restricted to specific connections, it looks like a single/me/statusrequest starts a live usage fetch for every active account at the same time.Path 2: quota-cache background refresh
backgroundRefreshTick()runs every 60 s and refreshes entries older than 5 min in batches of 5 withPromise.allSettled(quotaCache.ts#L879-L897).refreshEntry()callsgetUsageForProvider(connection)(L851). After a bulk sync, the entries'fetchedAtvalues are about 1.5 s apart. If I'm reading this right, they all go stale in the same tick and are then refreshed up to 5 at a time.Questions
getCodexUsage()?getCodexUsage()so every caller is covered? Or would that double-gate callers that already throttle, like Auto-Ping after fix(providers): gate the Codex auto-ping usage read on the shared quota throttle #12209?Thanks for all the work!
All reactions