mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
v3.8.40 cycle integration → main. All test gates green (Unit/Integration/Coverage/Node-compat/Quality-Ratchet). The only red check, 'PR Test Policy', is the test-masking heuristic firing on the cumulative ~57-commit release diff (legitimate assert consolidations already reviewed per-PR — Gemini CLI removal #5246, retired GPT models #5280, provider catalog refreshes); overridden with --admin per the documented release-PR convention. CodeQL/SonarQube advisory scans non-blocking; #5278's code already passed CodeQL on main. Homologated on VPS 192.168.0.15 (v3.8.40 healthy).
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
const { GrokCliExecutor } = await import("@omniroute/open-sse/executors/grok-cli");
|
|
|
|
// Regression for #5273: Grok Build returns `400 'Model does not support parameter
|
|
// presencePenalty'` when clients (MiMoCode, Cursor, …) send OpenAI-style sampling
|
|
// params Grok Build cannot accept. transformRequest() must strip them before forwarding.
|
|
const UNSUPPORTED = ["presencePenalty", "frequencyPenalty", "logprobs", "topLogprobs"];
|
|
|
|
test("#5273 grok-cli transformRequest strips unsupported sampling params", () => {
|
|
const executor = new GrokCliExecutor();
|
|
const body = {
|
|
model: "grok-build",
|
|
messages: [{ role: "user", content: "hi" }],
|
|
temperature: 0.7,
|
|
top_p: 0.9,
|
|
presencePenalty: 0.5,
|
|
frequencyPenalty: 0.3,
|
|
logprobs: true,
|
|
topLogprobs: 5,
|
|
};
|
|
|
|
const out = executor.transformRequest("grok-build", body, false, {} as never) as Record<
|
|
string,
|
|
unknown
|
|
>;
|
|
|
|
// Unsupported params are gone…
|
|
for (const param of UNSUPPORTED) {
|
|
assert.equal(param in out, false, `${param} must be stripped before forwarding to Grok Build`);
|
|
}
|
|
// …while supported params + payload survive untouched.
|
|
assert.equal(out.temperature, 0.7);
|
|
assert.equal(out.top_p, 0.9);
|
|
assert.deepEqual(out.messages, [{ role: "user", content: "hi" }]);
|
|
assert.equal(out.model, "grok-build");
|
|
assert.equal(out.stream, false);
|
|
});
|
|
|
|
test("#5273 grok-cli transformRequest leaves a clean body unchanged (no false stripping)", () => {
|
|
const executor = new GrokCliExecutor();
|
|
const out = executor.transformRequest(
|
|
"grok-composer-2.5-fast",
|
|
{ messages: [{ role: "user", content: "ok" }], temperature: 1 },
|
|
true,
|
|
{} as never
|
|
) as Record<string, unknown>;
|
|
|
|
assert.equal(out.temperature, 1);
|
|
assert.equal(out.model, "grok-composer-2.5-fast");
|
|
assert.equal(out.stream, true);
|
|
});
|