* refactor(launchpad): quieter, borderless design refresh The launchpad carried decoration from an earlier direction: icon chips, corner-hung count badges, a permanently visible filled arrow, uppercase mono card titles, and a dotted stipple divider — plus a frame that had been invisible since the app-wide border tokens were zeroed. Rework it around what the borderless direction actually implies: - Feature tiles get a whisper-faint surface instead of a dead frame, and read as three bands (bare glyph + count / title + arrow / description). `--card-hue` is spent sparingly — the glyph at rest, the surface, count and arrow only once raised. Titles move to sans sentence case; counts are plain tabular numerals. Lift softened 4px -> 2px, coloured glow -> neutral shadow, plus an explicit focus ring and a staggered entrance. - Hero drops the boxed "646" pill and the filled A/B-Compare button for quiet type, with a hairline standing in for the separation. - Section labels trade the dotted stipple for a single fading hairline; rows are transparent until hover and reveal "Open" on hover/focus (it stays in the DOM, so AT and keyboard always reach it). - Hero, tiles, recent files, callout and project lists now share one 1180px column — previously only the top half was capped, so lists ran edge-to-edge on a wide display while the deck stayed centred. Two bugs found and fixed while doing it: - Buttons that had `border border-solid border-transparent` removed fell back to the UA default border and rendered a visible 1px outline. They now carry `border-0` explicitly. - `.lp-animate` used `animation-fill-mode: both`, so after the entrance it kept owning `transform` — and animation-origin declarations outrank normal ones, which silently killed the card hover lift. Now `backwards`, which still holds the from-state through the stagger delay. Also drops CSS the page has not rendered since #904: the cursor-spotlight layer, the breath ring, and the per-card waveform strip. Verified with headless renders at 1600/1280/940 and the empty state. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(dictation): decode Wayland portal signals and show the capture pill The GlobalShortcuts portal declares Activated/Deactivated as (o session, s shortcut_id, t timestamp, a{sv} options). We decoded the timestamp as u32, so zbus rejected every signal with Signature mismatch: got `(osta{sv})`, expected `(osua{sv})` and the press was dropped as an invalid signal. Registration succeeded and the desktop even reported the bound chord back, so the hotkey looked wired up while doing nothing at all — on every Wayland compositor, for the whole life of the feature (#1490). Decode the 64-bit timestamp, and keep the 32-bit spelling as a fallback so a non-conforming portal degrades to working rather than to silence. With presses arriving, the second half of the failure showed: nothing had shown the widget window since it became a hidden recorder host, so a capture ran with no pill on screen — and a mic or Accessibility failure rendered into a window nobody could see. Add show_dictation_pill, which bottom-centres the capsule on the monitor under the pointer and shows it without taking focus (Windows keeps SW_SHOWNOACTIVATE so paste still lands in the user's document), and call it from the widget for every state but idle. Wayland denies clients their own placement, so the compositor picks the spot there; the pill still appears. dispatch_dictation_capture now logs whether a press was emitted or queued — a press that reaches Rust and produces nothing was otherwise indistinguishable from one the compositor never delivered. Tests: portal signals decode at both timestamp widths (the 64-bit case fails before this change with the exact production error); pill placement centres, respects a second monitor's origin, and clamps rather than going off-screen; the widget shows for a state needing the user, stays hidden while idle, and never shows for a press that arrives while dictation is disabled. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore: sync in-progress workspace changes Uncommitted work already in the tree, checkpointed so the branch matches the local machine: - Remote GPU workers: join-from-the-app flow, one-time secrets, QR join codes, a Compute control in the status bar, and the device-list Workers panel (#1516) - Model Catalogue workspace, with Settings pointing at it - Settings sidebar search and keyboard navigation - Demo assets for dubbing, dictation and voice design, plus the scripts that render them - Backend: validation-error handling, ASR request-path degradation, and the accompanying tests - CHANGELOG entries for the above and for the Wayland dictation fix Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(tests): follow Engines to the Model Catalogue, and green the sweep - test_supertonic3 asserted the license gate points at "Settings" while the engine now names Model Catalogue → Engines, which is where the accept button actually lives. The assertion follows the move; what it pins is unchanged — the hint must name a place the user can reach it. - Carries the CJK allowlist entries for the rendered dub bundle (#1517) and the regenerated route snapshot for /workers/agent (#1516), both of which this branch inherits from the workspace sync. - docs/install/linux.md: the dictation capsule is bottom-anchored everywhere except Wayland, where the protocol gives applications no say in their placement. Documented rather than left as a surprise (CodeRabbit). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * ci: stop a flaky dependency fetch from failing green runs en-core-web-sm resolves to a direct GitHub release URL, and github.com intermittently answers `http2 error: refused stream before processing any application logic`. uv's own three retries all land within the same few seconds and fail together, so the whole job dies on a dependency that has nothing to do with the change under test — it cost #1518 and #1517 an otherwise-green run tonight. Two changes: back off between whole `uv sync` attempts, which is what actually clears it, and pass --no-sync to the pytest steps. `uv run` re-resolves the environment before running, so every test step was a fresh chance to hit the same fetch even though the install step had already synced — that is exactly how #1518 failed, in the isolated backend/tests step, with all 5467 tests already passed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * ci: one retry seam for every uv sync, not just the job that failed last en-core-web-sm resolves to a direct GitHub *release* URL rather than a package index, and github.com intermittently answers `http2 error: refused stream before processing any application logic`. uv's own retries all land inside the same ~10 seconds and fail together, so a job dies on a dependency unrelated to the change under test. Tonight that cost four otherwise-green runs across #1515, #1517 and #1518 — and the first fix only covered the Tests job, so the next failure simply moved to Smoke (Linux), which syncs separately. The fetch is per-job, so the fix has to be per-job: scripts/uv-sync-retry.sh backs off between whole attempts (15s, 45s, 90s) and every workflow that syncs now goes through it — ci.yml (tests + the platform matrix), release.yml, security.yml, evals.yml. It still fails loudly after four attempts, so a genuinely broken lockfile is not disguised as a flake. The Tests job also lacked the UV_HTTP_TIMEOUT / UV_HTTP_RETRIES the smoke matrix has always set, which is part of why it was the one that kept dying; it has them now. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * test(ci): pin the Intel-Mac contract by intent, not by command spelling test_ci_verifies_intel_mac_as_the_documented_remote_only_host asserted the literal line `run: uv sync --extra pockettts`, so routing every sync through scripts/uv-sync-retry.sh read as a broken Intel-Mac contract. The contract it exists to protect is that the pockettts extra installs ONLY on backend_supported legs — which the regex now pins, while leaving how the sync is invoked free to change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * ci: keep every uv run out of the resolver, and bound the retry budget CodeRabbit, #1517: - `uv run` re-resolves before running, so the smoke suite, the worker-artifact tests, the release test run and the eval run were each a fresh chance to hit the flaky direct-URL fetch outside the retry loop. All of them pass --no-sync now; the environment is already synced by the step that owns the retries. security.yml's `uv run --with pip-audit` is deliberately left alone — it layers an ephemeral package rather than running the project's own tests. - The retry count multiplied uv's own budget (UV_HTTP_RETRIES=5 with a 120 s timeout on the smoke matrix). Three attempts and 60 s of total backoff outlast the refusals actually observed while staying well inside the jobs' timeout-minutes. - The Intel-Mac contract test pinned the smoke command literally too, so --no-sync tripped it exactly like the sync line did. Same fix: assert the contract (smoke runs only on backend_supported legs), not its spelling. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
226 lines
9.4 KiB
Python
226 lines
9.4 KiB
Python
"""#874: a model download that fails because the CONFIGURED Hugging Face
|
|
mirror (HF_ENDPOINT, Settings → Models → Hugging Face mirror) is unreachable
|
|
must surface an actionable error that (1) names the mirror, (2) says it may be
|
|
down, (3) points at the setting AND says downloads pick up a mirror change
|
|
immediately (the download paths resolve the endpoint per call — the old hint
|
|
falsely claimed a restart was always required, dead-ending first-run users
|
|
whose only recovery path is switch-and-retry inside the wizard), and
|
|
(4) suggests the official endpoint when the model isn't cached — instead of
|
|
leaking the raw transformers message ("We couldn't connect to
|
|
'https://hf-mirror.com' …") as a bare 500 detail.
|
|
|
|
Fail-before/pass-after: before the fix `classify()` had no mirror class and
|
|
`build_failure()` / `append_hf_mirror_hint()` attached no hint to these
|
|
reasons. Also covers the #886 family: when the incomplete-cache auto-repair
|
|
fails, the surfaced message now names WHY (so a mirror outage / offline mode /
|
|
full disk stop reading identically).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from types import SimpleNamespace
|
|
|
|
import pytest
|
|
|
|
from core import failure
|
|
|
|
# The exact transformers wording from issue #874 (mirror down, model not cached).
|
|
_TRANSFORMERS_874 = (
|
|
"We couldn't connect to 'https://hf-mirror.com' to load the files, and "
|
|
"couldn't find them in the cached files.\n"
|
|
"Check your internet connection or see how to run the library in offline "
|
|
"mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'."
|
|
)
|
|
|
|
# huggingface_hub / requests shape: names the mirror HOST, not the full URL.
|
|
_HUB_CONN_ERROR = (
|
|
"(MaxRetryError(\"HTTPSConnectionPool(host='hf-mirror.com', port=443): "
|
|
"Max retries exceeded with url: /api/models/k2-fsa/OmniVoice (Caused by "
|
|
"NewConnectionError('Failed to establish a new connection: "
|
|
"[Errno 61] Connection refused'))\"))"
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def mirror_env(monkeypatch):
|
|
monkeypatch.setenv("HF_ENDPOINT", "https://hf-mirror.com")
|
|
|
|
|
|
def test_transformers_connect_error_classifies_as_mirror(mirror_env):
|
|
assert failure.classify(_TRANSFORMERS_874) == "HF_MIRROR_UNREACHABLE"
|
|
|
|
|
|
def test_hub_connection_error_classifies_by_host(mirror_env):
|
|
assert failure.classify(_HUB_CONN_ERROR) == "HF_MIRROR_UNREACHABLE"
|
|
|
|
|
|
def test_hint_names_mirror_setting_retry_and_official(mirror_env):
|
|
evt = failure.build_failure(
|
|
OSError(_TRANSFORMERS_874), stage="model-load", include_diagnostic=False
|
|
)
|
|
assert evt["docs_topic"] == "HF_MIRROR_UNREACHABLE"
|
|
hint = evt["hint"]
|
|
assert "https://hf-mirror.com" in hint # (1) names the configured mirror
|
|
assert "may be down" in hint # (2) says it may be down
|
|
# (3) the setting path + the truth about when the change applies: downloads
|
|
# resolve the endpoint per call, so switch-and-retry works WITHOUT a
|
|
# restart — the old "applied when the app starts" claim dead-ended
|
|
# first-run users, who can't reach Settings and would lose wizard progress.
|
|
assert "Settings → Models → Hugging Face mirror" in hint
|
|
assert "immediately" in hint
|
|
assert "applied when the app starts" not in hint
|
|
# Restart survives only as the fallback for import-time readers
|
|
# (transformers-side model loads) when a retry still fails.
|
|
assert "restart" in hint.lower()
|
|
# (4) suggests the official endpoint for an un-cached model
|
|
assert "Hugging Face (official)" in hint
|
|
|
|
|
|
def test_timeout_with_mirror_not_misclassified_as_video_network(mirror_env):
|
|
# A bare "timed out" used to fall into VIDEO_DOWNLOAD_NETWORK, whose hint
|
|
# talks about "the video server" — a model download naming the mirror host
|
|
# must classify as the mirror class instead.
|
|
reason = "HTTPSConnectionPool(host='hf-mirror.com', port=443): Read timed out."
|
|
assert failure.classify(reason) == "HF_MIRROR_UNREACHABLE"
|
|
|
|
|
|
def test_no_class_without_configured_mirror(monkeypatch):
|
|
# The same #874 reason with NO mirror configured: not this class (the
|
|
# official endpoint being unreachable is plain connectivity, not a
|
|
# switch-your-mirror problem).
|
|
monkeypatch.delenv("HF_ENDPOINT", raising=False)
|
|
from core import prefs
|
|
|
|
monkeypatch.setattr(prefs, "get", lambda key, default=None: default)
|
|
assert failure.classify(_TRANSFORMERS_874) == ""
|
|
assert failure.hf_mirror_hint(_TRANSFORMERS_874) == ""
|
|
|
|
|
|
def test_official_endpoint_is_not_a_mirror(monkeypatch):
|
|
monkeypatch.setenv("HF_ENDPOINT", "https://huggingface.co")
|
|
assert failure.hf_mirror_hint(_TRANSFORMERS_874) == ""
|
|
# Trailing slash normalizes away too.
|
|
monkeypatch.setenv("HF_ENDPOINT", "https://huggingface.co/")
|
|
assert failure.hf_mirror_hint(_TRANSFORMERS_874) == ""
|
|
|
|
|
|
def test_non_hf_connectivity_error_gets_no_mirror_hint(mirror_env):
|
|
# A random socket failure (e.g. a local LLM provider being down) while a
|
|
# mirror happens to be configured must NOT get the mirror hint.
|
|
assert failure.hf_mirror_hint("Connection refused by localhost:11434") == ""
|
|
|
|
|
|
def test_append_helper_appends_or_passes_through(mirror_env):
|
|
# append_hf_mirror_hint is the 500-detail surface (main.py global handler)
|
|
# and the model-install SSE surface (setup/download.py).
|
|
out = failure.append_hf_mirror_hint(_TRANSFORMERS_874)
|
|
assert out.startswith(_TRANSFORMERS_874)
|
|
assert "Settings → Models → Hugging Face mirror" in out
|
|
assert failure.append_hf_mirror_hint("some unrelated failure") == "some unrelated failure"
|
|
|
|
|
|
def test_journal_classifies_mirror_download_as_network_error(mirror_env):
|
|
# Bug reports auto-attach the journal entry — #874's error was UNKNOWN.
|
|
from core import error_journal
|
|
|
|
assert error_journal.classify_exception(OSError(_TRANSFORMERS_874)) == "NETWORK_ERROR"
|
|
|
|
|
|
# ── #886 family: the incomplete-cache auto-repair failure names its cause ───
|
|
|
|
|
|
@pytest.fixture
|
|
def model_manager(monkeypatch):
|
|
for mod_name in ("core.config", "services.model_manager"):
|
|
if getattr(sys.modules.get(mod_name), "__file__", None) is None:
|
|
sys.modules.pop(mod_name, None)
|
|
|
|
import services.model_manager as mm
|
|
|
|
monkeypatch.setattr(mm, "_torch", None)
|
|
monkeypatch.setattr(mm, "_OmniVoice", None)
|
|
monkeypatch.setattr(mm, "model", None)
|
|
monkeypatch.setenv("OMNIVOICE_MODEL", "test/checkpoint")
|
|
monkeypatch.delenv("OMNIVOICE_PRELOAD_TTS_ASR", raising=False)
|
|
monkeypatch.delenv("HF_HUB_OFFLINE", raising=False)
|
|
monkeypatch.delenv("TRANSFORMERS_OFFLINE", raising=False)
|
|
monkeypatch.setattr(mm, "_lazy_torch", lambda: SimpleNamespace(float16="float16"))
|
|
monkeypatch.setattr(mm, "get_best_device", lambda: "cpu")
|
|
monkeypatch.setattr(mm, "_last_repair_error", "")
|
|
return mm
|
|
|
|
|
|
_TRUNCATED = OSError(
|
|
"test/checkpoint does not appear to have a file named pytorch_model.bin "
|
|
"or model.safetensors"
|
|
)
|
|
|
|
|
|
def test_repair_records_why_it_failed(model_manager, monkeypatch):
|
|
import huggingface_hub
|
|
from services import hf_revisions
|
|
|
|
monkeypatch.setitem(
|
|
hf_revisions.CURATED_REVISIONS,
|
|
"test/checkpoint",
|
|
"a" * 40,
|
|
)
|
|
|
|
def boom(**kwargs):
|
|
raise OSError(_TRANSFORMERS_874)
|
|
|
|
monkeypatch.setattr(huggingface_hub, "snapshot_download", boom)
|
|
monkeypatch.setenv("OMNIVOICE_MODEL_REPAIR_BACKOFF_S", "0")
|
|
monkeypatch.setenv("OMNIVOICE_MODEL_REPAIR_RETRIES", "1")
|
|
assert model_manager._repair_model_cache("test/checkpoint") is False
|
|
assert "hf-mirror.com" in model_manager._last_repair_error
|
|
|
|
|
|
def test_repair_failure_message_names_cause_and_mirror(model_manager, monkeypatch, mirror_env):
|
|
"""#886 family: 'could not be auto-repaired' used to drop the cause, so a
|
|
mirror outage, offline mode, and a full disk all read identically. The
|
|
message now carries the cause — and because the cause text is part of the
|
|
surfaced error, the shared #874 mirror hint fires on it downstream."""
|
|
monkeypatch.setattr(
|
|
model_manager, "_repair_model_cache", lambda checkpoint, **kw: False
|
|
)
|
|
monkeypatch.setattr(
|
|
model_manager, "_last_repair_error", f"OSError: {_TRANSFORMERS_874}"
|
|
)
|
|
|
|
class BrokenOmniVoice:
|
|
@staticmethod
|
|
def from_pretrained(*args, **kwargs):
|
|
raise _TRUNCATED
|
|
|
|
monkeypatch.setattr(model_manager, "_lazy_omnivoice", lambda: BrokenOmniVoice)
|
|
|
|
with pytest.raises(RuntimeError) as exc_info:
|
|
model_manager._load_model_sync()
|
|
msg = str(exc_info.value)
|
|
assert "incomplete" in msg # the existing actionable class is preserved
|
|
assert "Model Catalogue → Models" in msg
|
|
assert "hf-mirror.com" in msg # NEW: the cause is named
|
|
# …and the surfaced text now carries enough signal for the shared mirror
|
|
# hint to fire on the 500-detail surface (main.py appends it).
|
|
assert failure.hf_mirror_hint(msg) != ""
|
|
|
|
|
|
def test_repair_failure_without_cause_keeps_legacy_message(model_manager, monkeypatch):
|
|
"""No recorded cause (e.g. tests/plugins stubbing repair) → the message is
|
|
byte-compatible with the pre-#874 wording, no dangling clause."""
|
|
monkeypatch.setattr(
|
|
model_manager, "_repair_model_cache", lambda checkpoint, **kw: False
|
|
)
|
|
monkeypatch.setattr(model_manager, "_last_repair_error", "")
|
|
|
|
class BrokenOmniVoice:
|
|
@staticmethod
|
|
def from_pretrained(*args, **kwargs):
|
|
raise _TRUNCATED
|
|
|
|
monkeypatch.setattr(model_manager, "_lazy_omnivoice", lambda: BrokenOmniVoice)
|
|
|
|
with pytest.raises(RuntimeError, match="interrupted download"):
|
|
model_manager._load_model_sync()
|