Skip to content

[codex] Keep mode-pack weights consistent in auto fallback ranking - #7008

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.49from
KooshaPari:codex/modepack-consistency-v2
Jul 18, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.49from
KooshaPari:codex/modepack-consistency-v2

Conversation

@KooshaPari

Copy link
Copy Markdown
Contributor

Summary

  • resolve valid auto-combo modePack values in the shared config parser
  • use identical effective weights for initial provider selection and scored fallback ordering
  • add focused precedence coverage for ship-fast

Why

selectAutoProvider() applies modePack, while fallback ranking previously received raw/default weights. That could select a provider under one policy and rank fallbacks under another.

Validation

  • node --import tsx/esm --test tests/unit/combo-auto-config-split.test.ts
  • npx --yes --package prettier prettier --check open-sse/services/combo/autoConfig.ts tests/unit/combo-auto-config-split.test.ts

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@diegosouzapw
diegosouzapw changed the base branch from release/v3.8.47 to release/v3.8.48 July 13, 2026 05:04
@diegosouzapw
diegosouzapw changed the base branch from release/v3.8.48 to release/v3.8.49 July 13, 2026 21:57
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks for tracking this down — the inconsistency between selectAutoProvider()'s weights and scoreAutoTargets()'s fallback-ranking weights is real, and your fix for the combo's own stored modePack is correct (verified: node --import tsx/esm --test tests/unit/combo-auto-config-split.test.ts — all 6 pass, plus the wider auto-strategy/auto-scoring suite — 22/22 pass, no regressions).

One gap though: this doesn't fully close the loop. resolveAutoStrategyOrder() also supports a per-request X-OmniRoute-Mode header override (resolveRequestModePack) that can pick a different mode pack than the combo's stored config for that single request. selectAutoProvider() correctly picks up that override (it re-derives weights from the effective modePack internally), but scoreAutoTargets() still gets the weights value straight from parseAutoConfig(), which only knows the stored modePack — so the same "select under one policy, rank fallbacks under another" bug your PR describes still happens whenever a request overrides the mode. I confirmed this with a quick probe: stored modePack quality-first + request header fast → selection uses ship-fast weights, but scoreAutoTargets ranks fallbacks with quality-first weights.

Could you extend the same fix to recompute weights from the effective (post-override) modePack in resolveAutoStrategy.ts (after the modePack = requestModePack.override ? ... : configModePack line), and add a regression test for the override case alongside your ship-fast precedence test? Happy to push that small addition into your branch ourselves if you'd rather not — just let us know. Nice, focused catch either way.

…ights

parseAutoConfig() already resolves `weights` from a combo's own STORED
modePack, but resolveAutoStrategyOrder() also supports a per-request
X-OmniRoute-Mode header override (cheaper-inference#6024/cheaper-inference#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>
@diegosouzapw
diegosouzapw marked this pull request as ready for review July 18, 2026 18:15
@diegosouzapw
diegosouzapw self-requested a review as a code owner July 18, 2026 18:15
@diegosouzapw
diegosouzapw merged commit 2cbb47d into cheaper-inference:release/v3.8.49 Jul 18, 2026
12 checks passed
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks @KooshaPari! Merged into release/v3.8.49 after combined merge-train validation. We resolved the stale .mergify.yml against the tip's queue config and decomposed the over-threshold helpers inside your branch — you stay author throughout.

@diegosouzapw diegosouzapw mentioned this pull request Jul 23, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…heaper-inference#7008)

* 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 (cheaper-inference#6024/cheaper-inference#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>
@KooshaPari
KooshaPari deleted the codex/modepack-consistency-v2 branch August 13, 2026 06:53
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…heaper-inference#7008)

* 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 (cheaper-inference#6024/cheaper-inference#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants