Fix misleading rate limit message and improve verbose logging for /limits#1447
Fix misleading rate limit message and improve verbose logging for /limits#1447
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #1446
…mits - Replace misleading "Retry after: 0s" with proper reset time formatting (e.g., "Resets in 2m 30s (Mar 19, 8:00pm UTC)") or "Try again later." when retry-after is 0/missing - Add full request/response verbose logging: URL, sanitized headers, response headers, and response body - Cache 429 rate-limit errors to prevent repeated requests to a rate-limited endpoint (uses same 20-minute TTL as successful responses) Fixes #1446 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add 12 tests for formatRetryAfterMessage covering null, 0, negative, seconds, minutes, hours, HTTP-date, and integration with formatUsageMessage - Add case study with timeline, root cause analysis, upstream issue references, and community workarounds documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit 9ab9272.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
|
Can we rephrase |
|
🤖 AI Work Session Started Starting automated work session at 2026-03-19T19:51:18.886Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
Change "Rate limited by Claude Usage API." to "Claude Usage API access has reached rate limit." per PR review feedback for clearer messaging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Good suggestion! Updated the message from "Rate limited by Claude Usage API." to "Claude Usage API access has reached rate limit." in commit d23cb72. All 50 tests pass. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Summary
Fixes #1446
retry-after: 0, the message now shows "Try again later." instead of the misleading "Retry after: 0s". For meaningful retry-after values, shows proper reset time like "Resets in 5m (Mar 19, 8:00pm UTC)"Root Cause
The Anthropic
/api/oauth/usageendpoint has a known issue where it returns persistent 429 withretry-after: 0(anthropics/claude-code#30930). Our code was displaying this misleading value directly to users.Changes
src/limits.lib.mjsformatRetryAfterMessage()function, user-friendly error message, enhanced verbose logging, 429 cachingtests/limits-display.test.mjsformatRetryAfterMessage()(total: 50 tests, all passing)docs/case-studies/issue-1446/.changeset/Test plan
node tests/limits-display.test.mjs)formatRetryAfterMessage(null)→ " Try again later."formatRetryAfterMessage('0')→ " Try again later." (the key fix)formatRetryAfterMessage('300')→ " Resets in 5m (Mar 19, 8:00pm UTC)"formatRetryAfterMessage('3600')→ " Resets in 1h 0m (...)"🤖 Generated with Claude Code