[Bugfix][LogitsProcessor] Validate ':' separator in custom logits processor FQCN (#56020)
Signed-off-by: 100milliongold <gadian88@gmail.com>
김재억 committed
Sep 25, 2026 at 10:49 UTC
32fc82343f57d9b18712745358286a1e687ec5dc
2 files changed
+31
-1
tests/v1/logits_processors/test_loader.py
new
+24
@@ -0,0 +1,24 @@
1
+# SPDX-License-Identifier: Apache-2.0
2
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
+"""Unit tests for loading custom logits processors by FQCN.
4
+
5
+Kept separate from `test_custom_offline.py`, which runs end-to-end against a
6
+downloaded model; these exercise the loader alone and need no model.
7
+"""
8
+
9
+import pytest
10
+
11
+from vllm.v1.sample.logits_processor import _load_logitsprocs_by_fqcns
12
+
13
+
14
+@pytest.mark.parametrize(
15
+ "fqcn",
16
+ [
17
+ "invalid_fqcn_without_colon",
18
+ "invalid:fqcn:with:multiple:colons",
19
+ ],
20
+ ids=["missing-colon", "too-many-colons"],
21
+)
22
+def test_invalid_fqcn_rejected(fqcn: str):
23
+ with pytest.raises(ValueError, match="Invalid logits processor FQCN"):
24
+ _load_logitsprocs_by_fqcns([fqcn])
vllm/v1/sample/logits_processor/__init__.py
+7
-1
@@ -125,7 +125,13 @@ def _load_logitsprocs_by_fqcns(
125
continue
126
127
logger.debug("- Loading logits processor %s", logitproc)
128
- module_path, qualname = logitproc.split(":")
128
+ parts = logitproc.split(":")
129
+ if len(parts) != 2:
130
+ raise ValueError(
131
+ f"Invalid logits processor FQCN {logitproc!r}. "
132
+ "Expected format: '<module>:<type>'"
133
+ )
134
+ module_path, qualname = parts
135
136
try:
137
# Load module