From 795312d79908586b3cb8b1e6f04f2b391bf90a35 Mon Sep 17 00:00:00 2001 From: Minxi Hou Date: Tue, 4 Aug 2026 23:36:00 -0400 Subject: [PATCH] test(sse): cover the provider-prefixed model id through the cap resolver A routed request arrives as `agy/...` or `antigravity/...`, and cleanModelName strips that prefix before the ceiling is resolved. Neither function mentions the other, so a change to the stripping would send every prefixed request to the fallback with nothing failing: the capability lookup returns null for a prefixed id, and null is exactly what the fallback is for. Deleting the strip turns this test red along with five existing ones, which is the coupling made visible. --- .../antigravity-per-model-output-cap.test.ts | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/unit/antigravity-per-model-output-cap.test.ts b/tests/unit/antigravity-per-model-output-cap.test.ts index 6f90a2df51..4a8cc1b5ef 100644 --- a/tests/unit/antigravity-per-model-output-cap.test.ts +++ b/tests/unit/antigravity-per-model-output-cap.test.ts @@ -200,3 +200,40 @@ test("the executor's cap differs per model on the same code path", async () => { if (result instanceof Response) throw new Error("Unexpected Response from transformRequest"); assert.equal(generationConfigOf(result.request).maxOutputTokens, 32768); }); + +// A routed request carries a provider prefix (`agy/...`, `antigravity/...`), +// and cleanModelName strips it before the ceiling is resolved. Nothing states +// that coupling in either function, so a change to the stripping would silently +// route every prefixed request to the fallback. Handing the prefixed id +// straight to the capability lookup returns null, which is what that failure +// would look like. +test("a provider-prefixed model id resolves to the model's ceiling, not the fallback", async () => { + const cases: Array<[string, number]> = [ + ["agy/gemini-3.1-pro-high", 65535], + ["antigravity/gemini-3.1-pro-high", 65535], + ["agy/gemini-3.6-flash-high", 65536], + ["agy/gpt-oss-120b-medium", 32768], + ]; + + for (const [modelId, expected] of cases) { + const executor = new AntigravityExecutor(); + const result = await executor.transformRequest( + modelId, + { + request: { + contents: [{ role: "user", parts: [{ text: "Hello" }] }], + generationConfig: { maxOutputTokens: 1_000_000 }, + }, + }, + true, + { projectId: "project-1" } + ); + + if (result instanceof Response) throw new Error("Unexpected Response from transformRequest"); + assert.equal( + generationConfigOf(result.request).maxOutputTokens, + expected, + `${modelId} must cap at ${expected}, not at the ${MAX_ANTIGRAVITY_OUTPUT_TOKENS} fallback` + ); + } +});