Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Hub token identity tests: let the llama-backend stubs take the caller's token after #13005 (#13022)

Shubhankar Tripathya8ff841db8a3
diff --git a/studio/backend/tests/test_hub_token_caller_identity.py b/studio/backend/tests/test_hub_token_caller_identity.py
index 3ccad4f97f7..471c2decb3f 100644
--- a/studio/backend/tests/test_hub_token_caller_identity.py
+++ b/studio/backend/tests/test_hub_token_caller_identity.py
@@ -126,7 +126,7 @@ def _st_resolver(monkeypatch, **overrides) -> None:
stub it cares about and the rest stays out of the way.
"""
stubs = {
- "_llama_backend_active": lambda _m: False,
+ "_llama_backend_active": lambda _m, _token = None: False,
"_local_sentence_transformer_is_present": lambda _m: False,
"_st_weight_source": lambda *_a, **_k: None,
}
@@ -137,7 +137,7 @@ def _st_resolver(monkeypatch, **overrides) -> None:
def _gguf_resolver(monkeypatch, **overrides) -> None:
"""The llama-server preamble: six stubs is what it takes to reach the candidate lookup."""
stubs = {
- "_llama_backend_active": lambda _m: True,
+ "_llama_backend_active": lambda _m, _token = None: True,
"_llama_runtime_available": lambda: True,
"_resolves_as_local_gguf": lambda _m: False,
"_local_gguf_backend_error": lambda _m: None,
@@ -2179,6 +2179,25 @@ def test_the_embedding_resolver_does_not_probe_before_a_cache_lookup(monkeypatch
assert probes["n"] == 0, "a local sentence-transformers hit still probed the Hub"
+def test_the_backend_probe_is_asked_with_the_callers_token(monkeypatch):
+ """Which backend serves a private repo depends on files only the caller's token can read (#13005)."""
+ seen = []
+
+ def _probe(model, token = None):
+ seen.append((model, token))
+ return False
+
+ _st_resolver(
+ monkeypatch,
+ _llama_backend_active = _probe,
+ _local_sentence_transformer_is_present = lambda _m: True,
+ )
+
+ settings_routes._resolve_embedding_model_plan("acme/private-st", "hf_caller")
+
+ assert seen == [("acme/private-st", "hf_caller")]
+
+
def test_the_scan_is_refused_before_it_expands_its_targets(monkeypatch):
"""The per-target check inside the loop cannot stand in for this one. Target expansion
resolves the adapter's base and its native-audio dependencies, which reads the cache and