From f34ddb0cf2948bb5722894d8c26ee753cf3a9917 Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza Date: Sun, 12 Jul 2026 20:46:23 -0300 Subject: [PATCH] fix(test): align emergency fallback budget-exhaustion test with #6912 max_tokens normalization (#6967) The test asserted both max_tokens and max_completion_tokens=4096 on the nvidia/openai/gpt-oss-120b emergency fallback request. Commit a34fb6b3e (#6912, merged into this release tip) added a symmetric normalization in chatCore.ts that renames/deletes the redundant max_completion_tokens field whenever the target provider supportsMaxTokens() (nvidia does), so only max_tokens reaches the upstream request. The old dual-field assertion is an outdated contract, not a regression. Align the test to the new intentional behavior while keeping the max_tokens=4096 cap assertion as the fallback-cap guard. --- tests/unit/chat-route-coverage.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/unit/chat-route-coverage.test.ts b/tests/unit/chat-route-coverage.test.ts index 6accc32901..e249e5247a 100644 --- a/tests/unit/chat-route-coverage.test.ts +++ b/tests/unit/chat-route-coverage.test.ts @@ -444,7 +444,10 @@ test("handleChat uses the emergency fallback model on budget exhaustion", async assert.equal(seenBodies.length, 2); assert.equal(seenBodies[1].model, "openai/gpt-oss-120b"); assert.equal(seenBodies[1].max_tokens, 4096); - assert.equal(seenBodies[1].max_completion_tokens, 4096); + // nvidia supports the legacy `max_tokens` field (#6912 symmetric normalization in + // chatCore.ts), so the redundant `max_completion_tokens` is renamed away rather than + // sent alongside it — only one output-token field reaches the upstream request. + assert.equal(seenBodies[1].max_completion_tokens, undefined); assert.equal(json.choices[0].message.content, "Emergency fallback answered"); });