Skip to content

fix(claude): distinguish extra usage credits from rate-limit windows - #516

Merged
astyfx merged 1 commit into
mainfrom
fix/claude-approaching
Sep 8, 2026
Merged

fix(claude): distinguish extra usage credits from rate-limit windows#516
astyfx merged 1 commit into
mainfrom
fix/claude-approaching

Conversation

@astyfx

@astyfx astyfx commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

Claude rate_limit_event warnings now name the limiting window, including extra usage credits, so an exhausted credit balance is no longer shown as a 5-hour or weekly rate limit that failed to reset.

Changes

Fixes

  • claude: label rateLimitType: "overage" as extra usage credits instead of a generic rate limit
  • claude: name 5-hour and weekly windows in approaching/rejected rate-limit copy
  • claude: mention exhausted extra credits or overflow coverage when those flags are present on a subscription window
  • claude: prefer overageResetsAt and include the calendar date when the reset is not today

Refactors / Chores

  • claude: extract buildClaudeRateLimitEvents() and drop unused api_error_status suffix (not present on SDK rate-limit info)

Test Evidence

  • bun run typecheck passed
  • bun test tests/claude-sdk-runtime.test.ts — 161 pass (7 new cases for overage labeling, window names, credit suffixes, reset formatting, and the unknown-window regression)

Notes

Status-bar usage meters still map only session/weekly windows; extra-usage remaining credits are not shown there. Rate-limit warnings remain per-turn system events with no session-level dedupe.

Overage warnings were labeled as a generic rate limit, so exhausted extra credits looked like a 5-hour or weekly window that had failed to reset.

Co-authored-by: Cursor <cursoragent@cursor.com>
@astyfx
astyfx requested a review from a team as a code owner September 8, 2026 04:36
@astyfx
astyfx requested review from JongSikLim and dodonmountain and removed request for a team September 8, 2026 04:36
@astyfx
astyfx enabled auto-merge (squash) September 8, 2026 04:36
@upwind-code-us

upwind-code-us Bot commented Sep 8, 2026

Copy link
Copy Markdown

Upwind Upwind Code Scan - ✅ Passed

0 newly introduced vulnerabilities · 0 resolved · 52 total in this PR vs main

Total breakdown: 🔶 5 High | 🟡 44 Medium | 🟢 3 Low

View full analysis in Upwind Console

Scan completed in 16s

Scan history (1 scan)
Commit Scanned at New Resolved Net
27b6af5 < 2026-09-08 04:37 UTC 0 0 0

Last scanned: 27b6af5 · 2026-09-08 04:37 UTC

@upwind-code-us

upwind-code-us Bot commented Sep 8, 2026

Copy link
Copy Markdown

Upwind Upwind IaC Scan - ✅ Passed

0 newly introduced misconfigurations · 0 resolved · 0 total in this PR vs main

View full analysis in Upwind Console →

Scan completed in 5s

Scan history (1 scan)
Commit Scanned at New Resolved Net
27b6af5 < 2026-09-08 04:37 UTC 0 0 0

Last scanned: 27b6af5 · 2026-09-08 04:37 UTC

@heath-s heath-s left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@astyfx
astyfx merged commit af137f9 into main Sep 8, 2026
6 checks passed
@astyfx
astyfx deleted the fix/claude-approaching branch September 8, 2026 04:44
@astyfx astyfx mentioned this pull request Sep 9, 2026
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.

2 participants