Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Claude limits load again for users with large transcript histories #16358

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/16358/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 25 additions and 1 deletion.

x
0 of 2 viewed, 2 left
22 additions and 0 deletionsapps/server/src/provider/ClaudeCapabilitiesProbe.test.tsModified
View file
@@ -353,3 +353,25 @@
assert.equal(abortSignal?.aborted, true);
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
+​
+it.effect("asks for usage without the local transcript scan", () =>
+ Effect.gen(function* () {
+ let usageOptions: unknown;
+ const query = vi.spyOn(ClaudeSdk, "query").mockImplementation(
+ () =>
+ ({
+ initializationResult: async () => ({
+ account: { email: "dev@example.com", subscriptionType: "max", tokenSource: "oauth" },
+ commands: [],
+ }),
+ usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET: async (options?: unknown) => {
+ usageOptions = options;
+ return { rate_limits_available: true, rate_limits: null };
+ },
+ }) as unknown as ReturnType<typeof ClaudeSdk.query>,
+ );
+ yield* Effect.addFinalizer(() => Effect.sync(() => query.mockRestore()));
+ yield* probeClaudeCapabilities(decodeClaudeSettings({ binaryPath: "claude" }));
+ assert.deepEqual(usageOptions, { skipBehaviors: true });
+ }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
+);
3 additions and 1 deletionapps/server/src/provider/ClaudeProvider.tsModified
View file
@@ -367,9 +367,11 @@