From b1fdfd5ea4e0729388e987cae82bde109e3581e5 Mon Sep 17 00:00:00 2001 From: Jacob Stoner Date: Mon, 24 Aug 2026 13:15:52 -0400 Subject: [PATCH] fix(sse): preserve auto-selected first target (#11399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Validado em lote combinado (batch-0824f, junto de #11400/#11402/#11407) contra o tip de release/v3.8.50: typecheck:core limpo, file-size/changelog/complexity/cognitive-complexity OK (abaixo do baseline), 56/56 testes focados passando incluindo os deste PR (tests/unit/8370-priority-affinity-reorder.test.ts). Aditivo e coerente: protege a ordem já decidida pelo `auto` contra reordenação pelo pós-processamento de prompt-cache-affinity — mesma linha do #11400. Obrigado pela contribuição! --- open-sse/services/combo/promptCacheAffinity.ts | 1 + tests/unit/8370-priority-affinity-reorder.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/open-sse/services/combo/promptCacheAffinity.ts b/open-sse/services/combo/promptCacheAffinity.ts index f7675f0675..0739b59af3 100644 --- a/open-sse/services/combo/promptCacheAffinity.ts +++ b/open-sse/services/combo/promptCacheAffinity.ts @@ -290,6 +290,7 @@ export function shouldProtectOriginalFirst( return ( stickyStuck || autoUsedExplicitRouter || + strategy === "auto" || strategy === "quota-share" || strategy === "weighted" || strategy === "priority" || diff --git a/tests/unit/8370-priority-affinity-reorder.test.ts b/tests/unit/8370-priority-affinity-reorder.test.ts index ce967a13d8..ad9a4c59cd 100644 --- a/tests/unit/8370-priority-affinity-reorder.test.ts +++ b/tests/unit/8370-priority-affinity-reorder.test.ts @@ -139,8 +139,8 @@ test("BUG #8370: priority combo keeps its declared model-1-first order despite c ); }); -test("shouldProtectOriginalFirst covers priority, fill-first, and lkgp", () => { - for (const strategy of ["priority", "fill-first", "lkgp"]) { +test("shouldProtectOriginalFirst covers auto, priority, fill-first, and lkgp", () => { + for (const strategy of ["auto", "priority", "fill-first", "lkgp"]) { assert.equal( shouldProtectOriginalFirst(false, false, strategy), true,