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).
65 lines
2.3 KiB
TypeScript
65 lines
2.3 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
const { buildKiroPayload } = await import("../../open-sse/translator/request/openai-to-kiro.ts");
|
|
|
|
// Regression guards for #5231: when an OpenAI->Kiro request ends on an
|
|
// assistant/tool turn, the translator must synthesize a *neutral* filler user
|
|
// turn ("...") rather than the literal word "Continue" — Kiro/CodeWhisperer can
|
|
// read "Continue" as a real user instruction and take unintended agent action.
|
|
|
|
test("#5231: assistant-text-ending request never leaks the literal 'Continue' filler", () => {
|
|
const result = buildKiroPayload(
|
|
"claude-sonnet-4",
|
|
{
|
|
messages: [
|
|
{ role: "user", content: "First user" },
|
|
{ role: "assistant", content: "Assistant answer" },
|
|
],
|
|
},
|
|
false,
|
|
null
|
|
);
|
|
|
|
const synthesized = result.conversationState.currentMessage.userInputMessage.content;
|
|
assert.match(synthesized, /\n\n\.\.\.$/, "synthesized trailing turn must end with the neutral filler");
|
|
assert.ok(
|
|
!/\bContinue\b/.test(synthesized),
|
|
`synthesized trailing turn must not contain the literal "Continue", got: ${synthesized}`
|
|
);
|
|
});
|
|
|
|
test("#5231: a trailing tool-result turn is promoted as-is, NOT replaced by the filler", () => {
|
|
// Proves the change is scoped strictly to the assistant-text-ending case: a
|
|
// conversation ending on a tool result already collapses to a real user turn
|
|
// (carrying its toolResults), which is promoted into currentMessage unchanged.
|
|
const result = buildKiroPayload(
|
|
"claude-sonnet-4",
|
|
{
|
|
messages: [
|
|
{ role: "user", content: "Run the tool" },
|
|
{
|
|
role: "assistant",
|
|
content: null,
|
|
tool_calls: [
|
|
{ id: "call_1", type: "function", function: { name: "get_time", arguments: "{}" } },
|
|
],
|
|
},
|
|
{ role: "tool", tool_call_id: "call_1", content: "12:00" },
|
|
],
|
|
},
|
|
false,
|
|
null
|
|
);
|
|
|
|
const current = result.conversationState.currentMessage.userInputMessage;
|
|
assert.ok(
|
|
!/\.\.\.$/.test(current.content) && !/\bContinue\b/.test(current.content),
|
|
`trailing tool-result turn must be promoted as-is, got synthesized filler: ${current.content}`
|
|
);
|
|
assert.ok(
|
|
(current.userInputMessageContext?.toolResults?.length ?? 0) > 0,
|
|
"promoted trailing turn must carry the tool results"
|
|
);
|
|
});
|