mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-05 06:42:12 +03:00
fix(stability): resolve codex input validation, enable combo circuit breaker, and fix broken unit tests
This commit is contained in:
@@ -481,7 +481,13 @@ function stripStoredItemReferences(body: Record<string, unknown>): void {
|
||||
// Codex rejects previous_response_id for passthrough requests.
|
||||
delete body.previous_response_id;
|
||||
if (Array.isArray(body.input) && body.input.length === 0) {
|
||||
delete body.input;
|
||||
body.input = [
|
||||
{
|
||||
type: "message",
|
||||
role: "user",
|
||||
content: [{ type: "input_text", text: "continue" }],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (!Array.isArray(body.input)) return;
|
||||
|
||||
@@ -8,6 +8,8 @@ import {
|
||||
checkFallbackError,
|
||||
formatRetryAfter,
|
||||
getRuntimeProviderProfile,
|
||||
recordProviderFailure,
|
||||
isProviderFailureCode,
|
||||
} from "./accountFallback.ts";
|
||||
import { errorResponse, unavailableResponse } from "../utils/error.ts";
|
||||
import { recordComboIntent, recordComboRequest, getComboMetrics } from "./comboMetrics.ts";
|
||||
@@ -1674,6 +1676,11 @@ export async function handleComboChat({
|
||||
profile
|
||||
);
|
||||
|
||||
// Trigger shared provider circuit breaker for 5xx errors and connection failures
|
||||
if (isProviderFailureCode(result.status)) {
|
||||
recordProviderFailure(provider, log);
|
||||
}
|
||||
|
||||
// Check if this is a transient error worth retrying on same model
|
||||
const isTransient =
|
||||
!isStreamReadinessTimeout && [408, 429, 500, 502, 503, 504].includes(result.status);
|
||||
|
||||
@@ -330,7 +330,7 @@ export function openaiToOpenAIResponsesRequest(
|
||||
const msg = toRecord(messageValue);
|
||||
const role = toString(msg.role);
|
||||
|
||||
if (role === "system") {
|
||||
if (role === "system" || role === "developer") {
|
||||
if (!hasSystemMessage) {
|
||||
result.instructions = typeof msg.content === "string" ? msg.content : "";
|
||||
hasSystemMessage = true;
|
||||
|
||||
@@ -14,7 +14,7 @@ test("system sidebar items place logs before health", () => {
|
||||
assert.ok(systemSection, "expected system sidebar section to exist");
|
||||
assert.deepEqual(
|
||||
systemSection.items.map((item) => item.id),
|
||||
["logs", "health", "settings"]
|
||||
["logs", "audit", "webhooks", "health", "settings"]
|
||||
);
|
||||
});
|
||||
|
||||
@@ -42,14 +42,14 @@ test("primary sidebar items place limits after cache", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("sidebar visibility drops stale audit entries from saved settings", () => {
|
||||
test("sidebar visibility drops stale entries from saved settings", () => {
|
||||
const allSidebarItemIds = sidebarVisibility.SIDEBAR_SECTIONS.flatMap((section) =>
|
||||
section.items.map((item) => item.id)
|
||||
);
|
||||
|
||||
assert.equal(sidebarVisibility.HIDEABLE_SIDEBAR_ITEM_IDS.includes("audit"), false);
|
||||
assert.equal(allSidebarItemIds.includes("audit"), false);
|
||||
assert.deepEqual(sidebarVisibility.normalizeHiddenSidebarItems(["audit", "logs"]), ["logs"]);
|
||||
assert.equal(sidebarVisibility.HIDEABLE_SIDEBAR_ITEM_IDS.includes("auto-combo"), false);
|
||||
assert.equal(allSidebarItemIds.includes("auto-combo"), false);
|
||||
assert.deepEqual(sidebarVisibility.normalizeHiddenSidebarItems(["auto-combo", "logs"]), ["logs"]);
|
||||
});
|
||||
|
||||
test("help sidebar exposes changelog after docs and issues", () => {
|
||||
@@ -80,16 +80,11 @@ test("legacy dashboard routes redirect to their consolidated surfaces", async ()
|
||||
join(repoRoot, "src/app/(dashboard)/dashboard/auto-combo/page.tsx"),
|
||||
"utf8"
|
||||
);
|
||||
const auditPage = await readFile(
|
||||
join(repoRoot, "src/app/(dashboard)/dashboard/audit/page.tsx"),
|
||||
"utf8"
|
||||
);
|
||||
const usagePage = await readFile(
|
||||
join(repoRoot, "src/app/(dashboard)/dashboard/usage/page.tsx"),
|
||||
"utf8"
|
||||
);
|
||||
|
||||
assert.match(autoComboPage, /redirect\("\/dashboard\/combos\?filter=intelligent"\)/);
|
||||
assert.match(auditPage, /redirect\("\/dashboard\/logs\?tab=audit-logs"\)/);
|
||||
assert.match(usagePage, /redirect\("\/dashboard\/logs"\)/);
|
||||
});
|
||||
|
||||
@@ -3,7 +3,6 @@ import assert from "node:assert/strict";
|
||||
import {
|
||||
validateBody,
|
||||
translatorDetectSchema,
|
||||
translatorSaveSchema,
|
||||
translatorSendSchema,
|
||||
translatorTranslateSchema,
|
||||
cliSettingsEnvSchema,
|
||||
@@ -28,22 +27,6 @@ test("translatorSendSchema rejects empty body object", () => {
|
||||
assert.equal(validation.success, false);
|
||||
});
|
||||
|
||||
test("translatorSaveSchema rejects unsupported file name", () => {
|
||||
const validation = validateBody(translatorSaveSchema, {
|
||||
file: "random.txt",
|
||||
content: "ok",
|
||||
});
|
||||
assert.equal(validation.success, false);
|
||||
});
|
||||
|
||||
test("translatorSaveSchema rejects non-string content", () => {
|
||||
const validation = validateBody(translatorSaveSchema, {
|
||||
file: "1_req_client.json",
|
||||
content: { raw: true },
|
||||
});
|
||||
assert.equal(validation.success, false);
|
||||
});
|
||||
|
||||
test("translatorTranslateSchema requires explicit step", () => {
|
||||
const validation = validateBody(translatorTranslateSchema, {
|
||||
provider: "openai",
|
||||
|
||||
Reference in New Issue
Block a user