mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-06 15:22:12 +03:00
* chore(release): open v3.8.13 development cycle Bump 3.8.12 → 3.8.13 across package.json, lockfile, electron/, open-sse/, and docs/reference/openapi.yaml; add the [3.8.13] cycle placeholder to the root CHANGELOG and the 41 i18n mirrors. Integration branch for the v3.8.13 cycle — fixes/features land here via per-issue PRs and it merges to main at release time. * fix(ci): skip auto-deploy when VPS host is unreachable from the runner (#3299) Integrated into release/v3.8.13 * fix(dev): auto-rebuild better-sqlite3 on Node ABI mismatch at dev startup (#3301) Integrated into release/v3.8.13 * feat(api): accept path-scoped API keys on client API routes (#3300) Integrated into release/v3.8.13 * fix(sse): harden against empty responses causing Copilot Chat failures (#3297) Integrated into release/v3.8.13 * fix(api): remove Completions.me rickroll provider (discussion #3293) (#3302) Integrated into release/v3.8.13 * fix(opencode-provider): extract contextLength from live model catalog (#3298) Integrated into release/v3.8.13 * feat(web-cookie): self-service login infrastructure + auto-refresh daemon (#3292) Integrated into release/v3.8.13 * docs(changelog): record the v3.8.13 PRs merged this round (#3292/#3300/#3297/#3298/#3301/#3302/#3299) * fix(auth): harden URL token extraction — drop query-string fallback, gate to client routes (security follow-up to #3300) (#3309) Security follow-up to #3300 — integrated into release/v3.8.13 * docs: rename resolve-issues → review-issues skill references * fix(dashboard): keep no-auth providers visible under 'Show configured only' (#3290) (#3312) no-auth providers (opencode, duckduckgo-web, theoldllm, veoaifree-web) never create a DB connection row so stats.total stays 0, which the configured-only filter treated as 'unconfigured' and hid them — even though they are always usable and appear unconditionally in /v1/models. filterConfiguredProviderEntries now treats displayAuthType === 'no-auth' as configured. Co-authored-by: uniQta <uniQta@users.noreply.github.com> * fix(cli): resolve update paths relative to script + recursive backup (#3295) (#3313) omniroute update always failed on a global install: - getCurrentVersion() read package.json from process.cwd(), which on a global npm/brew install is the user's working dir, not the package root → null → 'Could not determine current version'. - createBackup() resolved bin/ from cwd too, and passed the 'cli' directory to copyFileSync → EISDIR, swallowed by the catch → 'Failed to create backup'. Both now resolve package.json/bin relative to the script via import.meta.url, and the backup uses cpSync({recursive:true}) so the cli/ directory is copied. Co-authored-by: uniQta <uniQta@users.noreply.github.com> * fix(theoldllm): read upstream body once to avoid [502] body-already-read (#3296) (#3314) On the cached-token path the executor never enters the refresh branch, so the same upstream Response was read with .text() twice (token-rejection check + final body). A Response body is single-use, so the second read threw 'Body is unusable: Body has already been read', caught and surfaced as [502]. Read the body once into finalBody and only re-read after a token-rejection refetch. Co-authored-by: onizukashonan14-png <onizukashonan14-png@users.noreply.github.com> * fix(sse): strip leaked internal tool envelopes from streaming output (#3311) Integrated into release/v3.8.13 * fix(sse): expose Claude + Gemini budget tiers in the antigravity catalog (#3184) (#3303) Integrated into release/v3.8.13 (#3184) * fix(catalog): compute combo context_length from known targets only (#3304) Integrated into release/v3.8.13 — live contextLength + known-targets combo context (#3298 follow-up) * chore(i18n): add message keys for proxy UI + vscode/ollama endpoint (#3307) Integrated into release/v3.8.13 — i18n message keys for proxy UI + vscode/ollama * feat(dashboard): i18n the proxy settings UI (#3310) Integrated into release/v3.8.13 — i18n the proxy settings UI * feat(api): model catalog enrichment + MCP model-catalog tools (#3306) Integrated into release/v3.8.13 — model catalog enrichment + MCP model-catalog tools, reconciled with #3309 URL-token hardening * test(catalog): align Antigravity preview-alias test with #3303 budget tiers #3303 added the Gemini `-high`/`-low` budget tiers to ANTIGRAVITY_PUBLIC_MODELS (user-callable on the Antigravity OAuth backend, verified via #3184), but did not update the catalog-route test that asserted `antigravity/gemini-3.1-pro-high` must NOT be exposed. The assertion now reflects the intended behavior — the client-visible budget alias IS surfaced — while keeping the legacy `gemini-claude-*` alias keys unexposed. Caught running the full catalog suite on the merged release HEAD (the #3303 round only ran the antigravity-aliases and usage-hardening files). * docs(changelog): record the 6 PRs merged this review round into v3.8.13 #3306/#3307/#3310 (New Features — VS Code split: catalog+MCP, i18n keys, proxy UI i18n), #3311/#3303/#3304 (Bug Fixes — SSE envelope sanitizer, antigravity budget tiers, combo known-targets context_length). * chore(release): finalize v3.8.13 changelog and cleanup Finalize the v3.8.13 changelog with release date, maintenance notes, and contributor credits. Update MCP docs to reference the correct tool inventory diagram, exclude nested .claude worktrees from ESLint scans, and tighten a response sanitizer type guard. * fix(dashboard): refresh connections after provider auth import (#3320) Integrated into release/v3.8.13 — refresh connections after provider auth import * fix(codex): strip client-only params on native /responses passthrough (#3317) (#3325) A /v1/responses request against the built-in codex/ provider does an openai-responses -> openai-responses passthrough (CodexExecutor.transformRequest returns the body early for _nativeCodexPassthrough). It forwarded client-only fields verbatim and the Codex upstream rejected them with 400 Unsupported parameter: prompt_cache_retention / safety_identifier / user — breaking Factory Droid (which injects all three). The chat-completions path already strips these (base.ts #1884, openai-responses translator #2770) but the passthrough skips translation. Strip the three fields in the shared block before the passthrough return; user is removed unconditionally since Codex /responses always rejects it. Co-authored-by: tycronk20 <tycronk20@users.noreply.github.com> * fix(dashboard): normalize agent-bridge /state response to stop page crash (#3318) (#3326) The Agent Bridge page seeded a well-shaped initialData default then replaced it wholesale with the raw /api/tools/agent-bridge/state response. The route returns { server, agents } but the UI reads { serverState, agentStates, bypassPatterns, mappings }, so serverState became undefined and AgentBridgeServerCard crashed on serverState.running — surfaced as the full-page 'Internal Server Error' boundary (client render error, not a real 5xx). Add a shared normalizeAgentBridgeState() that maps the route shape into the page contract (server.running/certExists -> serverState) and always returns safe defaults (never undefined serverState). Wired into both the SSR loader (page.tsx) and the polling hook. The legacy 'agents' entry shape differs from AgentStateEntry so it is not coerced; full route<->page contract reconciliation (port, upstreamCa, bypassPatterns, mappings, agentStates) is a follow-up. Co-authored-by: tycronk20 <tycronk20@users.noreply.github.com> * docs: VS Code/Ollama endpoints + env & i18n tooling (#3319) Integrated into release/v3.8.13 — VS Code/Ollama docs + env & i18n tooling * feat(provider): test-all endpoint, rate-limit overrides, visibility f… (#3267) Integrated into release/v3.8.13 — provider test-all endpoint, rate-limit overrides, model visibility * feat: auto-combo optimization, playground model dropdown, only-configured toggle (#3322) Integrated into release/v3.8.13 — auto-combo candidate expansion + playground dropdown + only-configured toggle * feat(api): VS Code Copilot Ollama-compatible BYOK endpoint (#3316) Integrated into release/v3.8.13 — VS Code Copilot Ollama-compatible BYOK endpoint (reconciled with #3306/#3309 auth hardening) * chore(release): document #3320 in the v3.8.13 changelog + contributor credits --------- Co-authored-by: Felipe Almeman <4226997+zhiru@users.noreply.github.com> Co-authored-by: Wilson <pedbookmed@gmail.com> Co-authored-by: Hernan Javier Ardila Sanchez <hjasgr@gmail.com> Co-authored-by: Paijo <14921983+oyi77@users.noreply.github.com> Co-authored-by: uniQta <uniQta@users.noreply.github.com> Co-authored-by: onizukashonan14-png <onizukashonan14-png@users.noreply.github.com> Co-authored-by: tycronk20 <tycronk20@users.noreply.github.com> Co-authored-by: Vinayrnani <vinayrnani@gmail.com>
177 lines
7.5 KiB
TypeScript
177 lines
7.5 KiB
TypeScript
/**
|
|
* Regression tests for issue #2778 — custom openai-compatible-responses-* provider
|
|
* targets fail with 503 when called via combo name.
|
|
*
|
|
* Root cause: when a combo step stores a custom provider node by its internal UUID-
|
|
* prefixed id (e.g. "openai-compatible-responses-d302c75f-..."), getComboModelString()
|
|
* assembles the outbound modelStr as "<uuid-id>/gpt-5.5". getModelInfo() then attempts
|
|
* to match provider nodes using:
|
|
*
|
|
* openaiNodes.find((node) => node.prefix === prefixToCheck)
|
|
*
|
|
* where prefixToCheck is the UUID id, but node.prefix is the user-defined alias
|
|
* (e.g. "flymux"). No match → credential lookup fails → 503.
|
|
*
|
|
* Fix (Option A): match by BOTH node.prefix AND node.id in getModelInfo() so that
|
|
* UUID-prefixed model strings from combo steps still resolve to the correct node.
|
|
*
|
|
* These tests verify:
|
|
* 1. getComboModelString() produces a UUID-prefixed modelStr when providerId is the
|
|
* internal node id (reproduces the exact string from the bug screenshot).
|
|
* 2. The fix is present in src/sse/services/model.ts — node.id is checked alongside
|
|
* node.prefix in both the openai-compatible and anthropic-compatible branches.
|
|
* 3. A UUID-id modelStr that previously fell through to unknown-provider lookup now
|
|
* resolves to the matched node's id when the matching logic is applied.
|
|
*/
|
|
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
import { getComboModelString } from "../../src/lib/combos/steps.ts";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const MODEL_SERVICE_SRC = path.resolve(__dirname, "../../src/sse/services/model.ts");
|
|
|
|
// ── 1. Reproduce the exact model string from the bug screenshot ───────────────
|
|
|
|
const FAKE_UUID_NODE_ID = "openai-compatible-responses-d302c75f-f133-48d3-afa1-066e594e0d29";
|
|
|
|
test("#2778 getComboModelString with UUID-prefixed providerId assembles the UUID-prefixed model string", () => {
|
|
// This is what a combo step looks like when the UI stores the internal node id as
|
|
// providerId — the same scenario that causes the bug.
|
|
const step = {
|
|
kind: "model",
|
|
id: "step-001",
|
|
model: "gpt-5.5",
|
|
providerId: FAKE_UUID_NODE_ID,
|
|
weight: 1,
|
|
};
|
|
|
|
const modelStr = getComboModelString(step);
|
|
// This is the exact problematic string: UUID-prefix/model
|
|
assert.strictEqual(
|
|
modelStr,
|
|
`${FAKE_UUID_NODE_ID}/gpt-5.5`,
|
|
"getComboModelString must build UUID-prefixed modelStr when step.providerId is the internal node id"
|
|
);
|
|
});
|
|
|
|
test("#2778 getComboModelString with user-defined alias prefix produces clean alias/model string", () => {
|
|
// When the step stores the user-defined alias as providerId, the modelStr is clean.
|
|
const step = {
|
|
kind: "model",
|
|
id: "step-002",
|
|
model: "gpt-5.5",
|
|
providerId: "flymux",
|
|
weight: 1,
|
|
};
|
|
|
|
const modelStr = getComboModelString(step);
|
|
assert.strictEqual(modelStr, "flymux/gpt-5.5");
|
|
});
|
|
|
|
// ── 2. Verify the fix is present in getModelInfo ──────────────────────────────
|
|
|
|
test("#2778 getModelInfo in src/sse/services/model.ts matches openai-compatible nodes by node.id", () => {
|
|
const src = fs.readFileSync(MODEL_SERVICE_SRC, "utf8");
|
|
|
|
// The fix must match node.id alongside node.prefix in the openai-compatible branch.
|
|
// The find() call may span multiple lines, so use a multiline-friendly approach:
|
|
// look for the openaiNodes.find block and check that node.id === prefixToCheck appears
|
|
// within a reasonable range after it.
|
|
const openAIFindIndex = src.indexOf("openaiNodes.find(");
|
|
assert.ok(openAIFindIndex !== -1, "openaiNodes.find( must exist in getModelInfo");
|
|
|
|
const snippet = src.slice(openAIFindIndex, openAIFindIndex + 200);
|
|
assert.ok(
|
|
snippet.includes("node.id") && snippet.includes("prefixToCheck"),
|
|
"getModelInfo must match openai-compatible provider nodes by node.id (not only node.prefix) " +
|
|
"so that combo steps storing internal UUID provider ids still resolve correctly (#2778). " +
|
|
`Got: ${snippet.slice(0, 150)}`
|
|
);
|
|
});
|
|
|
|
test("#2778 getModelInfo in src/sse/services/model.ts matches anthropic-compatible nodes by node.id", () => {
|
|
const src = fs.readFileSync(MODEL_SERVICE_SRC, "utf8");
|
|
|
|
const anthropicFindIndex = src.indexOf("anthropicNodes.find(");
|
|
assert.ok(anthropicFindIndex !== -1, "anthropicNodes.find( must exist in getModelInfo");
|
|
|
|
const snippet = src.slice(anthropicFindIndex, anthropicFindIndex + 200);
|
|
assert.ok(
|
|
snippet.includes("node.id") && snippet.includes("prefixToCheck"),
|
|
"getModelInfo must match anthropic-compatible provider nodes by node.id (not only node.prefix) " +
|
|
"so that combo steps storing internal UUID provider ids still resolve correctly (#2778). " +
|
|
`Got: ${snippet.slice(0, 150)}`
|
|
);
|
|
});
|
|
|
|
// ── 3. Verify the matching logic would resolve UUID-id prefixToCheck to the node ─
|
|
|
|
test("#2778 matching logic: node with prefix=flymux and id=UUID-id matches when prefixToCheck is UUID-id", () => {
|
|
const mockNode = {
|
|
id: FAKE_UUID_NODE_ID,
|
|
prefix: "flymux",
|
|
type: "openai-compatible",
|
|
};
|
|
|
|
const prefixToCheck = FAKE_UUID_NODE_ID; // what getModelInfo receives from a combo step
|
|
const nodes = [mockNode];
|
|
|
|
// OLD (broken): only match prefix
|
|
const matchByPrefixOnly = nodes.find((node) => node.prefix === prefixToCheck);
|
|
assert.strictEqual(matchByPrefixOnly, undefined, "Prefix-only match should NOT find the node");
|
|
|
|
// NEW (fixed): match prefix OR id
|
|
const matchByPrefixOrId = nodes.find(
|
|
(node) => node.prefix === prefixToCheck || node.id === prefixToCheck
|
|
);
|
|
assert.ok(matchByPrefixOrId !== undefined, "Prefix-or-id match SHOULD find the node");
|
|
assert.strictEqual(matchByPrefixOrId?.id, FAKE_UUID_NODE_ID);
|
|
});
|
|
|
|
test("#2778 matching logic: node with prefix=flymux and id=UUID-id still matches when prefixToCheck is the alias", () => {
|
|
// Verify backward compatibility — existing behavior with alias prefix still works
|
|
const mockNode = {
|
|
id: FAKE_UUID_NODE_ID,
|
|
prefix: "flymux",
|
|
type: "openai-compatible",
|
|
};
|
|
|
|
const prefixToCheck = "flymux"; // direct call with alias still works
|
|
const nodes = [mockNode];
|
|
|
|
const matchByPrefixOrId = nodes.find(
|
|
(node) => node.prefix === prefixToCheck || node.id === prefixToCheck
|
|
);
|
|
assert.ok(matchByPrefixOrId !== undefined, "Alias-based match must still work after the fix");
|
|
assert.strictEqual(matchByPrefixOrId?.id, FAKE_UUID_NODE_ID);
|
|
});
|
|
|
|
test("custom provider auth lookup search pool maps alias prefixes to internal provider ids", async () => {
|
|
const authSrc = fs.readFileSync(path.resolve(__dirname, "../../src/sse/services/auth.ts"), "utf8");
|
|
|
|
assert.match(
|
|
authSrc,
|
|
/async function getProviderSearchPool\(provider: string\): Promise<string\[]>/,
|
|
"getProviderSearchPool should be async so it can expand custom provider aliases via provider_nodes"
|
|
);
|
|
assert.match(
|
|
authSrc,
|
|
/getProviderNodes\(/,
|
|
"auth lookup should read provider_nodes to map custom prefixes like 78code/micu back to internal provider ids"
|
|
);
|
|
assert.match(
|
|
authSrc,
|
|
/nodePrefix === provider\s*\|\|\s*nodePrefix === canonicalProvider\s*\|\|\s*nodePrefix === canonicalAlias/,
|
|
"auth lookup should match provider node prefixes against the requested alias/canonical provider values"
|
|
);
|
|
assert.match(
|
|
authSrc,
|
|
/searchPool\.add\(nodeId\)/,
|
|
"auth lookup should add the matched custom provider node id into the credential search pool"
|
|
);
|
|
});
|