Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Claude limits update from rate_limit_event unifiedWindows #30999

Closedreyanshdagoat9113(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/30999/headopened View on GitHub

Showing 2 changed files with 70 additions and 0 deletions.

x
0 of 2 viewed, 2 left
47 additions and 0 deletionsapps/server/src/provider/claudeUsageLimits.test.tsModified
View file
@@ -249,6 +249,53 @@
});
});
​
+ it("reads every window from unifiedWindows when the event carries no utilization", () => {
+ // Shape captured from Claude Code 2.1.318.
+ const info = {
+ status: "allowed",
+ rateLimitType: "five_hour",
+ resetsAt: 1_784_000_000,
+ unifiedWindows: {
+ five_hour: { utilization: 0.5, resetsAt: 1_784_000_000, status: "allowed" },
+ seven_day: { utilization: 0.25, resetsAt: 1_784_100_000, status: "allowed" },
+ seven_day_opus: { utilization: 0.9, resetsAt: 1_784_100_000 },
+ },
+ } as const;
+ expect(claudeRateLimitEventToUpdate(info, noNames)).toEqual({
+ windows: [
+ {
+ id: "five_hour",
+ kind: "session",
+ label: "Session",
+ usedPercent: 50,
+ windowDurationMins: 300,
+ resetsAt: "2026-07-14T03:33:20.000Z",
+ },
+ {
+ id: "seven_day",
+ kind: "weekly",
+ label: "Weekly",