Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): limited threads through CLIProxyAPI resume when the hub refills #27214

Closedsaphid(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/27214/headopened View on GitHub

Showing 7 changed files with 51 additions and 6 deletions (loading 4).

x
0 of 7 viewed, 7 left
31 additions and 4 deletionsapps/server/src/orchestration-v2/ProviderEventIngestor.test.tsModified
View file
@@ -47,6 +47,7 @@
import * as ProviderEventIngestor from "./ProviderEventIngestor.ts";
import * as ThreadCommandExecutor from "./ThreadCommandExecutor.ts";
import * as ProviderInstanceRegistry from "../provider/ProviderInstanceRegistry.ts";
+import * as UsageLimitSources from "../usage/UsageLimitSources.ts";
import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
import type { ProviderInstance } from "@t3tools/provider-core/server/driver";
import { makeProviderFailure } from "@t3tools/provider-core/server/failure";
@@ -233,6 +234,17 @@
Effect.scoped(
Effect.gen(function* () {
const refreshed = yield* Deferred.make<void>();
+ const hubResetAt = "2026-10-30T05:00:00.000Z";
+ const nativeResetAt = "2026-10-30T03:00:00.000Z";
+ const fallbackLookups: Array<{ instanceId: ProviderInstanceId; driver: ProviderDriverKind }> =
+ [];
+ const layerResetFallback = Layer.succeed(UsageLimitSources.UsageLimitResetFallback, {
+ resetAt: (lookup) =>
+ Effect.sync(() => {
+ fallbackLookups.push(lookup);
+ return hubResetAt;
+ }),
+ });
const adapter = yield* ProviderAdapter.ProviderAdapterV2.pipe(
Effect.provide(
Layer.mock(ProviderAdapter.ProviderAdapterV2)({
@@ -290,7 +302,11 @@
providerInstanceId: instance.instanceId,