fix usage-limit cooldown persistence - #354
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 29 minutes and 56 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Superseded by merged rebuild #355 and the follow-up release work now on |
Summary
What Changed
Validation
npm run lintnpm run typechecknpm testnpm test -- test/documentation.test.tsnpm run buildnpm test -- test/accounts.test.ts test/fetch-helpers.test.ts test/index.test.ts test/preemptive-quota-scheduler.test.tsDocs and Governance Checklist
Risk and Rollback
00bbcbaAdditional Notes
note: greptile review for oc-chatgpt-multi-auth. cite files like
lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.Greptile Summary
this pr tightens usage-limit cooldown propagation across three layers:
accounts.tsandpreemptive-quota-scheduler.tsnow useMath.maxto preserve the longest reset time instead of blindly overwriting it, and theindex.tsfallback 429 path is fully wired into the same backoff/scheduler pipeline as the primary path. the retry-after cap is raised from 5 minutes to 7 days, and natural-language usage-limit messages are parsed for both clock-time ("try again at 6:26 AM") and duration ("try again in 2 hours") hints.Confidence Score: 5/5
safe to merge — all findings are P2 style/cleanup concerns with no correctness impact
the core Math.max fix in accounts.ts and preemptive-quota-scheduler.ts is correct and well-tested; the fallback 429 path is now consistent with the primary path; no P0/P1 issues found
lib/preemptive-quota-scheduler.ts (secondary slot data loss is benign but worth tracking); test/fetch-helpers.test.ts (indentation inconsistency on one migrated test)
Important Files Changed
Sequence Diagram
sequenceDiagram participant C as Client participant P as Plugin fetch handler participant B as getRateLimitBackoff participant S as PreemptiveQuotaScheduler participant A as AccountManager C->>P: request P->>P: primary account fetch → 429 P->>B: getRateLimitBackoff(index, quotaKey, retryAfterMs) B-->>P: { delayMs } P->>P: cooldownMs = max(delayMs, retryAfterMs) P->>S: markRateLimited(quotaScheduleKey, cooldownMs) Note over S: nextReset = max(existingReset, now+cooldownMs) P->>A: markRateLimitedWithReason(account, cooldownMs, ...) Note over A: resetAt = max(currentResetAt, now+cooldownMs) alt cooldownMs ≤ short retry threshold P->>P: sleep(addJitter(cooldownMs)) then retry else P-->>C: propagate 429 with cooldownMs wait end Note over P: fallback account path (new) P->>P: fallback fetch → 429 P->>P: handleErrorResponse(fallbackResponse) P->>B: getRateLimitBackoff(fallbackIndex, fallbackQuotaKey, retryAfterMs) B-->>P: { delayMs } P->>P: cooldownMs = max(delayMs, retryAfterMs) P->>S: markRateLimited(fallbackScheduleKey, cooldownMs) P->>A: markRateLimitedWithReason(fallbackAccount, cooldownMs, 'quota', ...) P->>P: continue to next fallbackPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix usage-limit cooldown persistence" | Re-trigger Greptile