fix(model-discovery): ingest capabilities.effort_tiers for synced models (#9160)

Refs: base-red #9737
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-08-08 12:03:24 -03:00
committed by GitHub
parent a6b3b4f57a
commit 2ed487583b
3 changed files with 58 additions and 1 deletions

View File

@@ -0,0 +1 @@
- fix(model-discovery): ingest capabilities.effort_tiers for synced models (#9160)

View File

@@ -112,7 +112,8 @@ function parseEffortList(rawList: unknown): string[] | undefined {
.map((entry) => {
const entryParsed = effortEntrySchema.safeParse(entry);
if (!entryParsed.success) return null;
const raw = typeof entryParsed.data === "string" ? entryParsed.data : entryParsed.data.effort;
const raw =
typeof entryParsed.data === "string" ? entryParsed.data : entryParsed.data.effort;
return raw.length > 0 ? normalizeSupportedEffort(raw) : null;
})
.filter((effort): effort is string => effort !== null)
@@ -144,6 +145,16 @@ export function detectSupportedThinkingEfforts(record: JsonRecord): string[] | u
}
}
// #9160: fall back to `capabilities.effort_tiers` before the legacy fields.
// OmniRoute's own catalog surfaces effort tiers inside `capabilities.effort_tiers`,
// which the existing `parseEffortList` already handles (string arrays).
const capabilitiesRecord = asRecord(record.capabilities);
const capabilitiesParsed = effortListSchema.safeParse(capabilitiesRecord.effort_tiers);
if (capabilitiesParsed.success) {
const fromCapabilities = parseEffortList(capabilitiesRecord.effort_tiers);
if (fromCapabilities) return fromCapabilities;
}
// #8347: fall back to `supported_reasoning_levels`, then `thinking.levels` — in that
// order, per the regression guard for #7694 (the flat field and `reasoning.supported_efforts`
// both take precedence over these two and are handled above / by the caller).

View File

@@ -42,6 +42,26 @@ test("non-GPT-5.6 models still get max downgraded to xhigh", () => {
)
);
assert.equal(translated.reasoning_effort, "xhigh");
<<<<<<< HEAD
});
// ─────────────────────────────────────────────────────────────────────
// PR #9142 — Anthropic top-level `system` prompts must trigger background detection
// ─────────────────────────────────────────────────────────────────────
const { getBackgroundTaskReason, setBackgroundDegradationConfig } =
await import("../../open-sse/services/backgroundTaskDetector.ts");
test("#9142 Anthropic top-level system prompts must trigger background detection", () => {
setBackgroundDegradationConfig({ enabled: true });
assert.equal(
getBackgroundTaskReason({
system: "Generate a title for this conversation",
messages: [{ role: "user", content: "hello" }],
}),
"system_prompt_pattern"
);
});
=======
// #9140 — VS Code routes filter out built-in auto models
const { isUsableChatModel } = await import(
@@ -59,3 +79,28 @@ test("#9140 VS Code listing must accept built-in auto routing entries", () => {
false,
"operator-created combo should still be rejected"
);
>>>>>>> origin/release/v3.8.50
});
// ── #9160 model discovery: capabilities.effort_tiers ────────────────────────
// #9160: model discovery must ingest capabilities.effort_tiers
test("#9160 model discovery must ingest capabilities.effort_tiers", () => {
assert.deepEqual(
detectSupportedThinkingEfforts({
capabilities: { effort_tiers: ["low", "medium", "high", "xhigh"] },
}),
["low", "medium", "high", "xhigh"]
);
});
test("#9160 capabilities.effort_tiers with duplicate and synonym", () => {
assert.deepEqual(
detectSupportedThinkingEfforts({
capabilities: { effort_tiers: ["low", "low", "max"] },
}),
["low", "xhigh"]
);