bug: cover list_models tolerance for stale replica uids - #5168
Merged
qinxuye merged 3 commits intoJul 28, 2026
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds a new test file xinference/core/tests/test_list_models.py to verify that list_models correctly drops stale model UIDs lacking replica information and returns healthy models. The feedback suggests improving code readability by adding type annotations to DummySupervisor and making the test assertions more robust by verifying the exact size of the returned dictionary.
OliverBryant
force-pushed
the
test/list-models-stale-uid-5167
branch
from
July 13, 2026 03:52
4da5b92 to
963a3e1
Compare
OliverBryant
force-pushed
the
test/list-models-stale-uid-5167
branch
from
July 13, 2026 04:23
963a3e1 to
80e95d4
Compare
Collaborator
Author
|
/gemini review |
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…orbitsai#5167) A failed model launch (e.g. vLLM engine core init failure) can leave a worker reporting a replica uid the supervisor no longer tracks in _model_uid_to_replica_info. Before xorbitsai#5087 this raised a bare KeyError from list_models, so GET /v1/models returned 500 and hid all healthy models. Add regression tests asserting list_models drops the stale, un-tracked uid instead of raising, and still lists healthy models with the correct replica count.
Extend the list_models regression suite to the multi-worker cache fallback path: when one worker's list_models() times out or crashes, the supervisor must serve that worker's last cached result and still merge healthy workers, and a worker that fails before ever caching must not break the healthy listing. Disabling the _fetch_one fallback makes the cache test fail.
Two changes on main broke the fixtures:
- list_models now reads _worker_model_gpu_memory to surface per-model
GPU memory in /v1/models; DummySupervisor must provide it.
- build/parse_replica_model_uid switched to a reserved '-rep{n}' suffix
(xorbitsai#5198) so names like 'llama-2' are no longer ambiguous. Build replica
uids via build_replica_model_uid instead of hardcoding '-0', so the
fixtures track the format automatically.
OliverBryant
force-pushed
the
test/list-models-stale-uid-5167
branch
from
July 27, 2026 07:23
52014d3 to
4f7a14c
Compare
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.
What
Adds regression tests for
SupervisorActor.list_modelsso a failed model launch can no longer breakGET /v1/models.Why (#5167)
When a model launch fails during engine init (e.g. vLLM
Engine core initialization failed), the worker may still report the replica uid viaworker.list_models()while the supervisor has already dropped its_model_uid_to_replica_infoentry. Before #5087,list_modelslooked that uid up directly and raised a bareKeyError('qwen3.5'), soGET /v1/modelsreturned 500 and every healthy model disappeared from the list.#5087 (commit
40e52832c) already fixed the behavior by skipping stale, un-tracked uids, but the path had no test coverage. These tests lock that behavior in.Tests
test_list_models_drops_stale_uid_without_replica_info— worker reports both a healthyqwen3-0and a staleqwen3.5-0left by a failed launch; asserts the stale uid is dropped (noKeyError) andqwen3is still listed with the correct replica count. Reverting the fix: drop stale running models without replica info in supervisor.list_models #5087 guard makes this test fail withKeyError.test_list_models_returns_healthy_models— multi-replica happy-path baseline.Both pass;
pre-commit(black/flake8/isort/mypy/codespell) is green.