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 UI test: wait for the chat shell to settle, not just the composer (#13672)
Daniel Han757ae1b2971f
diff --git a/tests/studio/playwright_chat_ui.py b/tests/studio/playwright_chat_ui.pyindex 83f3a459898..bcf3aef4550 100644--- a/tests/studio/playwright_chat_ui.py+++ b/tests/studio/playwright_chat_ui.py@@ -228,10 +228,70 @@ FULL_ACCESS_CANCEL = '[data-slot="alert-dialog-cancel"]'FULL_ACCESS_CONFIRM = '[data-slot="alert-dialog-action"]'+PERMISSION_PILL = 'button[aria-label="Permission level for tool calls"]:visible'+ROUTE_FALLBACK_TEXT = (+ "Loading..." # RouteFallback in studio/frontend/src/app/routes/__root.tsx (common.loading)+)+++class ShellMissingControl(AssertionError):+ """The chat shell booted (composer up, no route fallback) without the permission pill."""+++def wait_for_settled_shell(+ page,+ composer,+ settle_s = 2.0,+ fallback_budget_s = 30.0,+ missing_pill_s = 5.0,+):+ """Return once the composer and its permission pill have stayed up together for settle_s.++ The textarea showing once is not the shell settling. On the Windows lane the shell has been seen to drop to the+ full-page route fallback right after the composer painted, while the backend stalled ~5 s warming torch, and stay+ there past the next step's 5 s expect. The pill and the textarea render in the same commit, so seeing both once+ proves nothing either: they have to stay up. A fallback is waited out for up to fallback_budget_s and then raised+ as a boot failure (the caller re-navigates once). A booted shell, composer up and no fallback, that goes+ missing_pill_s without the pill raises ShellMissingControl, which the caller must not retry.+ """+ pill = page.locator(PERMISSION_PILL).first+ fallback = page.get_by_text(ROUTE_FALLBACK_TEXT, exact = True)+ deadline = time.monotonic() + fallback_budget_s+ stable_since = None+ pill_missing_since = None+ while True:+ now = time.monotonic()+ has_composer = composer.is_visible()+ has_pill = pill.is_visible()+ in_fallback = fallback.count() > 0 and fallback.first.is_visible()+ if has_composer and has_pill:+ pill_missing_since = None+ stable_since = stable_since or now+ if now - stable_since >= settle_s:+ return+ else:+ stable_since = None+ if has_composer and not in_fallback:+ pill_missing_since = pill_missing_since or now+ if now - pill_missing_since >= missing_pill_s:+ raise ShellMissingControl(+ f"the composer is up with no route fallback, but the permission pill has been missing for "+ f"{missing_pill_s:.0f}s; page.url={page.url}"+ )+ else:+ pill_missing_since = None+ if now >= deadline:+ raise TimeoutError(+ f"chat shell did not settle in {fallback_budget_s:.0f}s: composer={has_composer} pill={has_pill} "+ f"route_fallback={in_fallback}; page.url={page.url}"+ )+ page.wait_for_timeout(100)++def exercise_permission_mode_controls(page, shoot):"""Exercise labels, migration, persistence, confirmation, and focus."""step("permission levels: labels, persistence, confirmation, and focus")- pill = page.locator('button[aria-label="Permission level for tool calls"]:visible').first+ pill = page.locator(PERMISSION_PILL).firstexpect(pill).to_be_visible()# Stub the sandbox capability so level checks do not depend on the runner's user namespaces.@@ -1226,17 +1286,26 @@ with sync_playwright() as p:wall_kick() # as in the change-password loop: the retry logs with bare print()try:composer.wait_for(state = "visible", timeout = 60_000)+ wait_for_settled_shell(page, composer)last_err = Nonebreak+ except ShellMissingControl:+ # The shell booted and is missing a control: a product defect, not a boot failure. No second render.+ raiseexcept Exception as e:last_err = etry:cur_url = page.urlexcept Exception:cur_url = "<page closed>"+ try:+ route_fallback = page.get_by_text(ROUTE_FALLBACK_TEXT, exact = True).count()+ except Exception:+ route_fallback = -1print(f"[ui] composer.wait_for attempt {_attempt + 1} failed: "f"{type(e).__name__}: {str(e)[:200]}; page.url={cur_url}; "+ f"route_fallback={route_fallback}; "f"page_errors={len(page_errors)} console_errors={len(console_errors)}",flush = True,)