Skip to content

Commit b2aea75

Browse files
test(oauth): guard model-family forwarding in split Responses owners
Ported the six pre-modularization call sites to their current owners while retaining send-budget and snapshot pairing. Static inspection only; runtime checks were not run on the connected host. Co-authored-by: chilung <[email protected]>
1 parent 6e41ad0 commit b2aea75

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

‎structure/transports/inventory.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,14 @@ Renamed fixed-key providers receive [missing reasoning metadata](../catalog.md#r
150150

151151
Translated audio/file admission follows the [final-adapter input contract](../adapters/registry.md#untranslated-input-media); native raw passthrough remains separate.
152152
Canonical Responses identity sanitation and narrowly scoped pre-output combo recovery follow [request-local target compatibility](../runtime.md#request-local-target-compatibility); other adapter contracts remain unchanged.
153+
154+
## Model-family-aware OAuth headroom
155+
156+
`src/oauth/account-quota-rank.ts` ranks Antigravity custom windows for the requested
157+
Gemini or Claude family, including GPT-OSS in the Claude family. An unknown model
158+
retains all-window ranking; absent matching evidence retains the existing unranked behavior.
159+
`src/server/responses/request-transport.ts` passes the routed model at initial selection.
160+
The passthrough, adapter, continuation, sidecar and run-turn execution owners pass
161+
the same routed model during account rotation, without bypassing their send-budget
162+
admission or account-snapshot pairing. The forwarding contract is covered in
163+
`tests/oauth/oauth-account-quota-rank.test.ts`; the core facade remains orchestration-only.

‎tests/oauth/oauth-account-quota-rank.test.ts‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
2-
import { mkdtempSync } from "node:fs";
2+
import { mkdtempSync, readFileSync } from "node:fs";
33
import { tmpdir } from "node:os";
44
import { join } from "node:path";
55
import {
@@ -21,8 +21,9 @@ import {
2121
saveCredential,
2222
setActiveAccount,
2323
} from "../../src/oauth/store";
24-
import type { OcxConfig, OcxProviderConfig } from "../../src/types";
24+
import type { OcxConfig } from "../../src/types";
2525
import { removeTreeWithRetry } from "../helpers/remove-tree";
26+
import { repoPath } from "../helpers/repo-root";
2627

2728
const originalHome = process.env.OPENCODEX_HOME;
2829
let home: string;
@@ -381,3 +382,27 @@ describe("model-aware failover and pre-dispatch integration", () => {
381382
});
382383
});
383384

385+
describe("modular Responses model-family forwarding", () => {
386+
test("initial selection receives the routed model in the transport owner", () => {
387+
const source = readFileSync(repoPath("src/server/responses/request-transport.ts"), "utf8");
388+
expect(source).toContain("preferredInitialAccount(config, route.providerName, Date.now(), route.modelId)");
389+
});
390+
391+
for (const [owner, retryAfter] of [
392+
["passthrough-dispatch.ts", 'upstreamResponse.headers.get("retry-after")'],
393+
["adapter-dispatch.ts", 'upstreamResponse.headers.get("retry-after")'],
394+
["adapter-continuation.ts", 'response.headers.get("retry-after")'],
395+
["sidecar-execution.ts", "retryAfter"],
396+
["run-turn-execution.ts", "null"],
397+
] as const) {
398+
test(owner + " forwards the routed model on account rotation", () => {
399+
const source = readFileSync(repoPath("src/server/responses", owner), "utf8");
400+
expect(source.match(/\brotateGenericOAuthAccountOn429\s*\(/g)).toHaveLength(1);
401+
expect(source.replace(/\s+/g, " ")).toContain(
402+
"rotateGenericOAuthAccountOn429( config, route.providerName, "
403+
+ "transportState.genericFailoverAccountId, " + retryAfter
404+
+ ", Date.now(), route.modelId, )",
405+
);
406+
});
407+
}
408+
});

0 commit comments

Comments
 (0)