Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Claude stays in Usage limits when its usage read comes back empty #15443

Closedpedrozimmermannsoares(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/15443/headopened View on GitHub

Showing 2 changed files with 36 additions and 3 deletions.

x
0 of 2 viewed, 2 left
28 additions and 2 deletionsapps/server/src/provider/Layers/claudeUsageLimits.test.tsModified
View file
@@ -1,6 +1,12 @@
-import { describe, expect, it } from "vite-plus/test";
+import * as Effect from "effect/Effect";
+import * as Ref from "effect/Ref";
+import { describe, expect, it } from "@effect/vitest";
​
-import { claudeRateLimitEventToUpdate, claudeUsageResponseToLimits } from "./claudeUsageLimits.ts";
+import {
+ claudeRateLimitEventToUpdate,
+ claudeUsageResponseToLimits,
+ recordClaudeUsageResponse,
+} from "./claudeUsageLimits.ts";
​
const checkedAt = "2026-07-18T10:00:00.000Z";
const noNames = { overageIncluded: undefined } as const;
@@ -95,6 +101,26 @@
).toEqual({ checkedAt, windows: [], unavailable: { reason: "unsupported" } });
});
​
+ it("reports a subscription whose usage read came back empty as a failed probe", () => {
+ expect(
+ claudeUsageResponseToLimits({
+ checkedAt,
+ response: { rate_limits_available: true, rate_limits: null },
+ }).limits,
+ ).toEqual({ checkedAt, windows: [], unavailable: { reason: "probeFailed" } });
+ });
+​
+ it.effect("keeps the scoped names from the last read when a later read comes back empty", () =>
+ Effect.gen(function* () {