mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
* fix(routing): honor modePack weights in combo fallback ranking * fix(routing): make effective post-override modePack drive fallback weights parseAutoConfig() already resolves `weights` from a combo's own STORED modePack, but resolveAutoStrategyOrder() also supports a per-request X-OmniRoute-Mode header override (#6024/#6025) that can select a DIFFERENT mode pack than the one stored on the combo, for that single request only. selectAutoProvider() (engine.ts) already re-derives weights internally from the modePack it receives, so it correctly reacts to the override -- but scoreAutoTargets(), which ranks the fallback tail, had no such re-derivation and only ever saw the stale pre-override weights from parseAutoConfig(). Net effect: a request overriding e.g. "quality-first" to "ship-fast" would select its primary target under ship-fast weights but rank every fallback under quality-first weights -- the identical "select under one policy, rank fallbacks under another" bug this module's original fix (honoring the combo's own stored modePack) set out to close. Recompute `weights` from the effective (post-override) `modePack` right after it's resolved, so both selectAutoProvider and scoreAutoTargets consume the same weight vector. Adds a regression test proving a request-level X-OmniRoute-Mode override produces IDENTICAL fallback-ranking weights to a combo natively configured with that same modePack. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>