Skip to content

bug: cover list_models tolerance for stale replica uids#5168

Open
OliverBryant wants to merge 1 commit into
xorbitsai:mainfrom
OliverBryant:test/list-models-stale-uid-5167
Open

bug: cover list_models tolerance for stale replica uids#5168
OliverBryant wants to merge 1 commit into
xorbitsai:mainfrom
OliverBryant:test/list-models-stale-uid-5167

Conversation

@OliverBryant

Copy link
Copy Markdown
Collaborator

What

Adds regression tests for SupervisorActor.list_models so a failed model launch can no longer break GET /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 via worker.list_models() while the supervisor has already dropped its _model_uid_to_replica_info entry. Before #5087, list_models looked that uid up directly and raised a bare KeyError ('qwen3.5'), so GET /v1/models returned 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 healthy qwen3-0 and a stale qwen3.5-0 left by a failed launch; asserts the stale uid is dropped (no KeyError) and qwen3 is 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 with KeyError.
  • test_list_models_returns_healthy_models — multi-replica happy-path baseline.

Both pass; pre-commit (black/flake8/isort/mypy/codespell) is green.

@XprobeBot XprobeBot added this to the v2.x milestone Jul 13, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread xinference/core/tests/test_list_models.py Outdated
Comment thread xinference/core/tests/test_list_models.py
@OliverBryant OliverBryant changed the title test(supervisor): cover list_models tolerance for stale replica uids (#5167) bug: cover list_models tolerance for stale replica uids (#5167) Jul 13, 2026
@XprobeBot XprobeBot added the bug Something isn't working label Jul 13, 2026
@OliverBryant OliverBryant force-pushed the test/list-models-stale-uid-5167 branch from 4da5b92 to 963a3e1 Compare July 13, 2026 03:52
@OliverBryant OliverBryant changed the title bug: cover list_models tolerance for stale replica uids (#5167) bug: cover list_models tolerance for stale replica uids Jul 13, 2026
…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.
@OliverBryant OliverBryant force-pushed the test/list-models-stale-uid-5167 branch from 963a3e1 to 80e95d4 Compare July 13, 2026 04:23
@OliverBryant

Copy link
Copy Markdown
Collaborator Author

/gemini review

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants