Repository navigation
fix(auto): subscription fail-closed, neutral unpriced cost, thrifty rung order (#15546) - #15852
Merged
Merged
Conversation
Contributor
CI Coverage Report
Coverage artifact was not available for this run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #15546 — complements #15813 (which fixes defect #1, RulesStrategy ignoring weights). This PR covers the plan's follow-ups; it does not close the issue.
Root cause and fixes (one commit each)
auto/subscriptionfail-open: when the subscription pool was empty,expandAutoComboCandidatePoolsaw nocandidatePool/modelsand widened to every active provider's full catalog (paid models included). The virtual subscription combo now carriesautoConfig.failClosedWhenEmpty, and the expander returns the (empty) targets unchanged.combo.tsdefaulted unknown models to $1/M, which min-max scoring reads as almost free next to $20-40/M frontier models. Newcombo/candidateCost.ts: pricing lookup retries the bare model name for namespaced ids; genuinely unpriced models take the median blended cost of the priced models in the pool (neutral), falling back to 1 only when nothing is priced. No pricing rows were added: the plan named claude-opus-5-5 / sonnet-5-5 / antigravity but I had no citable source price, so none were invented.:thriftyrung order: scoring re-sorted the rung-ordered pool, so a metered model could outrank a plan-included one. Virtualthriftycombos carryautoConfig.preserveRungOrder;resolveAutoStrategyrestores the incoming (rung) order after scoring viacombo/rungOrder.ts. Trade-off: within a rung the pool's incoming order is kept rather than the score order (rung boundaries are not carried on resolved targets).Tests (TDD)
tests/unit/issue-15546-subscription-fail-closed.test.ts— RED before (21 !== 0), GREEN after.tests/unit/issue-15546-unpriced-neutral-cost.test.ts— RED before (module absent / old flat $1 default), GREEN (5/5).tests/unit/issue-15546-thrifty-rung-order.test.ts— GREEN (3/3); covers the order helper and the flag only. TheresolveAutoStrategywiring has no end-to-end test (heavy deps).Gates run
check-file-size, check-complexity, check-cognitive-complexity, typecheck:core, check:open-sse-typecheck, eslint (with suppressions) on changed files, prettier, husky pre-commit hooks.