@devries-cameron20 / t3code-1 / commits / fd985e0985
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(usage): a Claude hub account with an unmeasured window keeps its other limits (#31748)

Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>

MarcoDotIO committed Nov 14, 2026 at 22:05 UTC fd985e09854d86568f0fb22484084939ac898fc8
2 files changed +22 -1
apps/server/src/usage/cliproxyApi.test.ts
+20
@@ -437,6 +437,26 @@ describe("CLIProxyAPI built-in management API", () => {
437 }),
438 );
439
440 + it.effect("keeps a Claude account whose window reports no utilization", () =>
441 + Effect.gen(function* () {
442 + const test = fixture({
443 + accounts: [{ ...accounts[0]!, provider: "claude" }],
444 + upstream: () => ({
445 + status: 200,
446 + body: {
447 + five_hour: { utilization: null, resets_at: null },
448 + seven_day: { utilization: 50, resets_at: "2099-01-01T00:00:00Z" },
449 + },
450 + }),
451 + });
452 + const result = yield* (yield* test.api).readAccounts(config);
453 + expect(result[0]?.usageLimits.unavailable).toBeUndefined();
454 + expect(
455 + result[0]?.usageLimits.windows.map((window) => [window.id, window.usedPercent]),
456 + ).toEqual([["seven_day", 50]]);
457 + }),
458 + );
459 +
460 const antigravitySummary = {
461 buckets: [
462 {
apps/server/src/usage/cliproxyApi.ts
+2 -1
@@ -70,8 +70,9 @@ const CodexUsage = Schema.Struct({
70 }),
71 ),
72 });
73 +// The usage endpoint can report a window without a utilization, as the CLI's own schema allows.
74 const ClaudeWindow = Schema.Struct({
74 - utilization: Schema.Number,
75 + utilization: Schema.NullOr(Schema.Number),
76 resets_at: Schema.NullOr(Schema.String),
77 });
78 const ClaudeUsage = Schema.Struct({