[Bugfix] Reject /v1/completions for thinker+talker models when --trust-remote-code is unset (#5525)

Signed-off-by: ChoHee15 <cc5281@126.com>
This commit is contained in:
ChoHee authored and GitHub committed 2026-08-01 15:49:12 +00:00
1 parent 2c4e9a945b
commit 67c54777bb
3 files changed
+130

No files matched your search

+40
View File
@@ -219,6 +219,46 @@ def test_store_true_explicit():
assert ns.verbose is True
def test_unset_trust_remote_code_falls_back_to_engine_default_none():
"""Regression guard for issue #5495 (the CLI-plumbing half).
The CI test ``test_completions_rejected_for_thinker_talker`` does NOT pass
``--trust-remote-code``. Because it is a ``store_true`` flag, an omitted
value is dropped from ``get_explicit_kwargs_dict()`` (it is not user-typed),
so it is never forwarded to ``AsyncOmni(**kwargs)`` and the engine falls back
to ``AsyncOmniEngine.__init__``'s default of ``None`` — NOT argparse's
``False``. That ``None`` is what used to break endpoint-restriction
resolution (see ``TestQwen3OmniPipeline.
test_endpoint_restrictions_survive_unset_trust_remote_code``).
This test locks in the "CI does not pass the flag => effective value is
None" premise so a future refactor cannot silently change it.
"""
import inspect
from vllm_omni.engine.async_omni_engine import AsyncOmniEngine
p = TrackingArgumentParser()
# Mirror how --trust-remote-code is registered upstream (store_true).
p.add_argument("--trust-remote-code", action="store_true")
# Scenario A: CI — flag omitted.
ns = p.parse_args([])
assert "trust_remote_code" not in ns.explicit_keys
kwargs = ns.get_explicit_kwargs_dict()
assert "trust_remote_code" not in kwargs
engine_default = inspect.signature(AsyncOmniEngine.__init__).parameters["trust_remote_code"].default
assert engine_default is None
effective = kwargs.get("trust_remote_code", engine_default)
assert effective is None # <- the value that reached the buggy restriction path
# Scenario B: flag passed (what earlier repros used) => True, restrictions fine.
ns2 = p.parse_args(["--trust-remote-code"])
assert "trust_remote_code" in ns2.explicit_keys
kwargs2 = ns2.get_explicit_kwargs_dict()
assert kwargs2.get("trust_remote_code", engine_default) is True
def test_store_false_default():
"""Ensure that store false is handled correctly when omitted."""
p = TrackingArgumentParser()