mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
Landed with the design call resolved per the owner's pick — **option 1**: the synced store is now endpoint-agnostic (persistDiscoveredModels and managedModelImport no longer drop non-chat models at write time), and chat selectability moved to read time (auto-pool expansion in autoStrategy applies filterChatSelectableModels; the models-route projection already had its chatOnly filter). Your discovery test now passes end-to-end (3/3): /api/show capabilities persist per connection and image/embedding requests route through the advertising host. Reconciliation notes: conflicted areas merged onto the current tip (adobe discovery import, requestedModel preflight signature, resolvedProvider fast-path coexists with the synced-route override — explicit resolution wins); carried base-red drains (#10055 memoization, #11071 test variants) dropped as already-landed; the managed-model-import exclusion test was propagated to the new contract (image/video models persist; the read filter still hides them from chat pickers — pinned by a new assertion). Full battery: 205/206 focused (the one red is a confirmed periodic-timer timing flake on the loaded devbox — 20/20 isolated), autoCombo vitest 30/30, combo suites 46/46, gates + typecheck clean. Thank you @yourspraveen — the capability probe + routing design was right; it just needed the store contract opened up. Fixes #11087.
39 lines
1.9 KiB
TypeScript
39 lines
1.9 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { getModelTargetFormat } from "../../open-sse/config/providerModels.ts";
|
|
import { resolveChatCoreTargetFormat } from "../../open-sse/handlers/chatCore/targetFormat.ts";
|
|
|
|
// Regression: #8835 tagged gpt-5.6-* with targetFormat "openai-responses" in the
|
|
// ghe-copilot catalog. getModelTargetFormat falls back to getGlobalModel() when
|
|
// the provider's own catalog lacks the model id, importing the DECLARING
|
|
// provider's endpoint semantics into every other provider serving the same id.
|
|
// command-code's chat-shaped executor then received a
|
|
// Responses-format body (input, not messages) and shipped `messages: []`
|
|
// upstream — upstream rejected with "Invalid prompt: messages must not be empty"
|
|
// (502). Model-level targetFormat is provider-scoped: it must not leak.
|
|
test("model-level targetFormat does not leak across provider catalogs", () => {
|
|
// command-code serves gpt-5.6-luna over its chat-shaped provider endpoint
|
|
assert.equal(getModelTargetFormat("cmd", "gpt-5.6-luna"), null);
|
|
// raw provider id form behaves identically (alias resolution)
|
|
assert.equal(getModelTargetFormat("command-code", "gpt-5.6-luna"), null);
|
|
// the declaring provider (ghe-copilot) keeps its Responses routing
|
|
assert.equal(getModelTargetFormat("gh", "gpt-5.6-luna"), "openai-responses");
|
|
assert.equal(getModelTargetFormat("ghe-copilot", "gpt-5.6-luna"), "openai-responses");
|
|
// unrelated models are unaffected
|
|
assert.equal(getModelTargetFormat("cmd", "kimi-k2"), null);
|
|
});
|
|
|
|
test("chat completions to command-code gpt-5.6-luna resolve to chat format", () => {
|
|
const resolved = resolveChatCoreTargetFormat({
|
|
provider: "command-code",
|
|
resolvedModel: "gpt-5.6-luna",
|
|
apiFormat: undefined,
|
|
sourceFormat: "openai",
|
|
customModelTargetFormat: undefined,
|
|
providerSpecificData: null,
|
|
});
|
|
assert.equal(resolved.alias, "cmd");
|
|
assert.equal(resolved.targetFormat, "openai");
|
|
});
|