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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: log a pending embedder download once instead of a traceback on every compaction (#12443)
Daniel Han673c7272d5f5
diff --git a/studio/backend/core/rag/conversation_archive.py b/studio/backend/core/rag/conversation_archive.pyindex db51f18126a..217caab12e2 100644--- a/studio/backend/core/rag/conversation_archive.py+++ b/studio/backend/core/rag/conversation_archive.py@@ -588,6 +588,9 @@ def archive_turns(written += 1if _INGEST_FAILED:globals()["_INGEST_FAILED"] = False+ except embeddings.EmbeddingModelDownloadRequiredError as exc:+ globals()["_INGEST_FAILED"] = True+ _log_embedder_pending(model, exc)except Exception:# A chat that cannot archive still beats one that raises. Whatever was written before the failure stays# searchable.@@ -612,6 +615,17 @@ def archive_turns(return written+# A Settings pick whose download has not finished is not a fault; logged once, not per compaction.+_EMBEDDER_PENDING_LOGGED: set = set()+++def _log_embedder_pending(model, exc: Exception) -> None:+ if model in _EMBEDDER_PENDING_LOGGED:+ return+ _EMBEDDER_PENDING_LOGGED.add(model)+ logger.info("conversation_archive.embedder_pending: %s", exc)++# Set when an archive write fails, cleared by the next one that succeeds. Process-wide on purpose: what fails here is# the embedder or the store, not one thread._INGEST_FAILED = False@@ -2299,6 +2313,8 @@ def _candidates(conn, scope: str, query: str, model, fetch: int, thread_id: str)seen.add(hit.chunk_id)if len(hits) >= fetch:break+ except embeddings.EmbeddingModelDownloadRequiredError as exc:+ _log_embedder_pending(model, exc)except Exception:# Dense retrieval raises rather than degrading when no embedder can start. The lexical hits stand on their# own, so this top-up may fail.diff --git a/studio/backend/tests/test_conversation_archive.py b/studio/backend/tests/test_conversation_archive.pyindex f581599a177..05d164c807f 100644--- a/studio/backend/tests/test_conversation_archive.py+++ b/studio/backend/tests/test_conversation_archive.py@@ -1393,6 +1393,42 @@ def test_an_edit_past_the_probe_cutoff_still_retires_the_turn(conn):assert found is None or "OLDSTEP-7777" not in found[0]+def test_an_embedder_download_still_pending_is_logged_once_without_a_traceback(+ conn, monkeypatch, caplog+):+ """Each fit must not log the same traceback again, and recall still answers lexically."""+ import logging++ from core.rag import embeddings++ _archive(_turn("how do I bake sourdough", "start a starter"))++ def pending(*_args, **_kwargs):+ raise embeddings.EmbeddingModelDownloadRequiredError(+ "Embedding model 'unsloth/Qwen3-Embedding-0.6B' is not downloaded yet."+ )++ monkeypatch.setattr(embeddings, "token_counter", pending)+ monkeypatch.setattr(embeddings, "encode_with_identity", pending)+ monkeypatch.setattr(conversation_archive, "_EMBEDDER_PENDING_LOGGED", set(), raising = False)+ monkeypatch.setattr(conversation_archive, "_INGEST_FAILED", False)+ turn = _turn("what is the deploy code", "the deploy code is 5150")+ caplog.set_level(logging.INFO, logger = conversation_archive.logger.name)++ for _ in range(3):+ assert _archive([dict(m) for m in turn]) == 0+ assert conversation_archive.degraded() is True+ found = conversation_archive.recall(THREAD, "sourdough")+ assert found is not None and "sourdough" in found[0]++ records = [r for r in caplog.records if r.name == conversation_archive.logger.name]+ assert not [r for r in records if r.levelno >= logging.WARNING or r.exc_info]+ assert [r.getMessage() for r in records if "embedder_pending" in r.getMessage()] == [+ "conversation_archive.embedder_pending: "+ "Embedding model 'unsloth/Qwen3-Embedding-0.6B' is not downloaded yet."+ ]++def test_a_failed_archive_marks_the_feature_degraded(conn, monkeypatch):"""And a later success clears it, so one bad moment is not permanent."""from core.rag import embeddings