Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
c06fa19
Studio: add opt-in vLLM and SGLang inference engines
oobabooga Sep 21, 2026
42e5c51
Studio: extend optional engines with vision, precision and parallel m…
oobabooga Sep 21, 2026
a67b8f1
Studio: allow loading explicitly restored inference engines
oobabooga Sep 21, 2026
5b6e9f8
Studio: support tool calling with managed inference engines
oobabooga Sep 21, 2026
3960bdf
Merge main into feat/studio-opt-in-engines
oobabooga Sep 22, 2026
eec4b11
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 22, 2026
c38665c
Restore managed engine settings on rollback and launch the normalized…
oobabooga Sep 22, 2026
b3fa171
Run optional engine checks in validate before the picker unloads
oobabooga Sep 22, 2026
26b2bd4
Patch the httpx module the managed tool route imports in its tests
oobabooga Sep 22, 2026
f0d40ad
Fetch remote image URLs in Studio before forwarding them to a managed…
oobabooga Sep 22, 2026
b624522
Give managed engine requests the llama-server first-token deadline
oobabooga Sep 22, 2026
daa5da8
Refuse an outdated engine profile on the backend unless it was restored
oobabooga Sep 22, 2026
5b0c980
Name the text encoding for engine subprocess output and the lease file
oobabooga Sep 22, 2026
21a9b95
Update repository guard tests for the optional engine changes
oobabooga Sep 22, 2026
d4e098a
Merge main into feat/studio-opt-in-engines
oobabooga Sep 23, 2026
bfe7a08
Run optional engines on Studio's PyTorch instead of a separate Python…
oobabooga Sep 23, 2026
bf56a58
Keep the chat GPU claim when a managed engine does not stop on unload
oobabooga Sep 24, 2026
424e26b
Report a managed engine that survives load cancellation and keep it h…
oobabooga Sep 24, 2026
86cfd70
Launch managed engines only on GPUs visible to Studio
oobabooga Sep 24, 2026
2394aa4
Default the engine GPU picker to the first GPU Studio sees
oobabooga Sep 24, 2026
c1649be
Merge main into feat/studio-opt-in-engines
oobabooga Sep 25, 2026
3d563ec
Load a compare pane with its remembered vLLM or SGLang settings
oobabooga Sep 25, 2026
0dffb49
Validate a model switch on the GPUs its load will use
oobabooga Sep 25, 2026
a2c3765
Trim comments in opt-in engine code
danielhanchen Sep 25, 2026
300b507
Send managed engines only data URL images
danielhanchen Sep 25, 2026
3e095cb
Keep engine status probes from failing real engine work
danielhanchen Sep 25, 2026
afb6f34
Give the load-time nvidia-smi probes the same 60s allowance
danielhanchen Sep 25, 2026
b7c2a63
Time out engine startup on silence, not a fixed 15 minutes
danielhanchen Sep 25, 2026
8482d76
Disable vLLM's vendored DeepGEMM when it was built for another Python
danielhanchen Sep 25, 2026
cedc789
Start a model switch without a saved config on the default engine
danielhanchen Sep 25, 2026
4fabd0f
Cache a failed nvidia-smi probe for 5 minutes
danielhanchen Sep 25, 2026
9a8715e
Format the engine switch test
danielhanchen Sep 25, 2026
b8057ec
Give the engine silence test room for a slow interpreter start
danielhanchen Sep 25, 2026
38bc4b0
Never run nvidia-smi inside an engines status poll
danielhanchen Sep 25, 2026
6ca8706
Run the malware and remote-code consent gates before a managed engine…
danielhanchen Sep 25, 2026
11c6df2
Treat saved vLLM/SGLang targets as managed in image checks
danielhanchen Sep 25, 2026
ec7c160
Let the legacy model_id-only delete clear a saved engine choice
danielhanchen Sep 25, 2026
c9ac7d8
Merge main into feat/studio-opt-in-engines
danielhanchen Sep 25, 2026
0f6207d
Reap a crashed engine before engine status, install, repair or removal
danielhanchen Sep 25, 2026
5250577
Count managed-engine tokens when reasoning_effort is "none"
danielhanchen Sep 25, 2026
3412f23
Tighten engine comments
danielhanchen Sep 25, 2026
d8ea265
Merge main into feat/studio-opt-in-engines
danielhanchen Sep 26, 2026
f602f83
Share Studio's PyTorch with engines installed from the PyTorch index
danielhanchen Sep 26, 2026
59a5f65
Keep each engine environment's FlashInfer JIT cache inside it
danielhanchen Sep 26, 2026
0c3c2e9
Hide Studio's NVFP4 FlashInfer from shared engine environments
danielhanchen Sep 26, 2026
dc683cf
Give engines the locked pip nvcc for FlashInfer JIT on driver-only hosts
danielhanchen Sep 26, 2026
b226fc6
Download only what Studio lacks: reuse its accepted versions, fetch F…
danielhanchen Sep 26, 2026
0e061d6
Require glibc 2.35 for vLLM, whose wheel is manylinux_2_35
danielhanchen Sep 26, 2026
0513f1e
Update engines to vLLM 0.26.0 and SGLang 0.5.17
danielhanchen Sep 26, 2026
0417f6c
Keep TorchAO precisions working on the upgraded engines
danielhanchen Sep 26, 2026
511e5fe
Merge remote-tracking branch 'origin/main' into r11491
danielhanchen Sep 27, 2026
6e6fedb
Accept a text response_format on managed engines and name audio model…
danielhanchen Sep 27, 2026
8f8beca
Merge remote-tracking branch 'origin/main' into r11491
danielhanchen Sep 28, 2026
3df4446
Merge remote-tracking branch 'origin/main' into r11491
danielhanchen Sep 28, 2026
e1a7439
Serve managed-engine n > 1 one choice at a time, reap an engine a can…
danielhanchen Sep 28, 2026
916e2e3
Report the public model id on managed-engine tool responses
danielhanchen Sep 28, 2026
4af4116
Serve a tool catalog with tool_choice none as plain chat on models wi…
danielhanchen Sep 28, 2026
fdf3502
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 28, 2026
c1d084d
Store only non-default engine fields in model overrides, so an all-de…
danielhanchen Sep 29, 2026
abeaca9
Refuse to start training while a managed engine that failed to stop s…
danielhanchen Sep 29, 2026
7c0c000
Pass the engine key in the environment and guard every vLLM route wit…
danielhanchen Sep 29, 2026
5acac1d
Reuse Studio's TorchAO for engines only at the version the adapter co…
danielhanchen Sep 29, 2026
571a37c
Leave engine-specific VRAM headroom measured on a 24 GB card
danielhanchen Sep 29, 2026
c9e9a10
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 29, 2026
36c20fc
Merge main into feat/studio-opt-in-engines
danielhanchen Sep 29, 2026
08d934f
Keep the NVIDIA driver's library path for managed engines and their i…
danielhanchen Sep 29, 2026
5f6a726
Revert the driver library path change; it moves to its own PR
danielhanchen Sep 29, 2026
3be719c
Merge main into feat/studio-opt-in-engines
danielhanchen Oct 1, 2026
7d82b0f
Engines: lock a release per Studio PyTorch (vLLM 0.30 / SGLang 0.5.20…
danielhanchen Oct 1, 2026
197d96f
SGLang 0.5.18+: run without --torchao-config and refuse load-time INT…
danielhanchen Oct 1, 2026
7c419a1
Precision picker: disable INT8 and 4-bit for SGLang releases without …
danielhanchen Oct 1, 2026
d070583
SGLang 0.5.18+: disable CUDA graphs with the per-phase backend flags
danielhanchen Oct 1, 2026
54b15c0
Merge main into feat/studio-opt-in-engines
danielhanchen Oct 1, 2026
6899423
Merge remote-tracking branch 'origin/main' into r11491
danielhanchen Oct 2, 2026
24dd21e
Engines: skip CUTLASS DSL's CUDA 12 libraries, which a driver 580 hos…
danielhanchen Oct 2, 2026
ea82f00
unsloth run: --engine vllm|sglang serves through an optional engine, …
danielhanchen Oct 2, 2026
5915028
Engines: share nvcc's headers only at the locked release, so FlashInf…
danielhanchen Oct 2, 2026
55df9b3
Engines: take nvcc and its headers from one release, all from Studio …
danielhanchen Oct 2, 2026
a900d9f
Reaping a crashed engine also drops its chat GPU claim and shared res…
danielhanchen Oct 2, 2026
2b03e2d
Shared engines: keep the engine's nvidia tree first when Studio's sit…
danielhanchen Oct 2, 2026
22019df
Engines: an INT4 / INT8 SGLang cannot convert resets on switching and…
danielhanchen Oct 2, 2026
3badbb7
Engines: CUDA runtime headers travel with nvcc, so a shared engine ne…
danielhanchen Oct 2, 2026
3632693
unsloth run --engine: a restored engine loads as is
danielhanchen Oct 2, 2026
feb9ac1
Engines: one merged CUDA include tree, so Studio headers pick up the …
danielhanchen Oct 2, 2026
bc06998
Engines: keep a share of large GPUs free for vLLM's sampler warmup
danielhanchen Oct 2, 2026
829ce71
Engines: keep the current-date note on rebuilt managed-engine messages
danielhanchen Oct 2, 2026
1c03ce1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 2, 2026
c5d783b
Model picker: keep GGUF row badges aligned with rows that have the se…
danielhanchen Oct 2, 2026
edc9f42
Engines: validate the INT4 a legacy load_in_4bit request becomes, bef…
danielhanchen Oct 2, 2026
0c6c6a0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 2, 2026
4757676
Engines: keep lock files byte-exact on Windows clones; mark Linux-onl…
danielhanchen Oct 2, 2026
ee2c279
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 2, 2026
95df13b
Engines: install-machinery tests are Linux engine-host tests
danielhanchen Oct 2, 2026
246a61b
Merge main into feat/studio-opt-in-engines
danielhanchen Oct 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Run the malware and remote-code consent gates before a managed engine…
… loads

The default path runs these gates in its worker. vLLM and SGLang load
the checkpoint themselves, so a managed load skipped both, and
trust_remote_code reached the engine without the consent scan or the
approved fingerprint. Scan what the engine will load (the local path
for a local model) and raise the gate's message.
  • Loading branch information
danielhanchen committed Sep 25, 2026
commit 6ca8706880701463bc1a8f5f467b65edd3a723d1
23 changes: 23 additions & 0 deletions studio/backend/core/inference/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,8 @@ def load_model(
anonymous_hf_access,
engine_options,
trust_remote_code,
approved_remote_code_fingerprint,
subject,
)
if getattr(self, "_managed_engine", None) is not None:
if not self._shutdown_subprocess():
Expand Down Expand Up @@ -2109,7 +2111,11 @@ def _load_managed_engine(
anonymous,
options = None,
trust_remote_code = False,
approved_remote_code_fingerprint = None,
subject = None,
):
from types import SimpleNamespace

from core.inference.managed_engine import ManagedEngine
from utils.hf_cache_settings import get_hf_cache_paths
from hub.utils.hf_tokens import apply_token_to_child_env
Expand All @@ -2124,6 +2130,23 @@ def _load_managed_engine(
managed = ManagedEngine(engine)
self._managed_engine = managed
try:
# The engine loads the checkpoint itself, so the worker's malware and consent gates run here.
from core.inference.worker import _run_security_gates

replies = []
if not _run_security_gates(
[config.path if getattr(config, "is_local", False) else model],
trust_remote_code = bool(trust_remote_code),
hf_token = None if anonymous else hf_token,
approved_fingerprint = approved_remote_code_fingerprint,
resp_queue = SimpleNamespace(put = replies.append),
compute_subdirs = False,
subject = subject,
):
raise RuntimeError(
(replies[-1].get("message") if replies else None)
or "The model was blocked by the security scan."
)
env = get_hf_cache_paths().child_env()
if cache_environment:
env.update(cache_environment)
Expand Down
57 changes: 57 additions & 0 deletions studio/backend/tests/test_managed_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,12 @@ def alive(self):
return True

monkeypatch.setattr(managed_engine, "ManagedEngine", Engine)
from core.inference import worker

scanned = []
monkeypatch.setattr(
worker, "_run_security_gates", lambda targets, **kwargs: scanned.extend(targets) or True
)
orchestrator = InferenceOrchestrator.__new__(InferenceOrchestrator)
orchestrator._managed_engine = None
orchestrator._subprocess_shutdown_lock = _threading.RLock()
Expand All @@ -567,6 +573,7 @@ def alive(self):
)
assert orchestrator._load_managed_engine("vllm", config, 4096, [0], None, None, None, False)
assert started == {"model": "C:\\models\\foo", "model_path": "/mnt/c/models/foo"}
assert scanned == ["/mnt/c/models/foo"]
assert orchestrator.active_model_name == "C:\\models\\foo"

args = ADAPTERS["vllm"].command(
Expand Down Expand Up @@ -1661,3 +1668,53 @@ def slow_smi(argv, **kwargs):
release.set()
assert install.support_reason("vllm") is None
assert len(calls) == 1


@pytest.mark.parametrize("trust_remote_code", [False, True])
def test_managed_load_runs_the_worker_security_gates(monkeypatch, trust_remote_code):
import threading as _threading
from types import SimpleNamespace
from core.inference import managed_engine, worker
from core.inference.orchestrator import InferenceOrchestrator

started, gates = [], []

class Engine:
context = 4096

def __init__(self, name):
pass

def start(self, *args, **kwargs):
started.append(args)

def alive(self):
return True

def blocked(targets, *, resp_queue, **kwargs):
gates.append((targets, kwargs))
resp_queue.put({"type": "loaded", "success": False, "message": "flagged as CRITICAL"})
return False

monkeypatch.setattr(managed_engine, "ManagedEngine", Engine)
monkeypatch.setattr(worker, "_run_security_gates", blocked)
orchestrator = InferenceOrchestrator.__new__(InferenceOrchestrator)
orchestrator._managed_engine = None
orchestrator._subprocess_shutdown_lock = _threading.RLock()
orchestrator._shutdown_subprocess = lambda *args, **kwargs: True
orchestrator.models, orchestrator.loading_models = {}, set()
orchestrator.active_model_name, orchestrator.load_generation = None, 0
config = SimpleNamespace(identifier = "org/model", is_local = False, is_vision = False)
with pytest.raises(RuntimeError, match = "CRITICAL"):
orchestrator.load_model(
config,
hf_token = "tok",
trust_remote_code = trust_remote_code,
approved_remote_code_fingerprint = "fp",
subject = "user",
engine = "vllm",
)
assert started == [] and orchestrator.active_model_name is None
assert gates[0][0] == ["org/model"]
assert gates[0][1]["trust_remote_code"] is trust_remote_code
assert gates[0][1]["approved_fingerprint"] == "fp" and gates[0][1]["subject"] == "user"