fix(runtime): serialize Fire Pass calls per credential to stop boss-build 429s
Boss build seeds one Fire Pass key for every agent. Three concurrent agents -> three concurrent streamSimple calls against the Kimi K2.6 Turbo router -> three HTTP 429s on the overview dashboard. Add an in-memory async semaphore keyed by (provider, sha1(apiKey)) and acquire a slot inside `createSafePiStream` before invoking the source. The slot is released when the stream finishes, errors, or aborts. `fireworks-firepass` is capped at 1 concurrent call; every other provider stays uncapped (no fallback layer, no 429 retry — flow control prevents the burst at the source instead of recovering after). Same code path applies to public and boss builds: only the seeded key differs, the gate behaviour is identical.
This commit is contained in:
1 parent
a532120649
commit
fccb0d8586
6 files changed
+421
-7
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
PROVIDER_CONCURRENCY_LIMITS,
|
||||
getProviderConcurrencyLimit,
|
||||
} from "../../src/main/worker/runtime/provider-rate-limits";
|
||||
|
||||
describe("provider rate limits", () => {
|
||||
it("caps fireworks-firepass at one concurrent call", () => {
|
||||
expect(PROVIDER_CONCURRENCY_LIMITS["fireworks-firepass"]).toBe(1);
|
||||
expect(getProviderConcurrencyLimit("fireworks-firepass")).toBe(1);
|
||||
});
|
||||
|
||||
it("returns null for providers without an explicit cap", () => {
|
||||
expect(getProviderConcurrencyLimit("anthropic")).toBeNull();
|
||||
expect(getProviderConcurrencyLimit("openai")).toBeNull();
|
||||
expect(getProviderConcurrencyLimit("ollama")).toBeNull();
|
||||
expect(getProviderConcurrencyLimit("unknown-provider")).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user