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.

CI: key the Playwright browser caches on the OS release, and move the WebKit jobs back to ubuntu-latest (#17009)

Daniel Hanc21cc33c8b16
diff --git a/.github/workflows/studio-composer-compatibility.yml b/.github/workflows/studio-composer-compatibility.yml
index 47900898277..8cb31311219 100644
--- a/.github/workflows/studio-composer-compatibility.yml
+++ b/.github/workflows/studio-composer-compatibility.yml
@@ -40,9 +40,7 @@ concurrency:
jobs:
composer:
name: Composer (${{ matrix.os }}, ${{ matrix.suite }})
- # ubuntu-24.04 for the ubuntu-latest leg, keeping its check name: on the ubuntu-26.04 image ubuntu-latest now resolves to, Playwright's WebKit
- # exits at launch (TargetClosedError) even after install-deps. Move back once it starts there.
- runs-on: ${{ matrix.os == 'ubuntu-latest' && 'ubuntu-24.04' || matrix.os }}
+ runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
diff --git a/.github/workflows/studio-frontend-ci.yml b/.github/workflows/studio-frontend-ci.yml
index c951e49a17d..9aaf5777e8a 100644
--- a/.github/workflows/studio-frontend-ci.yml
+++ b/.github/workflows/studio-frontend-ci.yml
@@ -319,6 +319,8 @@ jobs:
run: |
python3 -m pip install 'playwright>=1.45,<2' pytest
echo "version=$(python3 -c 'from importlib.metadata import version; print(version("playwright"))')" >> "$GITHUB_OUTPUT"
+ # Browser builds differ per OS release; one restored onto another release exits at launch.
+ echo "os=$(. /etc/os-release && echo "${ID}-${VERSION_ID}")" >> "$GITHUB_OUTPUT"
# Key identical to the chromium-only shards in studio-ui-smoke.yml, so both share one entry.
- name: Restore the Playwright browser cache
@@ -327,7 +329,7 @@ jobs:
continue-on-error: true
with:
path: ~/.cache/ms-playwright
- key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-c-v2
+ key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-c-v2
- name: Restore the apt archive cache (chromium's .deb set)
id: apt-cache
@@ -335,7 +337,7 @@ jobs:
continue-on-error: true
with:
path: ${{ github.workspace }}/.apt-archives
- key: apt-archives-${{ runner.os }}-${{ env.ImageOS }}-${{ env.ImageVersion }}-c-v1
+ key: apt-archives-${{ runner.os }}-${{ steps.pw.outputs.os }}-c-v1
- name: Install Chromium for browser smokes
working-directory: ${{ github.workspace }}
diff --git a/.github/workflows/studio-inline-images.yml b/.github/workflows/studio-inline-images.yml
index ff1229441c7..2a787e13bb6 100644
--- a/.github/workflows/studio-inline-images.yml
+++ b/.github/workflows/studio-inline-images.yml
@@ -43,9 +43,7 @@ concurrency:
jobs:
images:
name: Inline images (${{ matrix.os }})
- # ubuntu-24.04 for the ubuntu-latest leg, keeping its check name: on the ubuntu-26.04 image ubuntu-latest now resolves to, Playwright's WebKit
- # exits at launch (TargetClosedError) even after install-deps. Move back once it starts there.
- runs-on: ${{ matrix.os == 'ubuntu-latest' && 'ubuntu-24.04' || matrix.os }}
+ runs-on: ${{ matrix.os }}
timeout-minutes: 35
strategy:
fail-fast: false
diff --git a/.github/workflows/studio-ui-smoke.yml b/.github/workflows/studio-ui-smoke.yml
index e8e48d30ffe..6968024291f 100644
--- a/.github/workflows/studio-ui-smoke.yml
+++ b/.github/workflows/studio-ui-smoke.yml
@@ -99,9 +99,7 @@ permissions:
jobs:
ui-smoke:
name: Chat UI Tests (${{ matrix.shard }})
- # ubuntu-24.04, not ubuntu-latest: on the ubuntu-26.04 image ubuntu-latest now resolves to, Playwright's WebKit
- # exits at launch (TargetClosedError) even after install-deps. Move back once it starts there.
- runs-on: ubuntu-24.04
+ runs-on: ubuntu-latest
# Do not tighten: a timeout is for hangs, and runner stalls would turn into red builds.
timeout-minutes: 30
strategy:
@@ -200,15 +198,17 @@ jobs:
run: |
pip install 'playwright>=1.45,<2'
echo "version=$(python -c 'import playwright; from importlib.metadata import version; print(version("playwright"))')" >> "$GITHUB_OUTPUT"
+ # Browser builds differ per OS release; one restored onto another release exits at launch.
+ echo "os=$(. /etc/os-release && echo "${ID}-${VERSION_ID}")" >> "$GITHUB_OUTPUT"
- # Keyed on the resolved Playwright version, which decides the browser builds.
+ # Keyed on the OS release and the resolved Playwright version, which decide the browser builds.
- name: Restore the Playwright browser cache
id: pw-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
continue-on-error: true
with:
path: ~/.cache/ms-playwright
- key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-${{ matrix.engine_key }}-v2
+ key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-${{ matrix.engine_key }}-v2
- name: Restore the apt archive cache (webkit's .deb set)
id: apt-cache
@@ -217,7 +217,7 @@ jobs:
continue-on-error: true
with:
path: ${{ github.workspace }}/.apt-archives
- key: apt-archives-${{ runner.os }}-${{ env.ImageOS }}-${{ env.ImageVersion }}-${{ matrix.engine_key }}-v1
+ key: apt-archives-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ matrix.engine_key }}-v1
- name: Install Playwright browsers
id: pw-install
@@ -357,7 +357,7 @@ jobs:
continue-on-error: true
with:
path: ~/.cache/ms-playwright
- key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-${{ matrix.engine_key }}-v2
+ key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-${{ matrix.engine_key }}-v2
- name: Drive MTP companion download visibility
if: matrix.shard == 'extra'
@@ -789,9 +789,7 @@ jobs:
ui-indicator:
name: Loaded-models indicator (cross-browser)
- # ubuntu-24.04, not ubuntu-latest: on the ubuntu-26.04 image ubuntu-latest now resolves to, Playwright's WebKit
- # exits at launch (TargetClosedError) even after install-deps. Move back once it starts there.
- runs-on: ubuntu-24.04
+ runs-on: ubuntu-latest
env:
# A release published mid-run puts an update card over the controls the scripts click.
UNSLOTH_DISABLE_UPDATE_CHECK: '1'
@@ -834,15 +832,17 @@ jobs:
run: |
pip install 'playwright>=1.45,<2'
echo "version=$(python -c 'import playwright; from importlib.metadata import version; print(version("playwright"))')" >> "$GITHUB_OUTPUT"
+ # Browser builds differ per OS release; one restored onto another release exits at launch.
+ echo "os=$(. /etc/os-release && echo "${ID}-${VERSION_ID}")" >> "$GITHUB_OUTPUT"
- # Keyed on the resolved Playwright version, which decides the browser builds.
+ # Keyed on the OS release and the resolved Playwright version, which decide the browser builds.
- name: Restore the Playwright browser cache
id: pw-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
continue-on-error: true
with:
path: ~/.cache/ms-playwright
- key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-cfw-v2
+ key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-cfw-v2
- name: Restore the apt archive cache (webkit's .deb set)
id: apt-cache
@@ -851,7 +851,7 @@ jobs:
continue-on-error: true
with:
path: ${{ github.workspace }}/.apt-archives
- key: apt-archives-${{ runner.os }}-${{ env.ImageOS }}-${{ env.ImageVersion }}-cfw-v1
+ key: apt-archives-${{ runner.os }}-${{ steps.pw.outputs.os }}-cfw-v1
- name: Install Playwright browsers
id: pw-install
@@ -931,7 +931,7 @@ jobs:
continue-on-error: true
with:
path: ~/.cache/ms-playwright
- key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-cfw-v2
+ key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-cfw-v2
- name: Cross-browser loaded-models indicator
# Engines run in parallel, each with its own port and UNSLOTH_STUDIO_HOME, since the
diff --git a/.github/workflows/studiobench-ci.yml b/.github/workflows/studiobench-ci.yml
index 1d4b0b34579..d939c9bd1dc 100644
--- a/.github/workflows/studiobench-ci.yml
+++ b/.github/workflows/studiobench-ci.yml
@@ -150,6 +150,8 @@ jobs:
run: |
pip install 'playwright>=1.45,<2' psutil
echo "version=$(python -c 'import playwright; from importlib.metadata import version; print(version("playwright"))')" >> "$GITHUB_OUTPUT"
+ # Browser builds differ per OS release; one restored onto another release exits at launch.
+ echo "os=$(. /etc/os-release && echo "${ID}-${VERSION_ID}")" >> "$GITHUB_OUTPUT"
- name: Restore the Playwright browser cache
id: pw-cache
@@ -157,7 +159,7 @@ jobs:
continue-on-error: true
with:
path: ~/.cache/ms-playwright
- key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-c-v2
+ key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-c-v2
# Chromium only: the tracing and CDP instruments exist only there. No --with-deps: it
# runs its own unbounded `apt-get update`; download and apt are separate retries.
@@ -210,7 +212,7 @@ jobs:
continue-on-error: true
with:
path: ~/.cache/ms-playwright
- key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-c-v2
+ key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-c-v2
# No --api-only: studiobench drives the real SPA. No model needed.
- name: Boot Unsloth
diff --git a/.github/workflows/studiobench-ui-parity.yml b/.github/workflows/studiobench-ui-parity.yml
index 681b3145c8d..73b9811a13b 100644
--- a/.github/workflows/studiobench-ui-parity.yml
+++ b/.github/workflows/studiobench-ui-parity.yml
@@ -191,6 +191,8 @@ jobs:
run: |
pip install 'playwright>=1.45,<2' psutil
echo "version=$(python -c 'import playwright; from importlib.metadata import version; print(version("playwright"))')" >> "$GITHUB_OUTPUT"
+ # Browser builds differ per OS release; one restored onto another release exits at launch.
+ echo "os=$(. /etc/os-release && echo "${ID}-${VERSION_ID}")" >> "$GITHUB_OUTPUT"
# Same key as studiobench-ci.yml.
- name: Restore the Playwright browser cache
@@ -199,7 +201,7 @@ jobs:
continue-on-error: true
with:
path: ~/.cache/ms-playwright
- key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-c-v2
+ key: ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-c-v2
# Chromium only, without --with-deps; 2 x 300s + 125s lock wait fits 12 minutes.
- name: Install the Chromium engine
diff --git a/.github/workflows/workflow-trigger-lint.yml b/.github/workflows/workflow-trigger-lint.yml
index f183c4a1fed..49903e381b5 100644
--- a/.github/workflows/workflow-trigger-lint.yml
+++ b/.github/workflows/workflow-trigger-lint.yml
@@ -84,11 +84,11 @@ jobs:
tests/studio/test_backend_ci_parallel_isolation.py \
tests/studio/test_cache_budget_discipline.py \
tests/studio/test_cached_paths_hold_no_credentials.py \
+ tests/studio/test_playwright_cache_keys_name_the_os.py \
tests/studio/test_actions_are_pinned_to_commits.py \
tests/studio/test_local_actions_are_in_path_filters.py \
tests/studio/test_chat_ui_shards_cover_everything.py \
tests/studio/test_ui_shard_engines.py \
- tests/studio/test_webkit_jobs_skip_ubuntu_latest.py \
tests/studio/test_zoo_suite_parallel_isolation.py \
tests/studio/test_core_setup_zoo_revision_notice.py \
tests/studio/test_ci_parallel_browser_results.py \
diff --git a/tests/studio/test_playwright_cache_keys_name_the_os.py b/tests/studio/test_playwright_cache_keys_name_the_os.py
new file mode 100644
index 00000000000..6cbf6bbae0d
--- /dev/null
+++ b/tests/studio/test_playwright_cache_keys_name_the_os.py
@@ -0,0 +1,133 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+"""Playwright browser and apt caches are keyed on the OS release they were built on.
+
+Playwright downloads a WebKit (and Firefox) build per Ubuntu release, e.g.
+webkit-ubuntu-24.04.zip vs webkit-ubuntu-26.04.zip, into the same webkit-<rev> folder.
+A cache saved on one release and restored on another reports a hit, `playwright install`
+skips the download, and WebKit exits at launch (TargetClosedError) even after
+install-deps. That is what broke the WebKit jobs when ubuntu-latest moved to 26.04 (a
+24.04 build restored there) and again on 24.04 in a repo whose cache was saved on 26.04.
+
+`${{ env.ImageOS }}` does not help: the runner's ImageOS / ImageVersion are shell
+variables, not part of the `env` expression context, so they expand to nothing in a key.
+"""
+
+import re
+from pathlib import Path
+
+import pytest
+import yaml
+
+REPO = Path(__file__).resolve().parents[2]
+WORKFLOWS = REPO / ".github" / "workflows"
+
+CACHED_PATHS = ("ms-playwright", ".apt-archives")
+OS_OUTPUT = re.compile(r"\$\{\{\s*steps\.([\w-]+)\.outputs\.os\s*\}\}")
+PRIMARY_KEY = re.compile(r"^\$\{\{\s*steps\.([\w-]+)\.outputs\.cache-primary-key\s*\}\}$")
+RUNNER_ONLY_ENV = re.compile(r"\$\{\{\s*env\.(ImageOS|ImageVersion)\s*\}\}")
+
+
+def _cache_steps():
+ """(workflow, job, steps, index, step) for every actions/cache step over a browser or apt path."""
+ out = []
+ for wf in sorted(WORKFLOWS.glob("*.yml")):
+ data = yaml.safe_load(wf.read_text(encoding = "utf-8")) or {}
+ for job_id, job in (data.get("jobs") or {}).items():
+ steps = job.get("steps") or []
+ for i, step in enumerate(steps):
+ if not str(step.get("uses", "")).startswith("actions/cache"):
+ continue
+ path = str((step.get("with") or {}).get("path", ""))
+ if any(p in path for p in CACHED_PATHS):
+ out.append((wf.name, job_id, steps, i, step))
+ return out
+
+
+def _writes_os_release(step) -> bool:
+ run = str(step.get("run", ""))
+ return bool(re.search(r"echo\s+\"os=\$\(\.\s+/etc/os-release\b", run)) and "VERSION_ID" in run
+
+
+def _key_problem(
+ steps,
+ i,
+ key: str,
+ seen = (),
+):
+ m = PRIMARY_KEY.match(key.strip())
+ if m:
+ ref = m.group(1)
+ src = [(j, s) for j, s in enumerate(steps[:i]) if s.get("id") == ref]
+ if not src or ref in seen:
+ return (
+ f"reuses the primary key of `{ref}`, which is not an earlier cache step in this job"
+ )
+ j, s = src[0]
+ return _key_problem(steps, j, str((s.get("with") or {}).get("key", "")), seen + (ref,))
+ if RUNNER_ONLY_ENV.search(key):
+ return "uses ${{ env.ImageOS }} / ${{ env.ImageVersion }}, which expand to nothing in a key"
+ m = OS_OUTPUT.search(key)
+ if not m:
+ return "does not name the OS release (expected ${{ steps.<id>.outputs.os }})"
+ producers = [s for s in steps[:i] if s.get("id") == m.group(1)]
+ if not producers or not _writes_os_release(producers[0]):
+ return f"reads steps.{m.group(1)}.outputs.os, but no earlier step `{m.group(1)}` writes it from /etc/os-release"
+ return None
+
+
+CASES = _cache_steps()
+
+
+def test_the_scan_still_finds_the_browser_caches():
+ # studio-ui-smoke (2 jobs), studio-frontend-ci, studiobench-ci, studiobench-ui-parity.
+ browser = [c for c in CASES if "ms-playwright" in str(c[4]["with"]["path"])]
+ assert len({(c[0], c[1]) for c in browser}) >= 5, sorted({(c[0], c[1]) for c in browser})
+
+
+ "wf,job,steps,i,step",
+ CASES,
+ ids = [f"{c[0]}::{c[1]}::{c[4].get('name', c[3])}" for c in CASES],
+)
+def test_the_cache_key_names_the_os_release(wf, job, steps, i, step):
+ key = str((step.get("with") or {}).get("key", ""))
+ problem = _key_problem(steps, i, key)
+ assert problem is None, f"{wf}::{job} step {step.get('name')!r}: key {key!r} {problem}"
+
+
+ "key,ok",
+ [
+ (
+ "ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-cfw-v2",
+ True,
+ ),
+ ("ms-playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}-cfw-v2", False),
+ ("apt-archives-${{ runner.os }}-${{ env.ImageOS }}-${{ env.ImageVersion }}-cfw-v1", False),
+ ("ms-playwright-${{ runner.os }}-${{ steps.other.outputs.os }}-v2", False),
+ ],
+)
+def test_the_key_check_itself(key, ok):
+ steps = [
+ {
+ "id": "pw",
+ "run": 'echo "os=$(. /etc/os-release && echo "${ID}-${VERSION_ID}")" >> "$GITHUB_OUTPUT"',
+ },
+ {"id": "other", "run": 'echo "os=linux" >> "$GITHUB_OUTPUT"'},
+ {
+ "uses": "actions/cache/restore@x",
+ "id": "pw-cache",
+ "with": {"path": "~/.cache/ms-playwright", "key": key},
+ },
+ {
+ "uses": "actions/cache/save@x",
+ "with": {
+ "path": "~/.cache/ms-playwright",
+ "key": "${{ steps.pw-cache.outputs.cache-primary-key }}",
+ },
+ },
+ ]
+ assert (_key_problem(steps, 2, key) is None) is ok
+ assert (_key_problem(steps, 3, steps[3]["with"]["key"]) is None) is ok
diff --git a/tests/studio/test_webkit_jobs_skip_ubuntu_latest.py b/tests/studio/test_webkit_jobs_skip_ubuntu_latest.py
deleted file mode 100644
index a6db857a0ad..00000000000
--- a/tests/studio/test_webkit_jobs_skip_ubuntu_latest.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# SPDX-License-Identifier: AGPL-3.0-only
-# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved.
-"""No workflow job that drives Playwright WebKit runs on ubuntu-latest.
-
-ubuntu-latest now resolves to the ubuntu-26.04 image, where Playwright's WebKit exits at launch (TargetClosedError)
-even after install-deps, and every Linux job that probes or drives it goes red. Those jobs pin ubuntu-24.04; a matrix
-leg named ubuntu-latest keeps its check name and maps to ubuntu-24.04 in runs-on.
-"""
-
-from __future__ import annotations
-
-import json
-import re
-from pathlib import Path
-
-import pytest
-import yaml
-
-REPO = Path(__file__).resolve().parents[2]
-WORKFLOWS = REPO / ".github" / "workflows"
-MAPPED = "${{ matrix.os == 'ubuntu-latest' && 'ubuntu-24.04' || matrix.os }}"
-
-
-def _matrix_oses(job: dict) -> list[str]:
- matrix = (job.get("strategy") or {}).get("matrix") or {}
- oses = list(matrix.get("os") or [])
- oses += [row["os"] for row in matrix.get("include") or [] if "os" in row]
- return oses
-
-
-def runners(job: dict) -> list[str]:
- """The images a job lands on, resolving the two runs-on spellings used here."""
- runs_on = job.get("runs-on")
- if not isinstance(runs_on, str):
- return [json.dumps(runs_on)]
- if "matrix.os" not in runs_on:
- return [runs_on]
- oses = _matrix_oses(job)
- if runs_on.replace(" ", "") == "${{matrix.os}}":
- return oses
- if runs_on == MAPPED:
- return ["ubuntu-24.04" if os == "ubuntu-latest" else os for os in oses]
- pytest.fail(f"teach this guard the runs-on expression {runs_on!r}")
-
-
-def webkit_jobs() -> list[tuple[str, str, dict]]:
- """Jobs that drive Playwright with WebKit as an engine; a file name such as test_webkit_*.py is not one."""
- found = []
- for path in sorted(WORKFLOWS.glob("*.yml")):
- doc = yaml.safe_load(path.read_text(encoding = "utf-8")) or {}
- for name, job in (doc.get("jobs") or {}).items():
- text = json.dumps(job.get("steps") or []) + json.dumps(job.get("strategy") or {})
- if "playwright" in text and re.search(r"\bwebkit\b", text):
- found.append((path.name, name, job))
- return found
-
-
-def test_the_guard_sees_the_webkit_jobs():
- names = {(wf, job) for wf, job, _ in webkit_jobs()}
- assert {
- ("studio-ui-smoke.yml", "ui-smoke"),
- ("studio-ui-smoke.yml", "ui-indicator"),
- ("studio-composer-compatibility.yml", "composer"),
- ("studio-inline-images.yml", "images"),
- } <= names, names
-
-
-def test_no_webkit_job_runs_on_ubuntu_latest():
- offenders = [
- f"{wf}::{job}" for wf, job, spec in webkit_jobs() if "ubuntu-latest" in runners(spec)
- ]
- assert not offenders, (
- "these jobs drive Playwright WebKit on ubuntu-latest, whose ubuntu-26.04 image WebKit does not start on: "
- f"{offenders}. Pin ubuntu-24.04 (or map a matrix leg with {MAPPED})."
- )
-
-
- ("job", "expected"),
- [
- ({"runs-on": "ubuntu-latest"}, ["ubuntu-latest"]),
- ({"runs-on": "ubuntu-24.04"}, ["ubuntu-24.04"]),
- (
- {
- "runs-on": "${{ matrix.os }}",
- "strategy": {"matrix": {"os": ["ubuntu-latest", "macos-latest"]}},
- },
- ["ubuntu-latest", "macos-latest"],
- ),
- (
- {
- "runs-on": MAPPED,
- "strategy": {
- "matrix": {"include": [{"os": "ubuntu-latest"}, {"os": "windows-latest"}]}
- },
- },
- ["ubuntu-24.04", "windows-latest"],
- ),
- ],
-)
-def test_runners_resolves_each_spelling(job, expected):
- assert runners(job) == expected