[Bugfix][Frontend] Reject LoRA adapters named after a served model (#59286)
Signed-off-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Nick Hill committed
Sep 29, 2026 at 18:29 UTC
105a4e097b905127b1d5f09a7e93bd1095e87a6c
2 files changed
+24
tests/entrypoints/serve/lora/test_serving_models.py
+16
@@ -99,6 +99,22 @@ async def test_load_lora_adapter_duplicate():
99
assert len(serving_models.lora_requests) == 1
100
101
102
+@pytest.mark.asyncio
103
+@pytest.mark.parametrize("load_inplace", [False, True])
104
+async def test_load_lora_adapter_base_model_name(load_inplace: bool):
105
+ """A LoRA named after a served model would shadow it for all requests."""
106
+ serving_models = await _async_serving_models_init()
107
+ request = LoadLoRAAdapterRequest(
108
+ lora_name=MODEL_NAME, lora_path="/path/to/adapter", load_inplace=load_inplace
109
+ )
110
+ response = await serving_models.load_lora_adapter(request)
111
+ assert isinstance(response, ErrorResponse)
112
+ assert response.error.type == "InvalidUserInput"
113
+ assert response.error.code == HTTPStatus.BAD_REQUEST
114
+ assert len(serving_models.lora_requests) == 0
115
+ serving_models.engine_client.add_lora.assert_not_called()
116
+
117
+
118
@pytest.mark.asyncio
119
async def test_unload_lora_adapter_success():
120
serving_models = await _async_serving_models_init()
vllm/entrypoints/openai/models/serving.py
+8
@@ -245,6 +245,14 @@ class OpenAIServingModels:
245
status_code=HTTPStatus.BAD_REQUEST,
246
)
247
248
+ if self.is_base_model(request.lora_name):
249
+ return create_error_response(
250
+ message=f"The lora adapter '{request.lora_name}' conflicts with a "
251
+ "served base model.",
252
+ err_type="InvalidUserInput",
253
+ status_code=HTTPStatus.BAD_REQUEST,
254
+ )
255
+
256
# If not loading inplace
257
# Check if the lora adapter with the given name already exists
258
if not request.load_inplace and request.lora_name in self.lora_requests: