Repository navigation
fix(license): let a wildcard allowed_features license grant the auto_router feature - #41684
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c2fbb11. Configure here.
fix(license): backport #41684 to stable/1.101.x so a wildcard license grants auto_router
fix(license): backport the wildcard license auto_router grant to rc/1.102.0 (#41684)
…router feature Backport of BerriAI#41684 to rc/1.102.0. Cherry-picked from c2fbb11 (litellm_wildcard_license_auto_router).
TLDR
Problem this solves:
allowed_features: ["*"], meaning every featureauto_routerentryHow it solves it:
LicenseCheck.grants_featuretreats a*entry as granting every featureauto_router_capability_limitgoes through it, so["*"]lifts the limitUser Flow
Before: an enterprise operator upgrading to v1.101.0 with two custom auto-routers cannot start the proxy at all, even though their license covers every feature
LITELLM_LICENSEto their enterprise key, whose decoded payload reads"allowed_features": ["*"], and keep a config.yaml with twoauto_router/complexity_routerdeployments that each define their owntier_definitionslitellm --config config.yaml)ValueError: config.yaml model_list: At most 1 auto-router(s) with operator-defined tier_definitions or an operator-written classifier prompt can be registered but this would make 2. ... A LiteLLM license with the 'auto_router' feature lifts the limit.and the process exitsAfter: the same operator starts the proxy and both routers serve traffic
LITELLM_LICENSEto the same enterprise key ("allowed_features": ["*"]) and keep the same config.yaml with two custom auto-routerslitellm --config config.yaml)"I'm alive!""allowed_features": ["*"]"model": "support-router"and again with"model": "engineering-router"each return 200 with a real completionRelevant issues
Affected release
regression in v1.101.0 (first in v1.101.0-rc.1, from #39674 on top of #39468; v1.100.x is not affected)
Linear ticket
Resolves LIT-8019
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Every leg is a live proxy booted from a detached worktree at the named commit with its own venv and 2 uvicorn workers on a random free port. The config.yaml legs run with no database; the notes at the end cover the database write path. The license is read from the
LITELLM_LICENSEenv var by each worker on its own, so there is no state shared between workers to cross-check, and each chat request is sent twice. The routers call OpenAI for real (gpt-5.4-miniclassifies and answers the easy tier,gpt-5.6the hard one). The three license keys are offline-signed test keys that differ only inallowed_features; their payloads carrymax_users: 100,max_teams: 5, and an expiry of 2027-07-06. Chat responses are trimmed with jq to the model, the content, and the token countconfig.yaml, the same file on every leg:The customer's config trips the limit that #39674 added on top of the
auto_routerfeature check from #39468, and both first shipped in v1.101.0-rc.1. The wildcard license across that regression, each row a separate live proxy:Before (1dd4c13)
Wildcard license (
"allowed_features": ["*"])Start the proxy; startup aborts in every worker and nothing ever serves
GET /health/liveliness gets no answer
License naming the feature (
"allowed_features": ["auto_router"])Start the proxy; both workers come up and it serves traffic
GET /health/liveliness returns 200
GET /health/license returns 200
POST /v1/chat/completions with
"model": "support-router", sent twice; both return 200 with a real completionPOST /v1/chat/completions with
"model": "engineering-router", sent twice; both return 200 with a real completionLicense with other features only (
"allowed_features": ["sso", "audit_logs"])Start the proxy; startup aborts in every worker and nothing ever serves
GET /health/liveliness gets no answer
After (c2fbb11)
Wildcard license (
"allowed_features": ["*"])Start the proxy; both workers come up and it serves traffic
GET /health/liveliness returns 200
GET /health/license returns 200
POST /v1/chat/completions with
"model": "support-router", sent twice; both return 200 with a real completionPOST /v1/chat/completions with
"model": "engineering-router", sent twice; both return 200 with a real completionLicense naming the feature (
"allowed_features": ["auto_router"])Start the proxy; both workers come up and it serves traffic
GET /health/liveliness returns 200
GET /health/license returns 200
POST /v1/chat/completions with
"model": "support-router", sent twice; both return 200 with a real completionPOST /v1/chat/completions with
"model": "engineering-router", sent twice; both return 200 with a real completionLicense with other features only (
"allowed_features": ["sso", "audit_logs"])Start the proxy; startup aborts in every worker and nothing ever serves
GET /health/liveliness gets no answer
Notes from the run:
/health/licenseshows["*"]verbatim on every leg; unchanged hereThe same gate guards
POST /model/new, so both sides were also booted with their own Postgres (store_model_in_db: true, 2 workers, wildcard license unless stated) and the two routers were posted instead of read from config.yaml:POST /model/new: 403 before, 200 after/v1/modelslists a new router after ~35s; pre-existing, unchangedType
🐛 Bug Fix
Caveats (if any)
Low
*entry is a wildcard; glob patterns likeauto_*still match nothing*, so nothing in the field uses patternsallowed_featuresverbatim, so a wildcard license still shows["*"]thereallowed_featuresis read as a one-item list, the same way GET /health/license reports itllm_translation_testingandlitellm_utils_testing: the minimax-m3 vision flag from chore(prices): sync Together AI prices: 6 models, 6 deprecated [sync failed: Google Gemini] #41570, fixed on main by test(fireworks_ai): stop pinning vision support on minimax-m3 #41627osv-scan: soupsieve 2.8.4 in uv.lock, bumped by build(deps): bump soupsieve from 2.8.4 to 2.9.2 #41679ocr_testing: red across branches since refactor(ocr): mirror Python provider layout and preserve tests #41550; a rerun failed the same wayFinal Attestation
Note
Low Risk
Narrow license-gating fix for airgapped signed payloads; API-verified licenses without feature lists behave unchanged, and only expands entitlement for licenses that already include
*.Overview
Fixes a v1.101.0 regression where enterprise licenses with
allowed_features: ["*"]did not lift the auto-router customization cap, so proxies with multiple custom auto-routers failed startup even though the license grants all features.Adds
LICENSE_ALL_FEATURES("*") andLicenseCheck.grants_feature, which treats a*entry inallowed_features(list or bare string) as granting any named feature.auto_router_capability_limitnow delegates togrants_feature("auto_router")instead of checking only for the literalauto_routerstring.Tests cover wildcard list/scalar payloads, signed licenses with
["*"], and licenses that name other features withoutauto_routeror*.Reviewed by Cursor Bugbot for commit c2fbb11. Bugbot is set up for automated code reviews on this repo. Configure here.