mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-02 05:12:11 +03:00
* fix(api): exempt test-model requests from Output Styles injection (#6240) Root cause: handleChatCore's Phase 4A Output Styles injection (chatCore.ts) was gated only by the operator's global compression.enabled switch, independent of the per-request x-omniroute-compression header. The dashboard 'Test model' action (modelTestRunner.ts) never sent that header, so a globally-enabled Output Style (e.g. 'Ultra terse') always leaked its system-prompt injection into a plain connection test. Fix: skip Output Styles injection when the request explicitly opts out via x-omniroute-compression: off, and always send that header from buildInternalChatRequest / buildInternalRerankRequest. Regression guard: tests/integration/test-model-compression-off-6240.test.ts, tests/unit/model-test-runner-compression-off-6240.test.ts * chore: sync CHANGELOG to release tip (#6511; bullet re-added at merge)
24 lines
1.1 KiB
TypeScript
24 lines
1.1 KiB
TypeScript
// #6240 — the "Test model" internal request builders must always send
|
|
// `X-OmniRoute-Compression: off` so a globally-enabled Output Style (e.g. "Ultra terse") never
|
|
// leaks a system-prompt injection into a plain connection test.
|
|
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import {
|
|
buildInternalChatRequest,
|
|
buildInternalRerankRequest,
|
|
} from "@/lib/api/modelTestRunner.ts";
|
|
|
|
test("buildInternalChatRequest sends X-OmniRoute-Compression: off", () => {
|
|
const controller = new AbortController();
|
|
const request = buildInternalChatRequest({ model: "openai/gpt-4" }, controller.signal);
|
|
assert.equal(request.headers.get("X-OmniRoute-Compression"), "off");
|
|
assert.equal(request.headers.get("X-OmniRoute-No-Cache"), "true");
|
|
});
|
|
|
|
test("buildInternalRerankRequest sends X-OmniRoute-Compression: off", () => {
|
|
const controller = new AbortController();
|
|
const request = buildInternalRerankRequest({ model: "openai/rerank-1" }, controller.signal);
|
|
assert.equal(request.headers.get("X-OmniRoute-Compression"), "off");
|
|
assert.equal(request.headers.get("X-OmniRoute-No-Cache"), "true");
|
|
});
|