Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): older probes no longer overwrite live usage limits #18723

Mergedbitmvk(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/18723/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 120 additions and 3 deletions (loading 2).

x
0 of 5 viewed, 5 left
1 addition and 0 deletionsapps/server/src/provider/ClaudeCapabilitiesProbe.test.tsModified
View file
@@ -308,6 +308,7 @@
rate_limits_available: true,
rate_limits: { five_hour: { utilization: 12, resets_at: "2026-07-18T14:39:00Z" } },
+ usageCheckedAt: "1970-01-01T00:00:00.000Z",
});
​
const invocation = JSON.parse(yield* fs.readFileString(invocationPath)) as {
9 additions and 3 deletionsapps/server/src/provider/ClaudeProvider.tsModified
View file
@@ -265,6 +265,7 @@
* otherwise successful response mean the account has none (API key).
readonly usage?: Pick<SDKControlGetUsageResponse, "rate_limits_available" | "rate_limits">;
+ readonly usageCheckedAt?: string;
​
function parseClaudeInitializationCommands(
@@ -385,6 +386,7 @@
// Usage has its own deadline so a slow optional request cannot discard initialization.
// Only the rate limits are read, so skip the local transcript scan that fills
// `behaviors`: with a few GB of transcripts it outlasts the deadline.
+ const usageCheckedAt = DateTime.formatIso(yield* DateTime.now);
const usageResult = includeUsage
? yield* Effect.tryPromise(() =>
q.usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET({ skipBehaviors: true }),