Repository navigation
fix(router): evict stale global pattern_router entries on upsert/delete - #39664
yassin-berriai merged 4 commits into
Conversation
upsert_deployment and delete_deployment cleaned team_pattern_routers but left
the outgoing deployment in the global pattern_router, so wildcard requests kept
round-robining onto the stale entry after a PATCH /model/{id}/update.
Fixes #29064
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 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:
|
|
|
…info name Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…us commit Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Greptile SummaryThis PR keeps global wildcard routing state synchronized when deployments are updated or deleted.
Confidence Score: 5/5The PR appears safe to merge, with the global wildcard cleanup now matching the existing deployment lifecycle. The global pattern router is always initialized, normal upserts re-register the replacement deployment, failed upserts restore the prior deployment, and the regression test covers both replacement and deletion.
|
| Filename | Overview |
|---|---|
| litellm/router.py | Extends deployment removal to evict matching entries from the global pattern router, aligning it with existing team-router cleanup. |
| tests/test_litellm/test_router.py | Adds focused, network-free regression coverage for global wildcard replacement and deletion. |
Reviews (1): Last reviewed commit: "fix(router): evict stale global pattern_..." | Re-trigger Greptile
…ttern_router_cleanup Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
5dd3fdb
into
litellm_internal_staging
TLDR
Problem this solves:
How it solves it:
User Flow
Before: an admin fixes a broken wildcard model but half the requests still fail until the pods restart
model_name: "openai/*"and a mistypedlitellm_params.model: "openai/openai/*"model: "openai/gpt-5.2"and get a 400invalid model IDbecause of the double prefixlitellm_params.model: "openai/*"and get a 200invalid model IDAfter: the same fix takes effect fully
model_name: "openai/*"and a mistypedlitellm_params.model: "openai/openai/*"model: "openai/gpt-5.2"and get a 400invalid model IDbecause of the double prefixlitellm_params.model: "openai/*"and get a 200Relevant issues
Fixes #29064
Linear ticket
Resolves LIT-3412
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
Earlier fixes (#29601 and 836bf08) covered
team_pattern_routers; the globalpattern_routerwas the remaining gap. Live proxy started withDISABLE_SCHEMA_UPDATE=True uv run litellm --config litellm/proxy/dev_config.yaml --port 4000(STORE_MODEL_IN_DB=True, real OpenAI key), same steps both times:Before (a5b3bc8)
openai/openai/*:model_id=3527f9b3-8f53-4196-b7bd-25a514e33d46openai/gpt-5.2:400(double prefix, expected)openai/*:200400 200 200 200 400 200 400 200 200 400200After (e5facac)
openai/openai/*:model_id=cf24e223-ed0d-4032-8766-5b538719981fopenai/gpt-5.2:400(double prefix, expected)openai/*:200200 200 200 200 200 200 200 200 200 200200Type
🐛 Bug Fix
Caveats (if any)
Final Attestation
Link to Devin session: https://app.devin.ai/sessions/22761ace217b49f8b907cc2c13033fa3
Open in Devin Desktop: https://app.devin.ai/desktop/session/22761ace217b49f8b907cc2c13033fa3?variant=devin
Requested by: @yassin-berriai