[Bug] Anthropic pool: one 429 leaves the active account rate limited with a fake weekly 100%, and background refresh skips it (2.100.7)

Đang mở
#9,032 2 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@samirmedani đang làm issue này rồi.

Từ ngày 21/11/2026.

  • #9034 của @samirmedani — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
32/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
nodejs, typescript
Lĩnh vực
authentication, backend

Hướng nghiên cứu

The bug spans the Anthropic account pool and the quota cache: start where a 429 marks an account as rate limited and where cache rows such as provider-account-quota-cache.json are written, then check why the background refresh skips a rate-limited account. Confirm that a 429 without a usage read no longer stores weeklyPercent 100, and that the refresh re-reads the cooled-down account. Reproduction depends on timing and a live account, so a fix needs a mocked 429 test.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

account-pool bug
Client or integration

Codex App (the same local proxy also serves Codex CLI on this machine)

Area

Authentication and account pool

Summary

After a single upstream 429, the active Anthropic OAuth account stayed marked rate limited with a cached weeklyPercent: 100, although its real weekly usage was 0%. Claude requests on that machine kept failing until I manually ran ocx account refresh anthropic. The periodic quota refresh that ran in the meantime updated the other (exhausted) account but skipped the blocked one, so the stale row never corrected itself.

Expected: a 429 that is not backed by a usage read should not be stored as a 100% weekly observation, and the background refresh should re-read the cooled-down account so it recovers as soon as the usage endpoint shows headroom.

This looks close to #6989 (fixed in 2.84.0), but here the version is 2.100.7, the cooldown was not caused by a real quota exhaustion, and the background refresh did not include the affected account.

Reproduction

Observed once on a live setup; I could not trigger the initial 429 deterministically.

  1. Anthropic pool enabled with two OAuth accounts: account A (active, weekly 0%) and account B (weekly 100%, waiting for its reset).
  2. At 11:54:48 UTC a Claude request on A got a 429. The pool tried B, found no eligible replacement and returned 429.
  3. From then on ocx account list anthropic showed A as active rate limited, and provider-account-quota-cache.json held for A: weeklyPercent: 100, but a model window Fable at percent: 17 in the same row, updatedAt 11:55:29 UTC.
  4. At 12:00:56 UTC the background refresh rewrote the cache: B's row got a new updatedAt, A's row stayed at 11:55:29 with weeklyPercent: 100.
  5. At about 12:02 UTC, ocx account refresh anthropic read A at weekly 0% / Fable 0%, cleared rate limited, and a codex exec -m anthropic/claude-sonnet-5-5 call succeeded right away.

Same period, other machine: the same Anthropic account is also logged in on a second OpenCodex install (macOS, 2.100.4, separate OAuth login). That install read A at weekly 0% at 12:02:45 UTC and kept working the whole time. It refreshed its own access token around 11:54:51 UTC, three seconds after the 429 on Windows. This may be a coincidence; I mention it in case a concurrent refresh on the account causes a short 429 upstream.

Version

2.100.7 (npm global install, bundled Bun runtime, managed background service)

Operating system

Windows 11 Pro, build 28000

Provider and model

anthropic / claude-sonnet-5-5 and claude-opus-5-5 (whole Claude pool)

Logs or error output
2026-11-21T11:54:48.395Z [anthropic-pool] 429 on pA; failing over to pB
2026-11-21T11:54:50.646Z [anthropic-pool] no eligible replacement; returning 429

Cache rows before the manual refresh (IDs replaced):

{
  "anthropic\u0000A": {"weeklyPercent":100,"weeklyResetAt":1795370400187,"displayWindows":[{"label":"Fable","scope":"model","percent":17,"resetAt":1795370400187,"weeklyAllowancePercent":50}],"updatedAt":1795262129229},
  "anthropic\u0000B": {"weeklyPercent":100,"weeklyResetAt":1795348799908,"displayWindows":[{"label":"Fable","scope":"model","percent":95,"resetAt":1795348799909,"weeklyAllowancePercent":50}],"updatedAt":1795262455968}
}

After ocx account refresh anthropic:

{"anthropic\u0000A": {"weeklyPercent":0,"weeklyResetAt":1795370400496,"displayWindows":[{"label":"Fable","scope":"model","percent":0,"resetAt":1795370400000,"weeklyAllowancePercent":50}],"updatedAt":1795262608541}}
Redacted configuration
{
  "anthropicAccountPool": {
    "enabled": true,
    "strategy": "quota",
    "stickyLimit": 1,
    "autoSwitchThreshold": 80,
    "quotaWindow": "max-utilization",
    "nativeMessages": true
  }
}
Checks
  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.
Ngôn ngữ chính
TypeScript
Star
16.9k
Fork
1.3k
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
844

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của lidge-jun/opencodex

Tất cả issue của lidge-jun/opencodex

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.