From 9f5be229b8a554efc1b20415ed8fcc8a146d866e Mon Sep 17 00:00:00 2001 From: Austin Liu <193228693+Dingding-leo@users.noreply.github.com> Date: Tue, 28 Jul 2026 00:00:01 +0930 Subject: [PATCH] Train 1D: merge via --admin on .113 validation Squash merge from local merge-train (Hard Rule owner-approved). Tip 029cdf4215cf465f0e1716ac9f84a84692b1e881 validated on 192.168.0.113: 26631/26653 pass. --- open-sse/services/autoCombo/__tests__/autoCombo.test.ts | 6 ++++++ open-sse/services/autoCombo/taskFitness.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/open-sse/services/autoCombo/__tests__/autoCombo.test.ts b/open-sse/services/autoCombo/__tests__/autoCombo.test.ts index 1fefaa6bcf..efeae64bcc 100644 --- a/open-sse/services/autoCombo/__tests__/autoCombo.test.ts +++ b/open-sse/services/autoCombo/__tests__/autoCombo.test.ts @@ -622,6 +622,12 @@ describe("Task Fitness DB Resolution Chain", () => { expect(() => invalidateFitnessCache()).not.toThrow(); }); + it("resolution chain: static table matches longest pattern first (gpt-4o-mini vs gpt-4o)", () => { + // gpt-4o-mini must match "gpt-4o-mini" (0.8) rather than earlier "gpt-4o" (0.9) + const score = getTaskFitness("gpt-4o-mini", "coding"); + expect(score).toBe(0.8); + }); + it("resolution chain: static table takes priority over wildcard for known models", () => { // "claude-sonnet" is in the static table with coding=0.95 // It does NOT match "coder" wildcard because the static table is checked first diff --git a/open-sse/services/autoCombo/taskFitness.ts b/open-sse/services/autoCombo/taskFitness.ts index b0a36c7e90..9bb151a2d0 100644 --- a/open-sse/services/autoCombo/taskFitness.ts +++ b/open-sse/services/autoCombo/taskFitness.ts @@ -303,7 +303,8 @@ export function getModelsDevTierFitness(model: string, taskType: string): number function lookupStaticFitnessTable(normalizedModel: string, normalizedTask: string): number | null { const table = FITNESS_TABLE[normalizedTask] || FITNESS_TABLE.default; - for (const [pattern, score] of Object.entries(table)) { + const entries = Object.entries(table).sort((a, b) => b[0].length - a[0].length); + for (const [pattern, score] of entries) { if (normalizedModel.includes(pattern)) return score; } return null;