mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
* fix(codex): preserve GPT-5.6 reasoning contract * fix(vscode): expose Responses text models * fix(codex): keep GPT-5.6 limits through discovery * fix(ci): extract isUsableChatModel helpers to satisfy complexity ratchet Splitting the supported_endpoints/output_modalities guard clauses into excludesChatAndResponsesEndpoints() / excludesTextOutputModality() drops isUsableChatModel's cyclomatic complexity from 16 to under the ratchet's max of 15 (complexity-ratchets gate: 2057 -> 2056, back at baseline). Behavior is unchanged; existing vscode/codex route tests cover it. Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com> * fix(codex): merge capacity limits conservatively (smaller of live vs pinned wins) Resolve the #7012 catalog-merge policy collision: instead of the pinned GPT-5.6 contract always winning for a fixed set of model ids, capacity limits (inputTokenLimit/outputTokenLimit) now merge via mergeCapacityLimitConservatively — Math.min(pinned, live) when both are present, so OmniRoute never promises more context than the account can actually serve. All other overlapping fields still take the live value unconditionally. Guard tests cover both directions (pinned smaller wins / pinned larger loses) at the route level and via an isolated helper-level unit test. Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com> --------- Co-authored-by: Xiangzhe <xz-dev@users.noreply.github.com> Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
129 lines
4.1 KiB
TypeScript
129 lines
4.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
const familyFirstModelIds =
|
|
await import("../../src/app/api/v1/vscode/[token]/familyFirstModelIds.ts");
|
|
const rawFamilyFirstModelIds =
|
|
await import("../../src/app/api/v1/vscode/raw/[token]/familyFirstModelIds.ts");
|
|
const serviceTierVariants =
|
|
await import("../../src/app/api/v1/vscode/[token]/serviceTierVariants.ts");
|
|
const rawServiceTierVariants =
|
|
await import("../../src/app/api/v1/vscode/raw/[token]/serviceTierVariants.ts");
|
|
const reasoningMetadata = await import("../../src/app/api/v1/vscode/[token]/reasoningMetadata.ts");
|
|
const rawReasoningMetadata =
|
|
await import("../../src/app/api/v1/vscode/raw/[token]/reasoningMetadata.ts");
|
|
|
|
test("vscode raw and tokenized family-first helpers share behavior", () => {
|
|
assert.equal(
|
|
familyFirstModelIds.resolveFamilyFirstPublishedModelId(
|
|
"gpt-5.6-sol__provider_cx__tier_priority"
|
|
),
|
|
"cx/gpt-5.6-sol__tier_priority"
|
|
);
|
|
assert.deepEqual(
|
|
rawFamilyFirstModelIds.getFamilyFirstModelCandidates(
|
|
"cx/gpt-5.6-sol__tier_flex",
|
|
"gpt-5.6-sol"
|
|
),
|
|
familyFirstModelIds.getFamilyFirstModelCandidates("cx/gpt-5.6-sol__tier_flex", "gpt-5.6-sol")
|
|
);
|
|
});
|
|
|
|
test("vscode raw and tokenized service tier helpers share behavior", () => {
|
|
const tokenizedPayload = serviceTierVariants.resolveVscodeServiceTierRequest({
|
|
model: "gpt-5.6-sol__provider_cx__tier_flex",
|
|
});
|
|
const rawPayload = rawServiceTierVariants.resolveVscodeServiceTierRequest({
|
|
model: "gpt-5.6-sol__provider_cx__tier_flex",
|
|
});
|
|
|
|
assert.deepEqual(rawPayload, tokenizedPayload);
|
|
assert.deepEqual(
|
|
serviceTierVariants.expandVscodeServiceTierModels([
|
|
{ id: "cx/gpt-5.6-sol", name: "cx/gpt-5.6-sol", owned_by: "codex" },
|
|
]),
|
|
rawServiceTierVariants.expandVscodeServiceTierModels([
|
|
{ id: "cx/gpt-5.6-sol", name: "cx/gpt-5.6-sol", owned_by: "codex" },
|
|
])
|
|
);
|
|
});
|
|
|
|
test("vscode raw and tokenized reasoning helpers share behavior", () => {
|
|
const reasoningModel = {
|
|
id: "openai/gpt-5-high",
|
|
owned_by: "openai",
|
|
capabilities: { reasoning: true },
|
|
};
|
|
const supportedValues = reasoningMetadata.getReasoningEffortValues(reasoningModel);
|
|
|
|
assert.deepEqual(supportedValues, rawReasoningMetadata.getReasoningEffortValues(reasoningModel));
|
|
assert.equal(
|
|
reasoningMetadata.inferSelectedReasoningEffort(reasoningModel, supportedValues),
|
|
"high"
|
|
);
|
|
assert.deepEqual(
|
|
reasoningMetadata.buildReasoningConfigSchema(["none", "high"], "high"),
|
|
rawReasoningMetadata.buildReasoningConfigSchema(["none", "high"], "high")
|
|
);
|
|
});
|
|
|
|
test("vscode reasoning metadata supports GPT-5.6 Max and Ultra without splitting legacy slugs", () => {
|
|
const sol = {
|
|
id: "cx/gpt-5.6-sol",
|
|
owned_by: "codex",
|
|
capabilities: { reasoning: true },
|
|
};
|
|
const terra = {
|
|
id: "cx/gpt-5.6-terra",
|
|
owned_by: "codex",
|
|
capabilities: { reasoning: true },
|
|
};
|
|
const luna = {
|
|
id: "cx/gpt-5.6-luna",
|
|
owned_by: "codex",
|
|
capabilities: { reasoning: true },
|
|
};
|
|
|
|
assert.deepEqual(reasoningMetadata.getReasoningEffortValues(sol), [
|
|
"low",
|
|
"medium",
|
|
"high",
|
|
"xhigh",
|
|
"max",
|
|
"ultra",
|
|
]);
|
|
assert.deepEqual(reasoningMetadata.getReasoningEffortValues(terra), [
|
|
"low",
|
|
"medium",
|
|
"high",
|
|
"xhigh",
|
|
"max",
|
|
"ultra",
|
|
]);
|
|
assert.deepEqual(reasoningMetadata.getReasoningEffortValues(luna), [
|
|
"low",
|
|
"medium",
|
|
"high",
|
|
"xhigh",
|
|
"max",
|
|
]);
|
|
assert.equal(reasoningMetadata.getDefaultReasoningEffort(sol), "low");
|
|
assert.equal(reasoningMetadata.getDefaultReasoningEffort(terra), "medium");
|
|
assert.equal(reasoningMetadata.getDefaultReasoningEffort(luna), "medium");
|
|
assert.equal(
|
|
reasoningMetadata.inferSelectedReasoningEffort(
|
|
{ ...sol, id: "cx/gpt-5.6-sol-ultra" },
|
|
reasoningMetadata.getReasoningEffortValues(sol)
|
|
),
|
|
"ultra"
|
|
);
|
|
assert.equal(
|
|
reasoningMetadata.getReasoningVariantBaseModelId("cx/gpt-5.6-sol-max"),
|
|
"cx/gpt-5.6-sol"
|
|
);
|
|
assert.equal(
|
|
reasoningMetadata.getReasoningVariantBaseModelId("cx/gpt-5.1-codex-max"),
|
|
"cx/gpt-5.1-codex-max"
|
|
);
|
|
});
|