Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): type the account rate-limit runtime payload #5473

Closedvasars2024-hub(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/5473/headopened View on GitHub

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

x
0 of 5 viewed, 5 left
58 additions and 0 deletionsapps/server/src/provider/Layers/ClaudeAdapter.test.tsModified
View file
@@ -1995,6 +1995,64 @@
+ it.effect("normalizes Claude rate limit events onto canonical usage windows", () => {
+ const harness = makeHarness();
+ return Effect.gen(function* () {
+ const adapter = yield* ClaudeAdapter;
+ const runtimeEvents: Array<ProviderRuntimeEvent> = [];
+ const runtimeEventsFiber = yield* Stream.runForEach(adapter.streamEvents, (event) =>
+ Effect.sync(() => runtimeEvents.push(event)),
+ ).pipe(Effect.forkChild);
+​
+ yield* adapter.startSession({
+ threadId: THREAD_ID,
+ provider: ProviderDriverKind.make("claudeAgent"),
+ runtimeMode: "full-access",
+ });
+​
+ harness.query.emit({
+ type: "rate_limit_event",
+ rate_limit_info: {
+ status: "allowed_warning",
+ rateLimitType: "five_hour",
+ utilization: 82,
+ resetsAt: 1_800_000_000,
+ },
+ session_id: "session",
+ uuid: "rate-limit-1",
+ } as unknown as SDKMessage);