Skip to content

fix(providers): pace Codex usage fetches that bypass the quota gate - #15408

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.52from
HouMinXi:fix/codex-usage-status
Oct 6, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.52from
HouMinXi:fix/codex-usage-status

Conversation

@HouMinXi

@HouMinXi HouMinXi commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The status fan-out and the quota-cache refresh both read Codex usage without taking the min-interval gate that the dedicated quota fetchers use, so those paths could burst the usage endpoint.
  • The Codex branch of the usage dispatcher now waits on that shared gate. A caller that already holds the gate waits at most one more interval.

Related Issues

Validation

  • Change type: other (Codex usage pacing)
  • Focused tests: node --import tsx/esm --test tests/unit/codex-usage-status-throttle-15172.test.ts (2 pass)
  • eslint on the changed files, with the repo suppression file
  • Reconciled with release/v3.8.52 @ 23a1148486
  • New test covers the change

Tests Added Or Updated

  • tests/unit/codex-usage-status-throttle-15172.test.ts (added)

Coverage Notes

  • One case fires four concurrent Codex usage reads on a real clock and asserts each adjacent pair starts at least one interval apart. A second case runs the auto-ping path and asserts its own gate adds at most one extra interval.

Reviewer Notes

  • The interval assertion uses a real clock. A fake clock whose sleep advances time synchronously reports the wrong instant for any read that happens after the await, so an assertion on absolute timestamps from that clock is not evidence about the gate.

The status fan-out and the quota-cache refresh both read Codex usage
without taking the min-interval gate the dedicated quota fetchers use, so
they could burst the usage endpoint. The Codex branch of the usage
dispatcher now waits on that gate. A caller that already holds it waits at
most one more interval.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
@HouMinXi
HouMinXi requested a review from diegosouzapw as a code owner October 3, 2026 03:39
@diegosouzapw
diegosouzapw merged commit 73582bd into diegosouzapw:release/v3.8.52 Oct 6, 2026
44 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(resilience): Codex usage fetches from /api/v1/me/status and the quota-cache background refresh bypass the quota-fetch throttle

2 participants