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.

Run Linux frontend browser checks in two parallel groups (#13813)

Nathan Tranfd7d7b0cfa53
diff --git a/.github/workflows/studio-frontend-ci.yml b/.github/workflows/studio-frontend-ci.yml
index 24f4f43959f..ec53402a515 100644
--- a/.github/workflows/studio-frontend-ci.yml
+++ b/.github/workflows/studio-frontend-ci.yml
@@ -437,11 +437,86 @@ jobs:
tests/studio/test_heavy_thread_gap_contract.py \
tests/studio/test_code_block_flicker_contract.py -q
- - name: Browser smoke for ANSI tool output
+ # Keep data settings separate from the shorter checks. Each group owns its cache.
+ # The step bound fires before the job's: a job timeout is a cancellation, which skips the
+ # failure-only artifact upload, so a hung check would leave no log anywhere.
+ - name: Browser smoke groups for data settings and frontend controls
working-directory: ${{ github.workspace }}
- env:
- PW_BROWSER: chromium
- run: python3 tests/studio/playwright_strip_ansi_smoke.py
+ timeout-minutes: 15
+ run: |
+ mkdir -p logs
+ group_pids=()
+ # The groups write to files, so their output reaches the step log only here: on every
+ # exit, including a timeout or a cancel, after both groups have stopped.
+ cleanup() {
+ for pid in "${group_pids[@]}"; do
+ kill -TERM "$pid" 2>/dev/null || true
+ done
+ for pid in "${group_pids[@]}"; do
+ wait "$pid" 2>/dev/null || true
+ done
+ cat logs/playwright-frontend-data.log logs/playwright-frontend-controls.log 2>/dev/null || true
+ }
+ trap cleanup EXIT
+ trap 'exit 130' INT
+ trap 'exit 143' TERM
+
+ stop_check() {
+ if [ -n "$check_pid" ]; then
+ kill -TERM "$check_pid" 2>/dev/null || true
+ wait "$check_pid" 2>/dev/null || true
+ fi
+ }
+ run_check() {
+ local name=$1 status=0
+ shift
+ echo "::group::$name"
+ "$@" &
+ check_pid=$!
+ wait "$check_pid" || status=$?
+ check_pid=
+ echo "$name: exit $status"
+ echo "::endgroup::"
+ [ "$status" -eq 0 ] || { echo "::error title=Browser smoke $name::$name exited $status"; group_failed=1; }
+ }
+
+ (
+ group_failed=0 check_pid=
+ trap stop_check EXIT
+ trap 'exit 130' INT
+ trap 'exit 143' TERM
+ export VITE_TEST_CACHE_DIR="$RUNNER_TEMP/vite-frontend-data"
+ run_check data_settings python3 tests/studio/playwright_data_settings.py
+ exit "$group_failed"
+ ) > logs/playwright-frontend-data.log 2>&1 &
+ group_pids+=("$!")
+ (
+ group_failed=0 check_pid=
+ trap stop_check EXIT
+ trap 'exit 130' INT
+ trap 'exit 143' TERM
+ export VITE_TEST_CACHE_DIR="$RUNNER_TEMP/vite-frontend-controls"
+ run_check settings_tabs python3 tests/studio/playwright_settings_tabs.py
+ run_check settings_tabs_blocked env PW_CHUNK_FAIL=data PW_PORT=5400 \
+ PW_OUT=logs/settings_tabs_blocked_report.json \
+ python3 tests/studio/playwright_settings_tabs.py
+ run_check find_in_page python3 tests/studio/playwright_find_in_page.py
+ run_check keyboard_shortcuts python3 tests/studio/playwright_keyboard_shortcuts.py
+ run_check strip_ansi env PW_BROWSER=chromium \
+ python3 tests/studio/playwright_strip_ansi_smoke.py
+ run_check composer_icons timeout --kill-after=10s 180s \
+ python3 tests/studio/playwright_composer_icons.py chromium
+ run_check research_review python3 tests/studio/playwright_research_review.py
+ exit "$group_failed"
+ ) > logs/playwright-frontend-controls.log 2>&1 &
+ group_pids+=("$!")
+
+ failed=0
+ for pid in "${group_pids[@]}"; do
+ wait "$pid" || failed=1
+ done
+ group_pids=()
+ exit "$failed"
- name: Browser smoke for the MCP App tool bridge
working-directory: ${{ github.workspace }}
@@ -449,11 +524,6 @@ jobs:
PW_BROWSER: chromium
run: python3 tests/studio/playwright_mcp_app_bridge_smoke.py
- - name: Composer icon alignment
- working-directory: ${{ github.workspace }}
- timeout-minutes: 3
- run: python3 tests/studio/playwright_composer_icons.py chromium
-
- name: Icon tooltips follow the pointer between neighbours
working-directory: ${{ github.workspace }}
timeout-minutes: 3
@@ -474,10 +544,6 @@ jobs:
working-directory: ${{ github.workspace }}
run: python3 tests/studio/playwright_research_freeze.py
- - name: Browser smoke for reopening the research plan
- working-directory: ${{ github.workspace }}
- run: python3 tests/studio/playwright_research_review.py
-
# A gate, not a measurement. The released and streamdown variants are positive controls
# that MUST flicker: a run where neither collapses means the detector stopped seeing, not
# that the flicker stopped. Chromium only on a PR, the engine whose content-visibility
@@ -539,54 +605,12 @@ jobs:
working-directory: ${{ github.workspace }}
run: python3 tests/studio/playwright_nonmodal_menus.py
- # The settings panels are fetched on first view, so only a browser can answer whether
- # every tab renders and deep-opens land (and abandoned ones do not come back).
- - name: Browser smoke for the settings tab panels
- working-directory: ${{ github.workspace }}
- run: python3 tests/studio/playwright_settings_tabs.py
-
- - name: Data settings deletion choices
- working-directory: ${{ github.workspace }}
- run: python3 tests/studio/playwright_data_settings.py
-
- # A listener is not a pure function: what a chord does to a focused button, to a
- # text field, on auto-repeat, or under AltGr is only answerable in a browser, and
- # the node suite pins those through source text. Chromium here because that is what
- # this job installs; SMOKE_ENGINES=chromium,firefox,webkit runs the same checks
- # against all three when the matcher or the reserved sets change.
- - name: Browser smoke for keyboard shortcuts
- working-directory: ${{ github.workspace }}
- run: python3 tests/studio/playwright_keyboard_shortcuts.py
-
- # The node suite reaches the flatten, the offset map and the search, which are pure.
- # A Range has no geometry off a document, CSS.highlights paints nothing, and a chord
- # the browser owns cannot be taken from it in a unit test, so the count, the walk and
- # the teardown are only answerable here. The run also degrades the engine three ways:
- # no highlight registry, a checkVisibility that honours only the historic option
- # names, and no checkVisibility at all, which between them are Firefox below 140,
- # Chrome 105-120, and the WebKitGTK the desktop build is handed. Chromium here
- # because that is what this job installs; SMOKE_ENGINES=chromium,firefox,webkit
- # runs all three locally.
- - name: Browser smoke for find in page
- working-directory: ${{ github.workspace }}
- run: python3 tests/studio/playwright_find_in_page.py
-
- name: Browser smoke for tool activity collapse
working-directory: ${{ github.workspace }}
env:
PW_ENGINE: chromium
run: python3 tests/studio/playwright_tool_activity.py --json
- # A panel that cannot be fetched is new with lazy loading, and nothing above the
- # root-mounted dialog catches, so unguarded it unmounts Unsloth, not one panel.
- - name: Browser smoke for a settings panel that cannot load
- working-directory: ${{ github.workspace }}
- env:
- PW_CHUNK_FAIL: data
- PW_PORT: '5400'
- PW_OUT: logs/settings_tabs_blocked_report.json
- run: python3 tests/studio/playwright_settings_tabs.py
-
# Reports, does not gate, for now. The budgets inside are calibrated on a
# developer machine, and this measures a CPU-bound render on a shared runner
# under 6x throttling, so a budget set from one box is a flake waiting to
diff --git a/tests/studio/test_ci_parallel_browser_results.py b/tests/studio/test_ci_parallel_browser_results.py
index a47626e29f6..89ee47163ee 100644
--- a/tests/studio/test_ci_parallel_browser_results.py
+++ b/tests/studio/test_ci_parallel_browser_results.py
@@ -1,10 +1,14 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+import json
import os
from pathlib import Path
import shutil
+import signal
import subprocess
+import sys
+import time
import pytest
import yaml
@@ -62,3 +66,179 @@ python() {
assert f"{tmp_path}/vite-data-firefox" in result.stdout
assert (tmp_path / "chromium.ready").exists()
assert (tmp_path / "firefox.ready").exists()
+
+
+def _linux_script():
+ steps = yaml.safe_load(WORKFLOW.read_text(encoding = "utf-8"))["jobs"]["build"]["steps"]
+ return next(
+ s["run"]
+ for s in steps
+ if s.get("name") == "Browser smoke groups for data settings and frontend controls"
+ )
+
+
+CHECKS = [
+ "data_settings",
+ "settings_tabs",
+ "settings_tabs_blocked",
+ "find_in_page",
+ "keyboard_shortcuts",
+ "strip_ansi_smoke",
+ "composer_icons",
+ "research_review",
+]
+
+
+def _linux_stubs(tmp_path):
+ stub = r"""
+import json
+import os
+from pathlib import Path
+import signal
+import sys
+import time
+
+name = Path(sys.argv[1]).stem.removeprefix("playwright_")
+if os.environ.get("PW_CHUNK_FAIL"):
+ name += "_blocked"
+record = {"args": sys.argv[1:], "env": {key: value for key, value in os.environ.items()
+ if key.startswith(("PW_", "VITE_"))}, "pid": os.getpid()}
+
+def cancel(signum, frame):
+ Path(f"{name}.stopped").touch()
+ sys.exit(128 + signum)
+
+signal.signal(signal.SIGTERM, cancel)
+Path(f"{name}.tmp").write_text(json.dumps(record))
+Path(f"{name}.tmp").replace(f"{name}.json")
+if name in {"data_settings", "settings_tabs"}:
+ deadline = time.monotonic() + 5
+ while not all(Path(f"{other}.json").exists() for other in ("data_settings", "settings_tabs")):
+ if time.monotonic() > deadline:
+ sys.exit(9)
+ time.sleep(0.01)
+if os.environ.get("CANCEL_TEST"):
+ time.sleep(60)
+with open("order.log", "a") as out:
+ out.write(name + "\n")
+print(name)
+sys.exit(7 if name == os.environ.get("FAIL_CHECK") else 0)
+"""
+ python = tmp_path / "python3"
+ python.write_text(f"#!{sys.executable}\n" + stub, encoding = "utf-8")
+ python.chmod(0o755)
+ timeout = tmp_path / "timeout"
+ timeout.write_text(
+ '#!/bin/bash\nprintf "%s\\n" "$*" > timeout.args\nshift 2\nexec "$@"\n',
+ encoding = "utf-8",
+ )
+ timeout.chmod(0o755)
+ return {
+ **os.environ,
+ "PATH": f"{tmp_path}{os.pathsep}{os.environ['PATH']}",
+ "RUNNER_TEMP": str(tmp_path),
+ }
+
+
[email protected](os.name == "nt", reason = "Linux workflow uses POSIX tools")
[email protected]("failing", ["", *CHECKS])
+def test_linux_groups_overlap_and_collect_every_result(tmp_path, failing):
+ env = {**_linux_stubs(tmp_path), "FAIL_CHECK": failing}
+ # Reuse the same logs and cache paths to cover a repeated local run.
+ for _ in range(2 if not failing else 1):
+ for record in tmp_path.glob("*.json"):
+ record.unlink()
+ (tmp_path / "order.log").unlink(missing_ok = True)
+ result = subprocess.run(
+ [BASH, "-e", "-o", "pipefail", "-c", _linux_script()],
+ cwd = tmp_path,
+ env = env,
+ text = True,
+ capture_output = True,
+ timeout = 15,
+ )
+ assert result.returncode == bool(failing), result.stdout + result.stderr
+ # a failing check is named in an annotation, not only inside its group's log
+ label = failing.removesuffix("_smoke")
+ assert (f"::error title=Browser smoke {label}::" in result.stdout) == bool(
+ failing
+ ), result.stdout
+ records = {name: json.loads((tmp_path / f"{name}.json").read_text()) for name in CHECKS}
+ order = (tmp_path / "order.log").read_text().splitlines()
+ assert sorted(order) == sorted(CHECKS)
+ assert [name for name in order if name != "data_settings"] == CHECKS[1:]
+ for name, record in records.items():
+ group = "data" if name == "data_settings" else "controls"
+ assert record["env"]["VITE_TEST_CACHE_DIR"] == str(tmp_path / f"vite-frontend-{group}")
+ label = "strip_ansi" if name == "strip_ansi_smoke" else name
+ assert f"{label}: exit {7 if name == failing else 0}" in result.stdout
+ blocked = records["settings_tabs_blocked"]["env"]
+ assert (blocked["PW_CHUNK_FAIL"], blocked["PW_PORT"], blocked["PW_OUT"]) == (
+ "data",
+ "5400",
+ "logs/settings_tabs_blocked_report.json",
+ )
+ assert "PW_CHUNK_FAIL" not in records["settings_tabs"]["env"]
+ assert records["strip_ansi_smoke"]["env"]["PW_BROWSER"] == "chromium"
+ assert records["composer_icons"]["args"][-1] == "chromium"
+ assert (tmp_path / "timeout.args").read_text().strip() == (
+ "--kill-after=10s 180s python3 tests/studio/playwright_composer_icons.py chromium"
+ )
+ assert (tmp_path / "logs/playwright-frontend-data.log").is_file()
+ assert (tmp_path / "logs/playwright-frontend-controls.log").is_file()
+
+
[email protected](os.name == "nt", reason = "Linux cancellation uses POSIX signals")
+def test_linux_cancel_stops_both_active_harnesses(tmp_path):
+ env = {**_linux_stubs(tmp_path), "CANCEL_TEST": "1"}
+ process = subprocess.Popen(
+ [BASH, "-e", "-o", "pipefail", "-c", _linux_script()],
+ cwd = tmp_path,
+ env = env,
+ stdout = subprocess.PIPE,
+ stderr = subprocess.PIPE,
+ text = True,
+ start_new_session = True,
+ )
+ records = []
+ try:
+ deadline = time.monotonic() + 10
+ while not all((tmp_path / f"{name}.json").exists() for name in CHECKS[:2]):
+ assert process.poll() is None
+ assert time.monotonic() < deadline
+ time.sleep(0.02)
+ records = [json.loads((tmp_path / f"{name}.json").read_text()) for name in CHECKS[:2]]
+ process.send_signal(signal.SIGTERM)
+ stdout, stderr = process.communicate(timeout = 10)
+ assert process.returncode == 143, stdout + stderr
+ # the groups write to files: a cancelled or timed-out step still prints what both had run
+ assert "::group::data_settings" in stdout and "::group::settings_tabs" in stdout, (
+ stdout + stderr
+ )
+ for name, record in zip(CHECKS[:2], records):
+ assert (tmp_path / f"{name}.stopped").exists()
+ with pytest.raises(ProcessLookupError):
+ os.kill(record["pid"], 0)
+ assert not (tmp_path / "settings_tabs_blocked.json").exists()
+ finally:
+ if process.poll() is None:
+ os.killpg(process.pid, signal.SIGKILL)
+ process.communicate(timeout = 5)
+ for record_path in tmp_path.glob("*.json"):
+ record = json.loads(record_path.read_text())
+ try:
+ os.kill(record["pid"], signal.SIGKILL)
+ except ProcessLookupError:
+ pass
+
+
+def test_linux_groups_step_times_out_before_the_job():
+ """A job timeout is a cancellation, which skips the failure-only artifact upload; the step's
+ own bound fires first, so a hung check fails the step and its logs are uploaded."""
+ job = yaml.safe_load(WORKFLOW.read_text(encoding = "utf-8"))["jobs"]["build"]
+ step = next(
+ s
+ for s in job["steps"]
+ if s.get("name") == "Browser smoke groups for data settings and frontend controls"
+ )
+ assert 0 < step["timeout-minutes"] < job["timeout-minutes"]
diff --git a/tests/studio/test_settings_smoke_covers_every_tab.py b/tests/studio/test_settings_smoke_covers_every_tab.py
index 6fdca266c8c..37e890e9fd0 100644
--- a/tests/studio/test_settings_smoke_covers_every_tab.py
+++ b/tests/studio/test_settings_smoke_covers_every_tab.py
@@ -68,7 +68,7 @@ def test_the_chunk_fail_tab_is_one_the_dialog_has() -> None:
workflow = (ROOT / ".github" / "workflows" / "studio-frontend-ci.yml").read_text(
encoding = "utf-8"
)
- targets = re.findall(r"PW_CHUNK_FAIL:\s*([a-z0-9-]+)", workflow)
+ targets = re.findall(r"PW_CHUNK_FAIL[:=]\s*([a-z0-9-]+)", workflow)
assert targets, "no PW_CHUNK_FAIL in studio-frontend-ci.yml; the blocked-panel run is not wired"
dialog = set(_dialog_tabs())
unknown = sorted(t for t in set(targets) if t not in dialog)