The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 21:00 UTC
fix(cursor): unified usage plans show one meter (#34506)
Julius Marminge committed
Nov 11, 2026 at 16:05 UTC
f28dc8ee9486853733462a5589c61591ecb87279
3 files changed
+30
-4
packages/provider-cursor/src/server/usageLimits.test.ts
+15
@@ -76,6 +76,21 @@ describe("Cursor usage limits", () => {
76
}
77
});
78
79
+ it("shows a unified allowance once, not as a total plus a pool", () => {
80
+ // A unified plan reports only the total and the auto bucket, at the same value.
81
+ const windows = cursorUsageResponseToLimits(
82
+ { planUsage: { totalPercentUsed: 1.77, autoPercentUsed: 1.77 } },
83
+ checkedAt,
84
+ ).windows;
85
+ expect(windows.map((window) => window.id)).toEqual(["autoPercentUsed"]);
86
+ expect(
87
+ cursorUsageResponseToLimits(
88
+ { planUsage: { totalPercentUsed: 100, apiPercentUsed: 100 } },
89
+ checkedAt,
90
+ ).windows.map((window) => window.id),
91
+ ).toEqual(["apiPercentUsed", "totalPercentUsed"]);
92
+ });
93
+
94
it("does not invent unused allowance for absent buckets", () => {
95
expect(cursorUsageResponseToLimits({ planUsage: {} }, checkedAt).unavailable?.reason).toBe(
96
"unsupported",
packages/provider-cursor/src/server/usageLimits.ts
+13
-2
@@ -57,8 +57,19 @@ export function cursorUsageResponseToLimits(
57
});
58
}
59
}
60
- return windows.length > 0
61
- ? makeUsageLimits({ checkedAt, windows })
60
+ const total = windows.find((window) => window.id === "totalPercentUsed");
61
+ const pools = windows.filter((window) => window !== total);
62
+ // Unified plans report their one allowance as both the total and the auto pool. Keep the pool:
63
+ // it pools with split-plan accounts, and exhaustedUsageWindow reads the pools.
64
+ const visibleWindows =
65
+ total &&
66
+ pools.length === 1 &&
67
+ pools[0]?.id === "autoPercentUsed" &&
68
+ pools[0].usedPercent === total.usedPercent
69
+ ? pools
70
+ : windows;
71
+ return visibleWindows.length > 0
72
+ ? makeUsageLimits({ checkedAt, windows: visibleWindows })
73
: makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" });
74
}
75
packages/shared/src/usageLimits.ts
+2
-2
@@ -127,12 +127,12 @@ export const CURSOR_USAGE_WINDOWS = [
127
{
128
id: "totalPercentUsed",
129
label: "Overall",
130
- description: "Combined usage across both allowances, not a third quota.",
130
+ description: "All usage on your plan this billing cycle.",
131
},
132
{
133
id: "autoPercentUsed",
134
label: "Cursor Models",
135
- description: "Grok and Composer use this first. Auto can use either pool.",
135
+ description: "Grok, Composer, and Auto use this allowance.",
136
},
137
{
138
id: "apiPercentUsed",