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.
This commit is contained in:
Austin Liu
2026-07-28 00:00:01 +09:30
committed by GitHub
parent c544c2c117
commit 9f5be229b8
2 changed files with 8 additions and 1 deletions

View File

@@ -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

View File

@@ -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;