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 MCP: drop a queued video's request and caller once it settles (#14825)
Daniel Han7aa1073300e1
diff --git a/studio/backend/studio_mcp/video_queue.py b/studio/backend/studio_mcp/video_queue.pyindex 1e7dfa9959f..b93a4947ce5 100644--- a/studio/backend/studio_mcp/video_queue.py+++ b/studio/backend/studio_mcp/video_queue.py@@ -43,8 +43,9 @@ PROGRESS = "/api/inference/video/generate-progress"class QueuedVideo:id: straccount_id: str- caller: Caller = field(repr = False)- body: dict = field(repr = False)+ # Dropped once settled: the body can carry ~40 MiB of reference images and the caller its token.+ caller: Optional[Caller] = field(repr = False)+ body: Optional[dict] = field(repr = False)hints: Optional[dict] = field(default = None, repr = False)# queued, submitted, failed or cancelled.status: str = "queued"@@ -143,6 +144,8 @@ def _settle(if waiting and item in waiting:waiting.remove(item)item.status, item.error, item.posting = status, error, False+ # Only _submit reads these, and only while queued; a settled record answers get_job alone.+ item.body, item.hints, item.caller = None, None, Noneasync def _wait_for_running(caller: Caller) -> None:diff --git a/studio/backend/tests/test_mcp_video_queue.py b/studio/backend/tests/test_mcp_video_queue.pyindex 193f76dbf63..eeb11e7e7a3 100644--- a/studio/backend/tests/test_mcp_video_queue.py+++ b/studio/backend/tests/test_mcp_video_queue.py@@ -197,6 +197,30 @@ def test_the_queue_waits_out_gpu_busy_and_fails_a_refused_video_with_its_reason(assert job_c["id"] == "video-2"+def test_a_settled_record_drops_its_request_and_caller(monkeypatch):+ # The body can carry tens of MiB of reference images and the caller its token; a settled record+ # only answers get_job, so neither may outlive the queue's last use of them.+ refused = openai_error("Unsupported size 1x1.", 400, param = "size")+ fake = OneVideoStudio()+ with open_client(monkeypatch, fake) as http:+ generate(http, "A")+ b, c, d = generate(http, "B"), generate(http, "C"), generate(http, "D")+ assert call_tool(http, "cancel", {"kind": "video", "id": d["id"]})["structuredContent"][+ "cancelled"+ ]+ fake.answers = [refused]+ fake.finish()+ job_b = wait_until(http, b["id"], lambda job: job["status"] != "queued")+ job_c = wait_until(http, c["id"], lambda job: job["status"] != "queued")+ job_d = get_video(http, d["id"])+ items = {item.id: item for item in video_queue._items.values()}+ assert [job_b["status"], job_c["id"], job_d["status"]] == ["failed", "video-2", "cancelled"]+ assert {items[q["id"]].status for q in (b, c, d)} == {"failed", "submitted", "cancelled"}+ for q in (b, c, d):+ item = items[q["id"]]+ assert (item.body, item.hints, item.caller) == (None, None, None)++@pytest.mark.parametrize("answer, text",[