Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test unrelated runtime forbidden passthrough
  • Loading branch information
ndycode committed May 1, 2026
commit 20e045cfa9c46f8e5261565f63847db97ad9032a
21 changes: 21 additions & 0 deletions test/runtime-rotation-proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,27 @@ describe("runtime rotation proxy", () => {
expect(accountManager.getAccountByIndex(1)?.enabled).toBe(true);
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

it("forwards unrelated 403 errors without disabling the account", async () => {
const now = Date.now();
const accountManager = new AccountManager(undefined, createStorage(now, 2));
const { calls, fetchImpl } = createRecordingFetch(() =>
new Response(JSON.stringify({ error: { code: "permission_denied" } }), {
status: HTTP_STATUS.FORBIDDEN,
headers: { "content-type": "application/json" },
}),
);
const proxy = await startProxy({ accountManager, fetchImpl });

const response = await postResponses(proxy, { model: "gpt-5-codex" });
const payload = (await response.json()) as { error: { code: string } };

expect(response.status).toBe(HTTP_STATUS.FORBIDDEN);
expect(payload.error.code).toBe("permission_denied");
expect(calls).toHaveLength(1);
expect(accountManager.getAccountByIndex(0)?.enabled).toBe(true);
expect(accountManager.getAccountByIndex(1)?.enabled).toBe(true);
});

it("persists cooldowns so a restarted proxy avoids limited accounts", async () => {
const now = Date.now();
const persisted: AccountStorageV3[] = [];
Expand Down