Skip to content

Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.

release(v4.19.3): your GitHub login stays yours, and bug reports say what happened

mrbizarro597c697c7030
diff --git a/README.md b/README.md
index 1776f6c..a79742d 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@
</p>
-> **Current release: v4.19.2.** **Ingredients puts your reference pictures in the video again** on LTX-2.3 (#101), and you can **switch the LTX generation (2.3 or 2.5) from the panel** (@blackest, #102; 2.5 stays the default). High · 720p renders High · 720p, Upscale ×2 refuses a result bigger than QHD before it starts (@blackest, #103), One Shot gets Stop early and a smarter Split (@blackest, #97-#99), room tone sits at -38 LUFS (@blackest, #100), and fewer renders fail: missing pictures, keyframes and LoRAs are caught when you press Generate, the GPU-watchdog message says what can actually help, and vocal separation rides out a flaky connection. Linux on Apple Silicon arrives as a community-maintained, best-effort target (@joshuaswarren, #94). 4.19.1: voices trained in Phosphene save correctly again, and a stopped training run says why. **4.19.0: Hailuo H3 grows up, and trained characters look like themselves again.** On Hailuo H3: **Keyframes** (an end frame, first + last, or stills at exact moments), **Extend** any clip, **Lip-sync** a face to your own voice or song, **Add sound** to a silent clip, smoother 10-15 s shots (each window carries the end of the last one, picture and sound), and **Fast HD**. Characters and voices trained in Phosphene since June were saved with their numbers in the wrong order and carried no likeness; new trainings save correctly and **Update repairs the ones you already have** (found by @tanis2000, #62). **Extend no longer wears your clip down** round after round: the part you already had is delivered untouched and only the new part is encoded (#48). 4.18.0: Play all, Use this audio for..., LoRA-aware Enhance. Press Update in Pinokio, then restart. Full notes on the [releases page](https://github.com/mrbizarro/Phosphene/releases).
+> **Current release: v4.19.3.** **Phosphene no longer touches your GitHub login:** a maintainer-only statistics job ran on every install and, if the GitHub command-line tool was signed in, borrowed its token once a day; it now runs only on the maintainer's Mac (#106). **Report a bug** asks what happened before it opens the issue, and the log it attaches keeps the error lines. **4.19.2:** **Ingredients puts your reference pictures in the video again** on LTX-2.3 (#101), and you can **switch the LTX generation (2.3 or 2.5) from the panel** (@blackest, #102; 2.5 stays the default). High · 720p renders High · 720p, Upscale ×2 refuses a result bigger than QHD before it starts (@blackest, #103), One Shot gets Stop early and a smarter Split (@blackest, #97-#99), room tone sits at -38 LUFS (@blackest, #100), and fewer renders fail: missing pictures, keyframes and LoRAs are caught when you press Generate, the GPU-watchdog message says what can actually help, and vocal separation rides out a flaky connection. Linux on Apple Silicon arrives as a community-maintained, best-effort target (@joshuaswarren, #94). 4.19.1: voices trained in Phosphene save correctly again, and a stopped training run says why. **4.19.0: Hailuo H3 grows up, and trained characters look like themselves again.** On Hailuo H3: **Keyframes** (an end frame, first + last, or stills at exact moments), **Extend** any clip, **Lip-sync** a face to your own voice or song, **Add sound** to a silent clip, smoother 10-15 s shots (each window carries the end of the last one, picture and sound), and **Fast HD**. Characters and voices trained in Phosphene since June were saved with their numbers in the wrong order and carried no likeness; new trainings save correctly and **Update repairs the ones you already have** (found by @tanis2000, #62). **Extend no longer wears your clip down** round after round: the part you already had is delivered untouched and only the new part is encoded (#48). 4.18.0: Play all, Use this audio for..., LoRA-aware Enhance. Press Update in Pinokio, then restart. Full notes on the [releases page](https://github.com/mrbizarro/Phosphene/releases).
## Overview
diff --git a/VERSION b/VERSION
index fe93d34..11533fc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.19.2
+4.19.3
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 20b9940..59f6b31 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -5616,11 +5616,20 @@ def get_version_state() -> dict:
# Repo-stats background fetcher (Mr Bizarro's solo-maintainer dashboard).
# Runs the stdlib-only fetcher script as a subprocess once per 24h, appending
# a JSON line to state/stats-data.jsonl. Dashboard at /stats reads this file.
-# 127.0.0.1-only by design (state/ is gitignored, file lives on the user's
-# Mac only). Skipped silently if no GitHub token is resolvable — this fetcher
-# is opt-in via "have a token configured". It only READS GitHub's API and
-# sends nothing anywhere; the panel's outbound usage analytics is a separate
-# module entirely (see "Anonymous usage analytics" / docs/ANALYTICS.md).
+# 127.0.0.1-only by design (state/ is gitignored, file lives on the
+# maintainer's Mac only). It only READS GitHub's API and sends nothing
+# anywhere; the panel's outbound usage analytics is a separate module
+# entirely (see "Anonymous usage analytics" / docs/ANALYTICS.md).
+#
+# OPT-IN ONLY (4.19.3, issue #106). Until 4.19.2 this loop started on EVERY
+# install and, to find a token, ran the user's own `gh auth token` — so any
+# user with the GitHub CLI logged in had the panel silently borrow THEIR
+# GitHub credentials once a day to read OUR repo's traffic numbers, and
+# everyone else got "stats: no GitHub token resolvable ..." in their log and
+# in their bug reports. The one rule now: nothing in this section runs, reads
+# a token, spawns `gh` or logs a line unless the process was started with
+# PHOSPHENE_STATS_FETCH=1. The maintainer's daily archive does not need it —
+# a launchd job keeps it (scripts/STATS_DASHBOARD.md).
# ---------------------------------------------------------------------------
_STATS_POLL_INTERVAL_SEC = 24 * 60 * 60 # daily
@@ -5628,13 +5637,30 @@ _STATS_STARTUP_DELAY_SEC = 90 # let the panel finish booting first
_STATS_MIN_REFETCH_SEC = 6 * 60 * 60 # don't re-fetch faster than every 6h
+STATS_FETCH_ENV = "PHOSPHENE_STATS_FETCH"
+
+
+def _stats_fetch_enabled() -> bool:
+ """True only when this process was started with PHOSPHENE_STATS_FETCH=1
+ (or true/yes/on). Read at call time, never cached, so a test can flip it.
+ Every entry point of the repo-stats fetcher checks this FIRST — before
+ any token lookup, any `gh` subprocess and any log line — see the
+ section header for why (issue #106)."""
+ return _optional_bool_env(STATS_FETCH_ENV) is True
+
+
def _resolve_github_token() -> str:
"""Token resolution for the stats fetcher, in priority order:
1. PHOSPHENE_REPO_STATS_TOKEN — explicit override for this purpose
2. GH_STATS_TOKEN — fetcher's own preferred name
3. GH_TOKEN / GITHUB_TOKEN — generic env vars
4. `gh auth token` subprocess (when gh CLI is installed + authed)
- Returns empty string if nothing works — caller logs once and skips."""
+ Returns empty string if nothing works — caller logs once and skips.
+
+ Without the PHOSPHENE_STATS_FETCH opt-in this returns "" at once: no
+ environment variable is read and `gh` is never run."""
+ if not _stats_fetch_enabled():
+ return ""
for name in ("PHOSPHENE_REPO_STATS_TOKEN", "GH_STATS_TOKEN",
"GH_TOKEN", "GITHUB_TOKEN"):
v = (os.environ.get(name) or "").strip()
@@ -5675,6 +5701,10 @@ def _run_stats_fetch_once() -> None:
docstring. Idempotent — the fetcher itself replaces today's row on
re-runs in the same UTC day."""
global _STATS_WARNED_NO_TOKEN, _STATS_WARNED_FETCH_FAIL
+ if not _stats_fetch_enabled():
+ return # not the maintainer's opt-in: no token, no `gh`, no log line
+ if STATS_READONLY:
+ return # the archive belongs to another install; see STATS_SOURCE_DIR
if not STATS_FETCHER.is_file():
return # repo install missing the script — fail silent
token = _resolve_github_token()
@@ -5688,8 +5718,6 @@ def _run_stats_fetch_once() -> None:
)
_STATS_WARNED_NO_TOKEN = True
return
- if STATS_READONLY:
- return # the archive belongs to another install; see STATS_SOURCE_DIR
env = os.environ.copy()
env["GITHUB_TOKEN"] = token
# Write the archive the dashboard READS. The fetcher's own default is
@@ -5744,7 +5772,12 @@ def stats_fetch_loop() -> None:
file is missing or stale), then daily on _STATS_POLL_INTERVAL_SEC.
The startup-fetch is gated by _STATS_MIN_REFETCH_SEC so multiple panel
- restarts in a short window don't hammer the GitHub API for nothing."""
+ restarts in a short window don't hammer the GitHub API for nothing.
+
+ Returns immediately without the PHOSPHENE_STATS_FETCH opt-in (the boot
+ block does not even start the thread then; this is the second lock)."""
+ if not _stats_fetch_enabled() or STATS_READONLY:
+ return
time.sleep(_STATS_STARTUP_DELAY_SEC)
# First-run / cold-start fetch — but only if it's been a while.
try:
@@ -16228,6 +16261,16 @@ MUSIC_GPU_POLL_S = 0.5
# jobs (a dev/test panel) can HOLD the file lock while a song renders, so those
# jobs queue behind it. A user's panel never writes the shared lock unless told to.
MUSIC_TAKES_GPU_LOCK = os.environ.get("PHOSPHENE_MUSIC_TAKES_GPU_LOCK", "") == "1"
+# MAINTAINER'S MAC ONLY (4.19.3). Both lock paths above belong to the
+# maintainer's lab: the directory lives in his own project tree and the file
+# is what his agents and command-line renders create. On anybody else's Mac a
+# file that happened to sit at /tmp/phosphene_gpu.lock would hold their song
+# for an hour and then refuse it. So the locks are honoured only where they
+# can mean something: on a Mac carrying the ~/.phosphene-test-rig marker (the
+# maintainer's — see _analytics_is_test_rig), with PHOSPHENE_MUSIC_TAKES_GPU_LOCK,
+# or with PHOSPHENE_MUSIC_WAITS_GPU_LOCK=1. PHOSPHENE_MUSIC_WAITS_GPU_LOCK=0
+# turns it off even on that Mac.
+MUSIC_WAITS_GPU_LOCK_ENV = "PHOSPHENE_MUSIC_WAITS_GPU_LOCK"
def _music_python() -> Path | None:
@@ -16973,8 +17016,25 @@ def music_progress(line: str, previous: dict | None = None) -> dict | None:
return {"phase": phase, "phase_label": label, "pct": pct}
+def _music_honours_lab_gpu_locks() -> bool:
+ """Whether this panel should wait on the maintainer's lab GPU locks at
+ all (see MUSIC_WAITS_GPU_LOCK_ENV). Read at call time."""
+ env = _optional_bool_env(MUSIC_WAITS_GPU_LOCK_ENV)
+ if env is not None:
+ return env
+ if MUSIC_TAKES_GPU_LOCK:
+ return True
+ try:
+ return ANALYTICS_TEST_RIG_MARKER.exists()
+ except OSError:
+ return False
+
+
def _music_external_gpu_lock() -> Path | None:
- """The first external GPU lock that exists (file or directory), else None."""
+ """The first external GPU lock that exists (file or directory), else None.
+ Always None on a user's Mac — see _music_honours_lab_gpu_locks()."""
+ if not _music_honours_lab_gpu_locks():
+ return None
for path in (MUSIC_GPU_DIR_LOCK, MUSIC_GPU_FILE_LOCK):
try:
if path.exists() or path.is_symlink():
@@ -17775,6 +17835,108 @@ def _analytics_install_id() -> str:
return new
+# ---- Bug-report log excerpt + "What happened" (4.19.3, issue #106) ----------
+# #106 arrived with "What happened" and "Expected" empty and ONE log line:
+# the maintainer stats fetcher saying it had no GitHub token — a line about a
+# feature no user has, which said nothing about the user's problem. Two fixes:
+# the report must say what went wrong, and the auto-attached log must carry
+# the lines that explain a failure, never maintainer noise.
+BUG_REPORT_WHAT_MIN_CHARS = 10
+BUG_REPORT_LOG_LINES = 50
+BUG_REPORT_TAIL_LINES = 25
+# Lines that never belong in a user's bug report: the maintainer-only repo
+# stats fetcher (pre-4.19.3 builds pushed "stats: ..." into the shared log)
+# and anything about GitHub tokens. Matched after the "[HH:MM:SS] " stamp.
+_BUG_REPORT_NOISE_RES = (
+ re.compile(r"^(?:\[\d\d:\d\d:\d\d\]\s*)?\[?(?:repo[ -])?stats(?:\]|\s*:)", re.I),
+ re.compile(r"github token|gh auth token|rate-limit remaining|"
+ r"stats dashboard|maintainer stats|stats_fetch", re.I),
+)
+# A line that probably explains a failure. Deliberately broad: a wrongly
+# promoted line costs one row in a 50-row excerpt; a missed one is the
+# reason a report can't be acted on.
+_BUG_REPORT_ERROR_RE = re.compile(
+ r"\b(?:error|errors|failed|failure|fail|traceback|exception|fatal|"
+ r"crash(?:ed)?|killed|refused|out of memory|oom|watchdog|errno|"
+ r"sigkill|sigsegv|sigabrt|sigbus|cannot|could not|couldn't|"
+ r"not found|missing|timed out|timeout)\b", re.I)
+# ...and Python's own exception lines: "ValueError: ...", "RuntimeError",
+# "KeyboardInterrupt" is not one, "JSONDecodeError" is. Word boundaries keep
+# the regex above from seeing "error" inside "ValueError", and that last line
+# is the one that names the cause (Codex, 4.19.3). Case-sensitive on purpose.
+_BUG_REPORT_EXC_RE = re.compile(r"\b[A-Z]\w*(?:Error|Exception)\b")
+
+
+def _bug_report_is_noise(line: str) -> bool:
+ s = str(line or "")
+ return any(rx.search(s) for rx in _BUG_REPORT_NOISE_RES)
+
+
+def _bug_report_log_excerpt(lines, limit: int = BUG_REPORT_LOG_LINES,
+ tail: int = BUG_REPORT_TAIL_LINES) -> list[str]:
+ """Pick the log lines a bug report carries, oldest first.
+
+ Until 4.19.3 this was simply the last 50 lines of the in-memory log, so a
+ failure followed by a few minutes of ordinary activity fell out of the
+ report, and harmless maintainer lines took up the room. Now:
+ 1. noise (see _BUG_REPORT_NOISE_RES) is dropped outright;
+ 2. the most recent `tail` lines are always kept (what just happened);
+ 3. the remaining room goes to earlier lines that look like errors,
+ newest first, each with one line before and two after;
+ 4. any room left is filled with the lines just before the tail.
+ Gaps inside the excerpt are marked with a "[… N lines skipped …]" row
+ so the reader can tell the excerpt from the raw log."""
+ kept = [str(x) for x in (lines or []) if str(x or "").strip()
+ and not _bug_report_is_noise(x)]
+ n = len(kept)
+ if n <= limit:
+ return kept
+ head_end = n - tail # indices < head_end are "earlier"
+ chosen = set(range(head_end, n))
+ budget = limit - tail
+ for i in range(head_end - 1, -1, -1):
+ if budget <= 0:
+ break
+ if not (_BUG_REPORT_ERROR_RE.search(kept[i])
+ or _BUG_REPORT_EXC_RE.search(kept[i])):
+ continue
+ for j in (i, i - 1, i + 1, i + 2):
+ if budget > 0 and 0 <= j < head_end and j not in chosen:
+ chosen.add(j)
+ budget -= 1
+ j = head_end - 1
+ while budget > 0 and j >= 0:
+ if j not in chosen:
+ chosen.add(j)
+ budget -= 1
+ j -= 1
+ out: list[str] = []
+ prev = None
+ for i in sorted(chosen):
+ if prev is not None and i != prev + 1:
+ gap = i - prev - 1
+ out.append(f"[… {gap} line{'s' if gap != 1 else ''} skipped …]")
+ out.append(kept[i])
+ prev = i
+ return out
+
+
+def _bug_report_what_happened(body: str) -> str:
+ """The text under the report's "## What happened" heading, up to the
+ next "## " heading; "" when the heading is absent."""
+ m = re.search(r"^##[ \t]*What happened[ \t]*$", str(body or ""),
+ re.M | re.I)
+ if not m:
+ return ""
+ rest = body[m.end():]
+ nxt = re.search(r"^##[ \t]", rest, re.M)
+ return (rest[:nxt.start()] if nxt else rest).strip()
+
+
+def _bug_report_what_ok(text: str) -> bool:
+ return len(" ".join(str(text or "").split())) >= BUG_REPORT_WHAT_MIN_CHARS
+
+
def _bug_report_scrub_line(line: str) -> str:
"""Strip home-folder paths (which usually carry the macOS username, and
that username is frequently the person's real name) from ONE line of a
@@ -45365,13 +45527,14 @@ if __name__ == "__main__":
threading.Thread(target=version_check_loop, daemon=True).start()
else:
_detect_local_install_state()
- # Repo-stats fetcher — appends to state/stats-data.jsonl daily so
- # the dashboard at /stats has historic data (not in read-only stats
- # mode, where the archive belongs to another install). Data stays on disk in
- # state/ (gitignored), never on the public repo. Skipped silently
- # when no GitHub token is resolvable.
- if not STATS_READONLY:
- threading.Thread(target=stats_fetch_loop, daemon=True).start()
+ # Repo-stats fetcher — maintainer-only, OPT-IN (PHOSPHENE_STATS_FETCH=1;
+ # issue #106: it used to start on every install and borrow the user's
+ # `gh auth token`). Appends to state/stats-data.jsonl daily so /stats has
+ # historic data. Never in read-only stats mode, where the archive belongs
+ # to another install. Data stays on disk in state/ (gitignored).
+ if _stats_fetch_enabled() and not STATS_READONLY:
+ threading.Thread(target=stats_fetch_loop, daemon=True,
+ name="phos-stats-fetch").start()
# Anonymous usage analytics — one app_boot event plus any optional-pack
# transitions since the last boot, then nothing until a job finishes.
# Deliberately here in __main__ and not at import time, so `import
diff --git a/panel/routes_meta.py b/panel/routes_meta.py
index 45ed306..5077774 100644
--- a/panel/routes_meta.py
+++ b/panel/routes_meta.py
@@ -212,7 +212,11 @@ def get_panel_bug_context(h, parsed) -> None:
mem = P.get_memory()
ram_gb = round(float(mem.get("total_gb") or 0.0))
with P.LOCK:
- tail = list(P.STATE["log"])[-50:]
+ _log = list(P.STATE["log"])
+ # 4.19.3 (#106): not simply the last 50 lines. Maintainer noise is
+ # dropped and earlier error lines are kept ahead of routine chatter,
+ # so a failure from a few minutes ago still reaches the report.
+ tail = P._bug_report_log_excerpt(_log)
# SYS-12, privacy: this pre-fills the bug-report textarea that
# opens a PUBLIC GitHub issue. Log lines routinely carry
# /Users/<username>/... paths (panel_uploads, output paths), and
@@ -934,6 +938,27 @@ def post_panel_bug_report(h, path, qs, ctype) -> None:
body = (payload.get("body") or "").strip()
include_crash = bool(payload.get("includeCrashReports"))
+ # 4.19.3 (#106): a report must say what went wrong. The modal checks
+ # this before it calls us, with friendlier copy; this is the backstop
+ # for anything else that posts here. Nothing is built or zipped first.
+ # The modal sends the box's own text as `whatHappened` (judged as is, so
+ # a description that itself starts with "## " is never mistaken for the
+ # next section — Codex, 4.19.3); other callers are judged on the body's
+ # "## What happened" section.
+ _what = payload.get("whatHappened")
+ if not isinstance(_what, str):
+ _what = P._bug_report_what_happened(body)
+ if not P._bug_report_what_ok(_what):
+ h._json({
+ "ok": False, "field": "what_happened",
+ "min_chars": P.BUG_REPORT_WHAT_MIN_CHARS,
+ "error": ("Please add a sentence about what went wrong under "
+ "\"What happened\" (at least "
+ f"{P.BUG_REPORT_WHAT_MIN_CHARS} characters). The log is "
+ "attached for you, but it can't say what you saw."),
+ }, 400)
+ return
+
# GitHub's URL parser tolerates ~8 KB of querystring before it
# silently drops the body. Truncate the body to ~6 KB pre-encode
# to leave headroom for percent-escaping (which roughly doubles
diff --git a/panel/routes_stats.py b/panel/routes_stats.py
index aee6aa3..196f222 100644
--- a/panel/routes_stats.py
+++ b/panel/routes_stats.py
@@ -94,6 +94,14 @@ def stats_refresh(h, path, qs, ctype) -> None:
"hint": "read-only dashboard: the archive is refreshed by "
"the daily stats job, not by this panel"}, 409)
return
+ if not P._stats_fetch_enabled():
+ # Maintainer-only (issue #106): without PHOSPHENE_STATS_FETCH=1 this
+ # panel never reads a GitHub token or runs `gh`, not even on a click.
+ h._json({"ok": False, "disabled": True,
+ "hint": "this panel does not fetch repo stats (maintainer "
+ "opt-in: PHOSPHENE_STATS_FETCH=1); the archive is "
+ "refreshed by the daily stats job"}, 409)
+ return
threading.Thread(
target=P._run_stats_fetch_once, daemon=True,
name="phos-stats-manual-refresh",
diff --git a/panel_assets/stats.html b/panel_assets/stats.html
index f1cd3e4..52544c2 100644
--- a/panel_assets/stats.html
+++ b/panel_assets/stats.html
@@ -12,8 +12,9 @@
Served BY THE PANEL at http://127.0.0.1:8199/stats. The HTML
template lives at panel_assets/stats.html and is read at request
- time; the JSONL data is appended daily by the panel's
- stats_fetch_loop background thread and persisted at
+ time; the JSONL data is appended daily by the maintainer's launchd
+ job (or by the panel's stats_fetch_loop, opt-in only with
+ PHOSPHENE_STATS_FETCH=1) and persisted at
state/stats-data.jsonl (gitignored — never on the public repo).
Both endpoints are 127.0.0.1-only.
@@ -1526,7 +1527,8 @@
never on the public repo. A daily launchd job
(<code>com.mrbizarro.phosphene-stats-fetch</code>) appends to it via
<code>scripts/fetch_repo_stats.py</code> whether or not a panel is
- running; a running panel refreshes it too.
+ running. A panel fetches too only when started with
+ <code>PHOSPHENE_STATS_FETCH=1</code>.
<br>
The GitHub Traffic API only retains 14 days of clones / views /
referrers / paths; this archive is how we keep the history.
diff --git a/scripts/STATS_DASHBOARD.md b/scripts/STATS_DASHBOARD.md
index 4187dab..5b23b8a 100644
--- a/scripts/STATS_DASHBOARD.md
+++ b/scripts/STATS_DASHBOARD.md
@@ -73,12 +73,38 @@ on that Mac at the source.
| `panel_assets/stats.html` | Dashboard. Loads the JSONL at page load, renders cards + Chart.js charts client-side. No build step. | yes (template only, no data) |
| `state/stats-data.jsonl` | Append-only data store on the maintainer's Mac. | **NO** — gitignored, never leaves your machine |
| Panel routes `/stats` + `/stats/data` | Serve the dashboard + data file. Both 127.0.0.1-only via the panel's standard local-only guard. | n/a |
-| Panel `stats_fetch_loop` background thread | Runs the fetcher once a day (and once at startup if the data file is stale or missing). | n/a |
+| Panel `stats_fetch_loop` background thread | **Opt-in only** (`PHOSPHENE_STATS_FETCH=1`). Runs the fetcher once a day (and once at startup if the data file is stale or missing). | n/a |
-## What you actually need to do
+## The panel's own fetch is OPT-IN — one rule (4.19.3)
-**Once:** make sure a GitHub token is resolvable. The panel checks these in
-order, first hit wins:
+> **The panel fetches repo stats only when it was started with
+> `PHOSPHENE_STATS_FETCH=1`.** Without it — every user's install, every
+> clean room, the owner's own panels too — the panel never starts
+> `stats_fetch_loop`, never reads a token variable, never runs `gh`, and
+> never logs a `stats:` line. `POST /stats/refresh` answers 409.
+
+Why (issue #106): through 4.19.2 the loop started on **every** install. To
+find a token it ran the user's own `gh auth token`, so anyone with the GitHub
+CLI logged in had the panel quietly use *their* GitHub credentials once a day
+to read *our* repo's traffic; everyone else got "stats: no GitHub token
+resolvable …" in their log and, on 4.15 and older, in their bug reports.
+
+Why an environment variable and not the `~/.phosphene-test-rig` marker: the
+marker means "tag this Mac's analytics as a test rig" and sits on the
+maintainer's Mac, so every clean room built there would have started calling
+`gh` with the owner's credentials. Fetching is a separate decision, made per
+process. The owner does not need it at all: the **launchd job above** keeps
+the archive, and the dashboard (`/stats`, `/stats/data`, `/stats/usage`)
+reads the archive the same way with or without the opt-in.
+
+Gate: `test_stats_fetch_opt_in.py` (no `gh` subprocess, no token read, no
+thread, no log line without the opt-in; unchanged with it).
+
+## What you actually need to do (only if you opt a panel in)
+
+The launchd job is the normal path. To make a panel fetch as well, start it
+with `PHOSPHENE_STATS_FETCH=1`, and make sure a GitHub token is resolvable.
+The panel checks these in order, first hit wins:
1. `PHOSPHENE_REPO_STATS_TOKEN` env var (explicit, recommended for Pinokio)
2. `GH_STATS_TOKEN` env var
@@ -88,8 +114,9 @@ order, first hit wins:
The token needs the `repo` scope (the GitHub Traffic API requires push
access). `gh auth login` gives you that by default.
-**Then:** restart the panel. Within 90 seconds the background thread runs
-the first fetch. Open `/stats` — done.
+**Then:** restart the panel with `PHOSPHENE_STATS_FETCH=1` in its
+environment. Within 90 seconds the background thread runs the first fetch.
+Open `/stats` — done.
## Run the fetcher manually (debug / catch-up)
@@ -157,7 +184,8 @@ much into day-level fluctuations.
| Symptom | Likely cause | Fix |
|---|---|---|
| Dashboard at /stats is blank | No data yet (first fetch hasn't run) | Wait 90 s after panel boot or run fetcher manually |
-| Panel log: `stats: no GitHub token resolvable` | No token configured anywhere | `gh auth login`, or set `GITHUB_TOKEN` / `PHOSPHENE_REPO_STATS_TOKEN` |
+| Panel never fetches, Refresh answers 409 | Expected: the panel's own fetch is opt-in | Check the launchd job; or start the panel with `PHOSPHENE_STATS_FETCH=1` |
+| Panel stderr (opt-in only): `stats: no GitHub token resolvable` | No token configured anywhere | `gh auth login`, or set `GITHUB_TOKEN` / `PHOSPHENE_REPO_STATS_TOKEN` |
| Panel log: `stats: fetch failed (exit 1)` | Token lacks `repo` scope | `gh auth refresh -s repo` |
| `/stats/data` returns empty body | `state/stats-data.jsonl` doesn't exist yet | Same as "blank" above |
| Charts blank but cards filled | Only one snapshot so far — charts need ≥2 points | Wait for tomorrow's fetch or change system date for testing |
diff --git a/test_bug_report_106.py b/test_bug_report_106.py
new file mode 100644
index 0000000..e923d29
--- /dev/null
+++ b/test_bug_report_106.py
@@ -0,0 +1,307 @@
+#!/usr/bin/env python3
+"""Issue #106 (4.19.3): the in-app bug reporter.
+
+#106 arrived from the in-app reporter with "What happened" and "Expected"
+empty and ONE log line - the maintainer stats fetcher saying it had no GitHub
+token. Nothing to act on. Pinned here:
+
+ - a report cannot go out without a short "What happened" (>= 10 chars):
+ the modal blocks it with inline copy (never alert()), and the server
+ refuses it as a backstop, before building a URL or zipping anything;
+ - the box's text lands under "## What happened" in the issue body, and a
+ bare "[bug]" title borrows its first line;
+ - the auto-attached log keeps earlier ERROR lines ahead of routine
+ chatter and never carries stats/maintainer lines.
+
+The modal's JS is executed in node (functions extracted from the real file).
+"""
+from __future__ import annotations
+
+import io
+import json
+import shutil
+import subprocess
+import sys
+import tempfile
+from pathlib import Path
+from urllib.parse import parse_qs, urlparse
+
+import pytest
+
+ROOT = Path(__file__).resolve().parent
+sys.path.insert(0, str(ROOT))
+sys.path.insert(0, str(ROOT / "scripts"))
+
+import mlx_ltx_panel as p # noqa: E402
+from extract_panel_js import extract_function # noqa: E402
+from panel.routes import GET_ROUTES, POST_ROUTES # noqa: E402
+
+NODE = shutil.which("node")
+SETTINGS_JS = (ROOT / "webapp" / "js" / "settings.js").read_text(encoding="utf-8")
+HTML = (ROOT / "webapp" / "index.html").read_text(encoding="utf-8")
+
+
+class _H:
+ def __init__(self, payload: dict | None = None):
+ self.out = None
+ body = json.dumps(payload or {}).encode()
+ self.headers = {"Content-Length": str(len(body))}
+ self.rfile = io.BytesIO(body)
+
+ def _json(self, obj, code=200):
+ self.out = (code, obj)
+
+ def send_error(self, code, *a):
+ self.out = (code, None)
+
+
+def _post(payload: dict):
+ h = _H(payload)
+ POST_ROUTES["/panel/bug-report"](h, "/panel/bug-report", {}, "application/json")
+ return h.out
+
+
+BODY_OK = ("## Environment\n- Phosphene version: 4.19.3\n\n"
+ "## What I was doing\n\n\n"
+ "## What happened\n\nThe render stopped at 40% with helper failed.\n\n"
+ "## Expected\n\n\n## Logs / repro\n```\n(no recent log lines)\n```\n")
+
+
+# ---------------------------------------------------------------- server ----
+class TestServerBackstop:
+ def test_extracts_the_section(self):
+ assert p._bug_report_what_happened(BODY_OK) == \
+ "The render stopped at 40% with helper failed."
+ assert p._bug_report_what_happened("## What happened\n\n\n## Expected\nx") == ""
+ assert p._bug_report_what_happened("no headings at all") == ""
+
+ def test_minimum_counts_words_not_padding(self):
+ assert not p._bug_report_what_ok("")
+ assert not p._bug_report_what_ok("crash")
+ assert not p._bug_report_what_ok(" a b c ") # 5 chars once collapsed
+ assert p._bug_report_what_ok("it crashed!")
+
+ @pytest.mark.parametrize("body", [
+ "", # nothing at all
+ "b",
+ "## Environment\n- x\n\n## What happened\n\n\n## Expected\n\n", # the #106 shape
+ "## What happened\n\ncrash\n\n## Expected\n",
+ ])
+ def test_empty_report_refused_before_anything_is_built(self, body):
+ code, out = _post({"title": "[bug] ", "body": body, "includeCrashReports": True})
+ assert code == 400
+ assert out["field"] == "what_happened"
+ assert "issueUrl" not in out and "zipPath" not in out
+ assert "What happened" in out["error"] and "10" in out["error"]
+
+ def test_a_description_that_starts_with_a_heading_is_not_refused(self):
+ """Codex 4.19.3: "## Reproduction" in the box read as the NEXT section,
+ so a long description was refused as empty, forever."""
+ what = "## Reproduction\nGenerate stops at 40 percent."
+ body = BODY_OK.replace("The render stopped at 40% with helper failed.", what)
+ code, out = _post({"title": "[bug] x", "body": body, "whatHappened": what})
+ assert code == 200 and out["ok"], out
+ # what the modal actually sends: the heading escaped in the body
+ esc = BODY_OK.replace("The render stopped at 40% with helper failed.",
+ "\\## Reproduction\nGenerate stops at 40 percent.")
+ code, out = _post({"title": "[bug] x", "body": esc})
+ assert code == 200 and out["ok"], out
+ # the separate field is judged on its own: short is still refused
+ code, out = _post({"title": "[bug] x", "body": BODY_OK, "whatHappened": "crash"})
+ assert code == 400 and out["field"] == "what_happened"
+
+ def test_real_report_builds_the_issue_url(self):
+ code, out = _post({"title": "[bug] stopped", "body": BODY_OK})
+ assert code == 200 and out["ok"]
+ q = parse_qs(urlparse(out["issueUrl"]).query)
+ assert "The render stopped at 40%" in q["body"][0]
+
+
+# ----------------------------------------------------------- log excerpt ----
+class TestLogExcerpt:
+ STATS = ["[07:29:36] stats: no GitHub token resolvable (tried PHOSPHENE_REPO_STATS_TOKEN, "
+ "GH_STATS_TOKEN, GH_TOKEN, GITHUB_TOKEN, `gh auth token`). Dashboard will be empty "
+ "until you set one.",
+ "[07:30:00] [stats] repo stats: rate-limit remaining: 4848/5000",
+ "[07:31:00] stats: dashboard refresh skipped (HTTP 403)"]
+
+ def test_stats_lines_never_reach_a_report(self):
+ log = ["[07:29:00] Panel ready"] + self.STATS + ["[07:32:00] [h3] stats look fine"]
+ out = p._bug_report_log_excerpt(log)
+ assert out == ["[07:29:00] Panel ready", "[07:32:00] [h3] stats look fine"]
+
+ def test_issue_106_log_leaves_nothing(self):
+ assert p._bug_report_log_excerpt(self.STATS[:1]) == []
+
+ def test_an_earlier_error_survives_a_long_quiet_stretch(self):
+ log = [f"[08:00:{i % 60:02d}] queued item {i}" for i in range(100)]
+ log += ["[08:10:00] step:generate_and_save mode=t2v 1280x704 121f",
+ "[08:10:05] ERROR: helper failed to start: python_normal_exit",
+ "[08:10:06] Traceback (most recent call last):"]
+ log += [f"[08:20:{i % 60:02d}] poll {i}" for i in range(300)]
+ out = p._bug_report_log_excerpt(log)
+ assert any("helper failed to start" in x for x in out)
+ assert any("step:generate_and_save" in x for x in out) # line before
+ assert any("Traceback" in x for x in out) # line after
+ assert out[-1] == "[08:20:59] poll 299" # the tail is kept
+ real = [x for x in out if not x.startswith("[… ")]
+ assert len(real) == p.BUG_REPORT_LOG_LINES
+ assert any(x.startswith("[… ") and "skipped" in x for x in out)
+ # oldest first: the error comes before the tail
+ assert out.index(next(x for x in out if "helper failed" in x)) < len(out) - 25
+
+ def test_a_traceback_keeps_the_line_that_names_the_cause(self):
+ """Codex 4.19.3: "error" with word boundaries never matched
+ "ValueError", so the exception line itself was dropped."""
+ log = ["routine"] * 100 + [
+ "Traceback (most recent call last):", "frame one", "code one",
+ "frame two", "code two",
+ "ValueError: invalid literal for int() with base 10: 'abc'"] + ["routine"] * 100
+ out = p._bug_report_log_excerpt(log)
+ assert any(x.startswith("ValueError: invalid literal") for x in out)
+ assert any(x == "code two" for x in out) # the line before it
+ assert not p._BUG_REPORT_EXC_RE.search("mirror terror horror")
+
+ def test_no_errors_means_the_plain_last_lines(self):
+ log = [f"line {i}" for i in range(200)]
+ assert p._bug_report_log_excerpt(log) == log[-50:]
+
+ def test_short_log_kept_whole(self):
+ log = [f"line {i}" for i in range(10)]
+ assert p._bug_report_log_excerpt(log) == log
+
+ def test_bug_context_route_uses_the_excerpt_and_scrubs(self, monkeypatch):
+ log = (["[09:00:00] ERROR writing /Users/jane.example/x.mp4: no space"] +
+ self.STATS + [f"[09:01:{i % 60:02d}] tick {i}" for i in range(200)])
+ monkeypatch.setitem(p.STATE, "log", log)
+ h = _H()
+ GET_ROUTES["/panel/bug-context"](h, None)
+ tail = h.out[1]["logTail"]
+ assert not any("GitHub token" in x or "stats:" in x for x in tail)
+ assert any("ERROR writing <path>" in x for x in tail)
+ assert not any("jane.example" in x for x in tail)
+
+
+# ------------------------------------------------------------------ modal ----
+def _node(script: str):
+ if NODE is None:
+ pytest.skip("node not on PATH")
+ with tempfile.NamedTemporaryFile("w", suffix=".js", delete=False) as fh:
+ fh.write(script)
+ path = fh.name
+ try:
+ r = subprocess.run([NODE, path], capture_output=True, text=True, timeout=60)
+ assert r.returncode == 0, r.stderr[-3000:]
+ return json.loads(r.stdout.strip().splitlines()[-1])
+ finally:
+ Path(path).unlink(missing_ok=True)
+
+
+def _modal_js() -> str:
+ consts = SETTINGS_JS[SETTINGS_JS.index("const BUG_WHAT_MIN"):
+ SETTINGS_JS.index("function bugWhatText")]
+ fns = "\n".join(extract_function(n, SETTINGS_JS) for n in (
+ "bugWhatText", "bugWhatOk", "bugWhatShow", "bugWhatInput",
+ "bugComposeBody", "bugComposeTitle", "submitBugReport"))
+ return consts + "\n" + fns
+
+
+def _run_submit(what: str, title: str = "[bug] ", server: dict | None = None):
+ server = server or {"ok": True, "issueUrl": "https://example.invalid/i"}
+ return _node(_modal_js() + """
+const body0 = "## Environment\\n- Phosphene version: 4.19.3\\n\\n## What I was doing\\n\\n\\n## Expected\\n\\n\\n## Logs / repro\\n```\\nx\\n```\\n";
+const classes = new Set();
+const wrap = { classList: { toggle(c, on) { on ? classes.add(c) : classes.delete(c); },
+ contains(c) { return classes.has(c); } } };
+let focused = 0;
+const els = {
+ bugWhat: { value: %s, closest: () => wrap, attrs: {}, setAttribute(k, v) { this.attrs[k] = v; },
+ focus() { focused++; } },
+ bugWhatHint: { textContent: '' },
+ bugTitle: { value: %s }, bugBody: { value: body0 },
+ bugStatus: { textContent: '', innerHTML: '' },
+ bugSubmitBtn: { disabled: false, textContent: 'Open GitHub issue' },
+ bugCrashCheck: { checked: false }, bugCrashRow: { style: { display: 'none' } },
+};
+global.document = { getElementById: id => els[id] || null };
+const calls = [];
+global.fetch = async (url, opts) => { calls.push({ url, body: JSON.parse(opts.body) });
+ return { ok: %s, json: async () => (%s) }; };
+global.window = { open() {} };
+global.alert = () => { throw new Error('alert() used'); };
+global.setTimeout = () => 0;
+global.navigator = { clipboard: { writeText: async () => {} } };
+(async () => {
+ await submitBugReport();
+ console.log(JSON.stringify({ calls, invalid: classes.has('is-invalid'),
+ hint: els.bugWhatHint.textContent, aria: els.bugWhat.attrs['aria-invalid'] || null,
+ focused, status: els.bugStatus.textContent }));
+})();
+""" % (json.dumps(what), json.dumps(title), "true" if server.get("ok", True) else "false",
+ json.dumps(server)))
+
+
+class TestModal:
+ @pytest.mark.parametrize("what", ["", " ", "crash", "a b c d"])
+ def test_short_or_empty_is_blocked_inline(self, what):
+ out = _run_submit(what)
+ assert out["calls"] == [], "an empty report was sent"
+ assert out["invalid"] and out["aria"] == "true" and out["focused"] >= 1
+ assert "at least 10 characters" in out["hint"]
+
+ def test_real_description_goes_under_what_happened(self):
+ out = _run_submit("Generate stopped at 40% and the card says helper failed.")
+ assert len(out["calls"]) == 1 and not out["invalid"]
+ sent = out["calls"][0]["body"]
+ assert sent["title"] == "[bug] Generate stopped at 40% and the card says helper failed."
+ body = sent["body"]
+ assert ("## What happened\n\nGenerate stopped at 40% and the card says helper failed.\n\n"
+ "## Expected") in body
+ assert body.index("## What I was doing") < body.index("## What happened") \
+ < body.index("## Logs")
+
+ def test_line_breaks_kept_and_a_leading_heading_escaped(self):
+ what = "## Reproduction\nGenerate stops at 40 percent."
+ out = _run_submit(what)
+ assert len(out["calls"]) == 1, out
+ sent = out["calls"][0]["body"]
+ assert sent["whatHappened"] == "\\## Reproduction\nGenerate stops at 40 percent."
+ assert "## What happened\n\n\\## Reproduction\nGenerate stops at 40 percent.\n" \
+ in sent["body"]
+ assert sent["title"] == "[bug] Reproduction"
+
+ def test_a_typed_title_is_kept(self):
+ out = _run_submit("It crashed while exporting a 4K clip.", title="[bug] export dies")
+ assert out["calls"][0]["body"]["title"] == "[bug] export dies"
+
+ def test_server_backstop_shows_the_same_inline_copy(self):
+ out = _run_submit("long enough text here",
+ server={"ok": False, "field": "what_happened", "error": "x"})
+ assert out["invalid"] and "at least 10 characters" in out["hint"]
+
+ def test_compose_body_fills_an_existing_heading(self):
+ out = _node(_modal_js() + """
+console.log(JSON.stringify([
+ bugComposeBody("## What happened\\n\\nold\\n\\n## Expected\\n", "new text"),
+ bugComposeBody("no headings", "new text"),
+ bugComposeTitle("", ""), bugComposeTitle("[bug]", "x".repeat(100)).length <= 80,
+]));
+""")
+ assert out[0].startswith("## What happened\n\nnew text\n")
+ assert out[1].endswith("## What happened\n\nnew text\n\n")
+ assert out[2] == "[bug] (untitled)" and out[3] is True
+
+
+def test_modal_markup_and_wiring():
+ modal = HTML[HTML.index('id="bugModal"'):HTML.index('id="bottomPane"')]
+ assert 'id="bugWhat"' in modal and 'aria-required="true"' in modal
+ assert 'oninput="bugWhatInput()"' in modal and 'id="bugWhatHint"' in modal
+ assert "last 50 log lines" not in modal
+ # The body template no longer carries an empty "What happened" to skip.
+ open_fn = extract_function("openBugModal", SETTINGS_JS)
+ assert "## What happened" not in open_fn
+ # A finished report rewires the button to "Done - close"; reopening must
+ # restore the submit handler.
+ assert "submitBtn.onclick = submitBugReport;" in open_fn
+ assert "bugWhatInput," in SETTINGS_JS[SETTINGS_JS.index("Object.assign(globalThis"):]
+ assert "alert(" not in extract_function("submitBugReport", SETTINGS_JS)
diff --git a/test_codex_4170_ui.py b/test_codex_4170_ui.py
index cd0b632..e24e91a 100644
--- a/test_codex_4170_ui.py
+++ b/test_codex_4170_ui.py
@@ -332,7 +332,8 @@ def test_ui6_crash_count_and_zip_hold_only_phosphene_processes(tmp_path):
h = _H()
GET_ROUTES["/panel/bug-context"](h, None)
assert h.out[1]["crashCount"] == 1
- body = json.dumps({"title": "t", "body": "b", "includeCrashReports": True}).encode()
+ body = json.dumps({"title": "t", "body": "## What happened\n\nthe helper crashed mid-render",
+ "includeCrashReports": True}).encode()
h = _H()
h.headers = {"Content-Length": str(len(body))}
h.rfile = io.BytesIO(body)
diff --git a/test_music_engine.py b/test_music_engine.py
index efa6fd9..48affff 100644
--- a/test_music_engine.py
+++ b/test_music_engine.py
@@ -59,6 +59,9 @@ def pack(tmp_path, monkeypatch):
monkeypatch.setattr(P, "UPLOADS", tmp_path / "uploads")
monkeypatch.setattr(P, "MUSIC_GPU_DIR_LOCK", tmp_path / "gpu-dir")
monkeypatch.setattr(P, "MUSIC_GPU_FILE_LOCK", tmp_path / "gpu-file")
+ # The lab-lock tests below exercise the maintainer's Mac (4.19.3: a user's
+ # panel never waits on these; test_music_lab_locks_ignored_on_a_users_mac).
+ monkeypatch.setenv("PHOSPHENE_MUSIC_WAITS_GPU_LOCK", "1")
monkeypatch.setattr(P, "_PROC_GUARDS", {"music": (tmp_path / "music_running.json", "yue2_run.py")})
monkeypatch.setitem(P.STATE, "queue", [])
monkeypatch.setitem(P.STATE, "history", [])
@@ -1233,3 +1236,36 @@ def test_no_trainer_spawns_the_raw_environment_any_more():
assert "env={**os.environ" not in src
assert "_train_env = trainer_child_env()" in src
assert src.count("env=trainer_child_env()") >= 1
+
+
+def test_music_lab_locks_ignored_on_a_users_mac(pack, monkeypatch, tmp_path):
+ """4.19.3: the two lock paths are the maintainer's lab. On a user's Mac
+ (no ~/.phosphene-test-rig, no opt-in) a file sitting at the lock path must
+ not hold their song — the runner starts at once."""
+ stub = tmp_path / "stub_runner.py"
+ stub.write_text("""import sys,pathlib
+args=sys.argv[1:]; out=pathlib.Path(args[args.index('--output')+1])
+out.write_bytes(b'RIFF'); pathlib.Path(str(out)+'.json').write_text(args[args.index('--extra-json')+1])
+print('[music] done 5 '+str(out),flush=True)
+""")
+ monkeypatch.setattr(P, "MUSIC_RUNNER", stub)
+ monkeypatch.setattr(P.HELPER, "kill", lambda: None)
+ monkeypatch.setattr(P, "MUSIC_GPU_WAIT_MAX_S", 0.3)
+ monkeypatch.setattr(P, "MUSIC_TAKES_GPU_LOCK", False)
+ monkeypatch.delenv("PHOSPHENE_MUSIC_WAITS_GPU_LOCK", raising=False)
+ monkeypatch.setattr(P, "ANALYTICS_TEST_RIG_MARKER", tmp_path / "no-marker")
+ P.MUSIC_GPU_FILE_LOCK.write_text("12345 lab job")
+ P.MUSIC_GPU_DIR_LOCK.mkdir()
+ assert P._music_honours_lab_gpu_locks() is False
+ job = P.make_job({"mode": "music", "music_style": "test"})
+ P.STATE["current"] = job
+ P.run_job_inner(job)
+ assert Path(job["output_path"]).is_file()
+ assert P.MUSIC_GPU_FILE_LOCK.read_text() == "12345 lab job" # untouched
+ # The maintainer's Mac (marker) and the explicit switches still honour them.
+ marker = tmp_path / "marker"
+ marker.write_text("x")
+ monkeypatch.setattr(P, "ANALYTICS_TEST_RIG_MARKER", marker)
+ assert P._music_honours_lab_gpu_locks() is True
+ monkeypatch.setenv("PHOSPHENE_MUSIC_WAITS_GPU_LOCK", "0")
+ assert P._music_honours_lab_gpu_locks() is False
diff --git a/test_stats_fetch_opt_in.py b/test_stats_fetch_opt_in.py
new file mode 100644
index 0000000..48dbdd1
--- /dev/null
+++ b/test_stats_fetch_opt_in.py
@@ -0,0 +1,260 @@
+"""Issue #106 (4.19.3): the maintainer's repo-stats fetch is OPT-IN only.
+
+WHAT THIS GUARDS AGAINST. Through 4.19.2 `stats_fetch_loop` started on every
+install. To find a GitHub token it read GH_TOKEN / GITHUB_TOKEN and then ran
+the user's own `gh auth token`, so a user with the GitHub CLI logged in had
+the panel quietly use THEIR credentials once a day to read OUR repo's traffic.
+Everyone else got "stats: no GitHub token resolvable ..." in their log, and
+on 4.15 that line was the only thing in an otherwise empty bug report (#106).
+
+The one rule: nothing in the stats fetcher runs, reads a token variable,
+spawns `gh` or writes a log line unless the process was started with
+PHOSPHENE_STATS_FETCH=1. The ~/.phosphene-test-rig marker does NOT turn it
+on (it tags analytics; it sits on the maintainer's Mac where every clean room
+would otherwise borrow the owner's `gh`). With the opt-in, behaviour is
+unchanged. See scripts/STATS_DASHBOARD.md.
+"""
+from __future__ import annotations
+
+import inspect
+import io
+import os
+import re
+import stat
+import subprocess
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+from unittest import mock
+
+import mlx_ltx_panel as p
+import panel.routes_stats as rs
+
+ROOT = Path(p.__file__).resolve().parent
+TOKEN_VARS = ("PHOSPHENE_REPO_STATS_TOKEN", "GH_STATS_TOKEN", "GH_TOKEN",
+ "GITHUB_TOKEN")
+
+
+class _RecordingEnviron(dict):
+ """os.environ stand-in that remembers every key anyone looked up."""
+
+ def __init__(self, *a, **kw):
+ super().__init__(*a, **kw)
+ self.looked_up: list[str] = []
+
+ def get(self, key, default=None):
+ self.looked_up.append(key)
+ return super().get(key, default)
+
+ def __getitem__(self, key):
+ self.looked_up.append(key)
+ return super().__getitem__(key)
+
+ def __contains__(self, key):
+ self.looked_up.append(key)
+ return super().__contains__(key)
+
+ def copy(self):
+ self.looked_up.append("<copy>")
+ return dict(self)
+
+
+def _base_env(**extra) -> dict:
+ env = {k: v for k, v in os.environ.items()
+ if k not in TOKEN_VARS and k != "PHOSPHENE_STATS_FETCH"}
+ # A user who has every token variable set: none may be read without
+ # the opt-in.
+ env.update({k: f"secret-{k.lower()}" for k in TOKEN_VARS})
+ env.update(extra)
+ return env
+
+
+class WithoutOptIn(unittest.TestCase):
+ def setUp(self):
+ p._STATS_WARNED_NO_TOKEN = False
+ p._STATS_WARNED_FETCH_FAIL = False
+ self.addCleanup(setattr, p, "_STATS_WARNED_NO_TOKEN", False)
+ self.addCleanup(setattr, p, "_STATS_WARNED_FETCH_FAIL", False)
+ self.env = _RecordingEnviron(_base_env())
+ patches = [
+ mock.patch.object(os, "environ", self.env),
+ mock.patch.object(p, "STATS_READONLY", False),
+ # Even on the maintainer's Mac (marker present) it stays off.
+ mock.patch.object(p, "ANALYTICS_TEST_RIG_MARKER",
+ mock.Mock(exists=mock.Mock(return_value=True))),
+ ]
+ for pt in patches:
+ pt.start()
+ self.addCleanup(pt.stop)
+ self.run_calls = mock.patch.object(p.subprocess, "run")
+ self.popen_calls = mock.patch.object(p.subprocess, "Popen")
+ self.run_mock = self.run_calls.start()
+ self.popen_mock = self.popen_calls.start()
+ self.addCleanup(self.run_calls.stop)
+ self.addCleanup(self.popen_calls.stop)
+
+ def _assert_no_token_read(self):
+ for var in TOKEN_VARS:
+ self.assertNotIn(var, self.env.looked_up,
+ f"{var} was read without the opt-in")
+ self.assertNotIn("<copy>", self.env.looked_up)
+
+ def _assert_no_subprocess(self):
+ self.run_mock.assert_not_called()
+ self.popen_mock.assert_not_called()
+
+ def test_disabled(self):
+ self.assertFalse(p._stats_fetch_enabled())
+
+ def test_resolve_token_reads_nothing_and_never_runs_gh(self):
+ self.assertEqual(p._resolve_github_token(), "")
+ self._assert_no_subprocess()
+ self._assert_no_token_read()
+
+ def test_fetch_once_is_silent_and_inert(self):
+ with p.LOCK:
+ before = len(p.STATE["log"])
+ with mock.patch.object(sys, "stderr", io.StringIO()) as err:
+ p._run_stats_fetch_once()
+ self._assert_no_subprocess()
+ self._assert_no_token_read()
+ self.assertEqual(err.getvalue(), "", "a stats line was written")
+ with p.LOCK:
+ self.assertEqual(len(p.STATE["log"]), before)
+
+ def test_loop_returns_at_once(self):
+ with mock.patch.object(p.time, "sleep",
+ side_effect=AssertionError("loop slept")):
+ p.stats_fetch_loop()
+ self._assert_no_subprocess()
+
+ def test_refresh_route_refuses_without_a_thread(self):
+ rs.P = p
+ h = mock.Mock()
+ with mock.patch.object(rs.threading, "Thread") as th:
+ rs.stats_refresh(h, "/stats/refresh", {}, "")
+ th.assert_not_called()
+ body, code = h._json.call_args[0]
+ self.assertEqual(code, 409)
+ self.assertTrue(body.get("disabled"))
+ self._assert_no_subprocess()
+
+ def test_other_values_do_not_opt_in(self):
+ for v in ("", "0", "false", "no", "maybe"):
+ self.env["PHOSPHENE_STATS_FETCH"] = v
+ self.assertFalse(p._stats_fetch_enabled(), v)
+
+
+class WithOptIn(unittest.TestCase):
+ """Unchanged maintainer behaviour once PHOSPHENE_STATS_FETCH=1."""
+
+ def setUp(self):
+ p._STATS_WARNED_NO_TOKEN = False
+ p._STATS_WARNED_FETCH_FAIL = False
+ self.addCleanup(setattr, p, "_STATS_WARNED_NO_TOKEN", False)
+ self.addCleanup(setattr, p, "_STATS_WARNED_FETCH_FAIL", False)
+ pt = mock.patch.object(p, "STATS_READONLY", False)
+ pt.start()
+ self.addCleanup(pt.stop)
+
+ def test_env_token_first(self):
+ env = _base_env(PHOSPHENE_STATS_FETCH="1")
+ with mock.patch.dict(os.environ, env, clear=True), \
+ mock.patch.object(p.subprocess, "run") as run:
+ self.assertEqual(p._resolve_github_token(),
+ "secret-phosphene_repo_stats_token")
+ run.assert_not_called()
+
+ def test_falls_back_to_gh(self):
+ env = {k: v for k, v in _base_env(PHOSPHENE_STATS_FETCH="1").items()
+ if k not in TOKEN_VARS}
+ fake = subprocess.CompletedProcess(["gh"], 0, stdout="tok\n", stderr="")
+ with mock.patch.dict(os.environ, env, clear=True), \
+ mock.patch.object(p.subprocess, "run", return_value=fake) as run:
+ self.assertEqual(p._resolve_github_token(), "tok")
+ self.assertEqual(run.call_args[0][0], ["gh", "auth", "token"])
+
+ def test_fetch_runs_with_the_token(self):
+ seen = {}
+
+ def fake_run(cmd, **kw):
+ seen["cmd"] = cmd
+ seen["env"] = kw.get("env") or {}
+ return subprocess.CompletedProcess(cmd, 0, stdout="ok\n", stderr="")
+
+ with mock.patch.dict(os.environ, {"PHOSPHENE_STATS_FETCH": "1"}), \
+ mock.patch.object(p, "_resolve_github_token", return_value="tok"), \
+ mock.patch.object(p.subprocess, "run", side_effect=fake_run), \
+ mock.patch.object(sys, "stderr", io.StringIO()):
+ p._run_stats_fetch_once()
+ self.assertEqual(seen["cmd"][-1], str(p.STATS_FETCHER))
+ self.assertEqual(seen["env"].get("GITHUB_TOKEN"), "tok")
+
+ def test_refresh_route_queues(self):
+ rs.P = p
+ h = mock.Mock()
+ with mock.patch.dict(os.environ, {"PHOSPHENE_STATS_FETCH": "1"}), \
+ mock.patch.object(rs.threading, "Thread") as th:
+ rs.stats_refresh(h, "/stats/refresh", {}, "")
+ th.assert_called_once()
+ self.assertEqual(h._json.call_args[0][1], 202)
+
+
+class BootBlock(unittest.TestCase):
+ def test_thread_start_is_behind_the_opt_in(self):
+ src = (ROOT / "mlx_ltx_panel.py").read_text(encoding="utf-8")
+ starts = [m.start() for m in re.finditer(r"target=stats_fetch_loop", src)]
+ self.assertEqual(len(starts), 1, "exactly one place starts the loop")
+ guard = src.rfind("\n if ", 0, starts[0])
+ self.assertIn("_stats_fetch_enabled()", src[guard:starts[0]])
+
+ def test_every_entry_point_checks_first(self):
+ for fn in (p._resolve_github_token, p._run_stats_fetch_once,
+ p.stats_fetch_loop):
+ body = inspect.getsource(fn).split('"""')[-1]
+ first = [ln.strip() for ln in body.splitlines() if ln.strip()
+ and not ln.strip().startswith(("global", "#"))][0]
+ self.assertIn("_stats_fetch_enabled()", first, fn.__name__)
+
+
+class RealProcessNeverRunsGh(unittest.TestCase):
+ """End to end in a fresh interpreter: a fake `gh` first on PATH that
+ records being run. Without the opt-in it must never run; with it, it is
+ the fallback token source exactly as before."""
+
+ def _run(self, opt_in: bool) -> bool:
+ d = Path(tempfile.mkdtemp())
+ bindir = d / "bin"
+ bindir.mkdir()
+ hit = d / "gh-was-run"
+ gh = bindir / "gh"
+ gh.write_text(f"#!/bin/sh\ntouch '{hit}'\necho fake-token\n")
+ gh.chmod(gh.stat().st_mode | stat.S_IEXEC)
+ env = {k: v for k, v in os.environ.items()
+ if k not in TOKEN_VARS and k != "PHOSPHENE_STATS_FETCH"}
+ env["PATH"] = f"{bindir}:{env.get('PATH', '')}"
+ env["LTX_STATE_DIR"] = str(d / "state")
+ if opt_in:
+ env["PHOSPHENE_STATS_FETCH"] = "1"
+ code = ("import mlx_ltx_panel as p\n"
+ "p.STATS_FETCHER = p.Path('/nonexistent/fetch.py')\n"
+ "t = p._resolve_github_token()\n"
+ "p._run_stats_fetch_once()\n"
+ "print('TOKEN', bool(t))\n")
+ out = subprocess.run([sys.executable, "-c", code], cwd=ROOT, env=env,
+ capture_output=True, text=True, errors="replace",
+ timeout=180)
+ self.assertEqual(out.returncode, 0, out.stderr[-2000:])
+ self.assertNotIn("[stats]", out.stderr)
+ return hit.exists()
+
+ def test_no_gh_without_opt_in(self):
+ self.assertFalse(self._run(opt_in=False))
+
+ def test_gh_is_the_fallback_with_opt_in(self):
+ self.assertTrue(self._run(opt_in=True))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/test_stats_fetch_quiet.py b/test_stats_fetch_quiet.py
index 0af97c6..b4a5bb2 100644
--- a/test_stats_fetch_quiet.py
+++ b/test_stats_fetch_quiet.py
@@ -26,6 +26,11 @@ import mlx_ltx_panel as p
class StatsFetchNeverTouchesTheSharedLog(unittest.TestCase):
def setUp(self):
+ # These cases exercise the maintainer's OPTED-IN path (4.19.3: the
+ # fetch is opt-in only; test_stats_fetch_opt_in.py covers "off").
+ _env = mock.patch.dict(p.os.environ, {"PHOSPHENE_STATS_FETCH": "1"})
+ _env.start()
+ self.addCleanup(_env.stop)
# These two module-level warned-once latches persist across tests
# in a whole-suite run; reset so each case actually exercises the
# branch it means to.
diff --git a/test_stats_fix_1014.py b/test_stats_fix_1014.py
index ed0fb18..34aa48a 100644
--- a/test_stats_fix_1014.py
+++ b/test_stats_fix_1014.py
@@ -197,6 +197,7 @@ class FetchWritesWhereTheDashboardReads(unittest.TestCase):
return subprocess.CompletedProcess(cmd, 0, stdout="ok\n", stderr="")
with mock.patch.object(p, "_resolve_github_token", return_value="t"), \
+ mock.patch.dict(os.environ, {"PHOSPHENE_STATS_FETCH": "1"}), \
mock.patch.object(p, "STATS_READONLY", False), \
mock.patch.object(p.subprocess, "run", side_effect=fake_run):
p._run_stats_fetch_once()
@@ -206,6 +207,7 @@ class FetchWritesWhereTheDashboardReads(unittest.TestCase):
class ReadOnlyStatsMode(unittest.TestCase):
def test_no_fetch_in_read_only_mode(self):
with mock.patch.object(p, "_resolve_github_token", return_value="t"), \
+ mock.patch.dict(os.environ, {"PHOSPHENE_STATS_FETCH": "1"}), \
mock.patch.object(p, "STATS_READONLY", True), \
mock.patch.object(p.subprocess, "run") as run:
p._run_stats_fetch_once()
diff --git a/webapp/docs/troubleshooting.md b/webapp/docs/troubleshooting.md
index 20fbf04..a97ffe6 100644
--- a/webapp/docs/troubleshooting.md
+++ b/webapp/docs/troubleshooting.md
@@ -61,4 +61,4 @@ The **Logs** tab in the bottom panel shows the render log. When a render dies, t
## Reporting an issue {#report}
-The bug button in the header opens **Report a bug**: it fills in the version, your Mac's details and the last 50 log lines, and opens a GitHub issue in a new tab for you to finish — nothing is sent until you submit it there. Issues live at [github.com/mrbizarro/phosphene/issues](https://github.com/mrbizarro/phosphene/issues).
+The bug button in the header opens **Report a bug**. Write a sentence or two under **What happened?** (it needs at least 10 characters — the log can't say what you saw); it fills in the version, your Mac's details and the recent log, with error lines kept ahead of routine ones, and opens a GitHub issue in a new tab for you to finish — nothing is sent until you submit it there. Issues live at [github.com/mrbizarro/phosphene/issues](https://github.com/mrbizarro/phosphene/issues).
diff --git a/webapp/index.html b/webapp/index.html
index a13acff..2e13ba8 100644
--- a/webapp/index.html
+++ b/webapp/index.html
@@ -3179,7 +3179,7 @@ The same wizard walks out of frame. Audio: footsteps on leaves."></textarea>
<button type="button" class="pill-btn active" data-voice-preset="standard"><span>Standard <span class="rec-badge">250</span></span><span class="sub">~17 min wall</span></button>
<button type="button" class="pill-btn" data-voice-preset="long"><span>Long <span class="rec-badge">500</span></span><span class="sub">~33 min wall</span></button>
</div>
- <div class="hint" style="margin-top:6px">Estimates assume ~30 s/step on M4 Max — measured value lives in lora-lab and may drift.</div>
+ <div class="hint" style="margin-top:6px">Estimates assume about 30 s per step on an M4 Max; slower Macs take longer.</div>
</div>
</div>
@@ -6540,16 +6540,29 @@ The last line"></textarea>
</div>
<div class="models-hint">
Opens a pre-filled GitHub issue in a new tab. Environment info, version,
- and the last 50 log lines are filled in for you.
+ and the recent log (errors first) are filled in for you.
</div>
<div id="bugModalBody" style="padding: 12px 0; display:flex; flex-direction:column; gap:10px">
+ <!-- 4.19.3 (#106): a report used to go out with "What happened" empty,
+ which left nothing to act on. This box is required (at least 10
+ characters); the copy under it says why, inline, never alert(). -->
+ <label class="bug-what" for="bugWhat">
+ <span>What happened? <span class="bug-what-req">required</span></span>
+ <textarea id="bugWhat" rows="3" aria-required="true" aria-describedby="bugWhatHint"
+ placeholder="e.g. I pressed Generate on Text to video and it stopped at 40% with &quot;helper failed to start&quot;."
+ oninput="bugWhatInput()"></textarea>
+ <span id="bugWhatHint" class="bug-what-hint" role="status" aria-live="polite">
+ A sentence or two in your own words. The log below is attached for
+ you, but it can't tell us what you saw.
+ </span>
+ </label>
<label style="display:flex; flex-direction:column; gap:4px; font-size:12px; color:var(--muted)">
Title
<input id="bugTitle" type="text" value="[bug] "
style="padding:6px 9px; font-size:13px; background:rgba(140,160,220,0.04); border:1px solid var(--ph-border-soft); border-radius:6px; color:var(--text); font-family:inherit">
</label>
<label style="display:flex; flex-direction:column; gap:4px; font-size:12px; color:var(--muted)">
- Description
+ Details (optional) and environment
<textarea id="bugBody" rows="14"
style="padding:8px 10px; font-size:12px; background:rgba(140,160,220,0.04); border:1px solid var(--ph-border-soft); border-radius:6px; color:var(--text); font-family:ui-monospace,SFMono-Regular,Menlo,monospace; line-height:1.45; resize:vertical">Loading environment…</textarea>
</label>
diff --git a/webapp/js/settings.js b/webapp/js/settings.js
index b3f8d51..30c348a 100644
--- a/webapp/js/settings.js
+++ b/webapp/js/settings.js
@@ -458,6 +458,71 @@ function closeTierModal() { document.getElementById('tierModal').style.display =
// and opens the URL in a new tab. Stays purely in the panel — no auth,
// no API hit, the user reviews the issue body in GitHub before posting.
let _bugCtxCache = null;
+// 4.19.3 (#106): the report must say what went wrong. Issue #106 arrived
+// with "What happened" and "Expected" empty and one unrelated log line —
+// nothing to act on. The required box above the details is checked here,
+// with inline copy (never alert()), and the server checks it again.
+const BUG_WHAT_MIN = 10;
+const BUG_WHAT_HINT = "A sentence or two in your own words. The log below is "
+ + "attached for you, but it can't tell us what you saw.";
+const BUG_WHAT_SHORT = 'Please tell us what went wrong in a sentence or two '
+ + '(at least ' + BUG_WHAT_MIN + ' characters), e.g. "The render stopped at '
+ + '40% and the card says helper failed." Without it we can\'t tell what to fix.';
+// The person's own text, line breaks kept; any line that starts with "#"
+// is escaped so it can't become a heading that ends the section early
+// (Codex, 4.19.3).
+function bugWhatText() {
+ const el = document.getElementById('bugWhat');
+ const raw = el ? String(el.value || '').replace(/\r\n?/g, '\n').trim() : '';
+ return raw.replace(/^([ \t]*)#/gm, '$1\\#');
+}
+// Counted with whitespace collapsed, the same way the server counts.
+function bugWhatOk() {
+ const el = document.getElementById('bugWhat');
+ return (el ? String(el.value || '') : '').replace(/\s+/g, ' ').trim().length >= BUG_WHAT_MIN;
+}
+function bugWhatShow(invalid) {
+ const el = document.getElementById('bugWhat');
+ const hint = document.getElementById('bugWhatHint');
+ const wrap = el && el.closest('.bug-what');
+ if (wrap) wrap.classList.toggle('is-invalid', !!invalid);
+ if (el) el.setAttribute('aria-invalid', invalid ? 'true' : 'false');
+ if (hint) hint.textContent = invalid ? BUG_WHAT_SHORT : BUG_WHAT_HINT;
+}
+// Clears the warning as soon as the text is long enough; never shows it
+// while someone is still typing their first words.
+function bugWhatInput() {
+ const wrap = document.getElementById('bugWhat')?.closest('.bug-what');
+ if (wrap && wrap.classList.contains('is-invalid') && bugWhatOk()) bugWhatShow(false);
+}
+// Put the box's text under "## What happened" in the issue body: into an
+// existing heading if the person kept one, else before "## Expected" /
+// "## Logs", else at the end.
+function bugComposeBody(body, what) {
+ if (!what) return body;
+ const head = /^##[ \t]*What happened[ \t]*$/mi;
+ const m = head.exec(body);
+ if (m) {
+ const at = m.index + m[0].length;
+ return body.slice(0, at) + '\n\n' + what + '\n' + body.slice(at);
+ }
+ const sec = '## What happened\n\n' + what + '\n\n';
+ for (const re of [/^##[ \t]*Expected/mi, /^##[ \t]*Logs/mi]) {
+ const k = body.search(re);
+ if (k >= 0) return body.slice(0, k) + sec + body.slice(k);
+ }
+ return body.replace(/\s*$/, '\n\n') + sec;
+}
+// "[bug] " alone is no title: use the first line of what happened.
+function bugComposeTitle(title, what) {
+ const t = (title || '').trim();
+ if (t && !/^\[bug\]$/i.test(t)) return t;
+ const line = String(what || '').split('\n').map(x => x.replace(/^[\s\\#]+/, '').trim())
+ .find(Boolean) || '';
+ if (!line) return '[bug] (untitled)';
+ const first = line.length > 72 ? line.slice(0, 71).replace(/\s+\S*$/, '') + '…' : line;
+ return '[bug] ' + first;
+}
async function openBugModal() {
const modal = document.getElementById('bugModal');
modal.style.display = 'flex';
@@ -469,17 +534,24 @@ async function openBugModal() {
const submitBtn = document.getElementById('bugSubmitBtn');
// Clear stale state in case the user opens twice in a row.
titleEl.value = '[bug] ';
+ const whatEl = document.getElementById('bugWhat');
+ if (whatEl) whatEl.value = '';
+ bugWhatShow(false);
bodyEl.value = 'Loading environment…';
statusEl.textContent = '';
submitBtn.disabled = false;
submitBtn.textContent = 'Open GitHub issue';
+ // A finished report rewires this button to "Done — close"; without this
+ // the NEXT report's "Open GitHub issue" just closed the dialog.
+ submitBtn.onclick = submitBugReport;
try {
const r = await fetch('/panel/bug-context');
if (!r.ok) throw new Error('bug-context: ' + r.status);
_bugCtxCache = await r.json();
} catch (err) {
bodyEl.value = '## Environment\n- (server context unavailable: ' + err + ')\n\n'
- + '## What I was doing\n\n\n## What happened\n\n\n## Expected\n\n';
+ + '## What I was doing\n\n\n## Expected\n\n';
+ setTimeout(() => document.getElementById('bugWhat')?.focus(), 50);
crashRow.style.display = 'none';
return;
}
@@ -495,9 +567,6 @@ async function openBugModal() {
## What I was doing
-## What happened
-
-
## Expected
@@ -518,17 +587,9 @@ ${tail}
} else {
crashRow.style.display = 'none';
}
- // Focus the "What I was doing" line for the user to start typing.
- // Place caret right after the heading.
- setTimeout(() => {
- bodyEl.focus();
- const marker = '## What I was doing\n';
- const idx = bodyEl.value.indexOf(marker);
- if (idx >= 0) {
- const pos = idx + marker.length;
- bodyEl.setSelectionRange(pos, pos);
- }
- }, 50);
+ // Focus the required "What happened?" box — the one thing only the
+ // person filing the report can supply.
+ setTimeout(() => document.getElementById('bugWhat')?.focus(), 50);
}
function closeBugModal() {
document.getElementById('bugModal').style.display = 'none';
@@ -539,8 +600,9 @@ function closeBugModal() {
// server-side the same way (see get_panel_bug_context).
async function copyBugDiagnostics() {
const statusEl = document.getElementById('bugStatus');
- const title = document.getElementById('bugTitle').value.trim() || '[bug] (untitled)';
- const body = document.getElementById('bugBody').value;
+ const what = bugWhatText();
+ const title = bugComposeTitle(document.getElementById('bugTitle').value, what);
+ const body = bugComposeBody(document.getElementById('bugBody').value, what);
try {
await navigator.clipboard.writeText(title + '\n\n' + body);
if (statusEl) statusEl.textContent = 'Copied — paste it anywhere (a forum post, a DM, a translated message).';
@@ -551,8 +613,16 @@ async function copyBugDiagnostics() {
async function submitBugReport() {
const submitBtn = document.getElementById('bugSubmitBtn');
const statusEl = document.getElementById('bugStatus');
- const title = document.getElementById('bugTitle').value.trim() || '[bug] (untitled)';
- const body = document.getElementById('bugBody').value;
+ if (!bugWhatOk()) {
+ // Inline, next to the box, and focus it: no pop-up dialog, nothing sent.
+ bugWhatShow(true);
+ statusEl.textContent = '';
+ document.getElementById('bugWhat')?.focus();
+ return;
+ }
+ const what = bugWhatText();
+ const title = bugComposeTitle(document.getElementById('bugTitle').value, what);
+ const body = bugComposeBody(document.getElementById('bugBody').value, what);
const includeCrashEl = document.getElementById('bugCrashCheck');
const includeCrash = includeCrashEl && document.getElementById('bugCrashRow').style.display !== 'none'
? !!includeCrashEl.checked : false;
@@ -563,9 +633,18 @@ async function submitBugReport() {
const r = await fetch('/panel/bug-report', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ title, body, includeCrashReports: includeCrash }),
+ body: JSON.stringify({ title, body, whatHappened: what, includeCrashReports: includeCrash }),
});
const data = await r.json();
+ if (data && data.field === 'what_happened') {
+ // Server backstop agreed the description is missing: same inline copy.
+ bugWhatShow(true);
+ statusEl.textContent = '';
+ submitBtn.disabled = false;
+ submitBtn.textContent = 'Open GitHub issue';
+ document.getElementById('bugWhat')?.focus();
+ return;
+ }
if (!r.ok || !data.issueUrl) throw new Error(data.error || ('HTTP ' + r.status));
// Open the issue in a new tab. noopener for safety.
window.open(data.issueUrl, '_blank', 'noopener');
@@ -1454,7 +1533,7 @@ Object.assign(globalThis, {
appearanceGet, applyAppearance, setAppearance,
renderNotifyState, toggleNotify, askNotifyPermission,
updateModelsCard, dismissModelsCard, applyTierGates, openTierModal,
- closeTierModal, openBugModal, closeBugModal, submitBugReport, copyBugDiagnostics,
+ closeTierModal, openBugModal, closeBugModal, submitBugReport, copyBugDiagnostics, bugWhatInput,
openSettingsModal, toggleAnalytics, saveAnalyticsKey, clearAnalyticsKey,
toggleSpicyMode, onTokenInput, toggleTokenVisibility, testToken,
clearToken, closeSettingsModal, applySettings, _applyHdrPillAvailability,
diff --git a/webapp/style/panel.css b/webapp/style/panel.css
index 48ec865..63ce2c0 100644
--- a/webapp/style/panel.css
+++ b/webapp/style/panel.css
@@ -12706,3 +12706,17 @@ body[data-engine="h3"][data-vmode="v2a"] #h3LengthLabel { display: none !importa
#a2vH3QualityGroup .pill-btn { align-items: center; text-align: center; }
#mvOneShotDetails:not([data-a2v-engine="h3"]) .a2v-h3-only { display: none !important; }
#mvOneShotDetails[data-a2v-engine="h3"] .a2v-ltx-only { display: none !important; }
+
+/* ---- Bug report: the required "What happened?" box (4.19.3, #106) ------- */
+#bugModal .bug-what { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
+#bugModal .bug-what > span:first-child { color: var(--text); font-weight: 600; font-size: 12.5px; }
+#bugModal .bug-what-req { font-weight: 400; color: var(--muted); font-size: 11px; margin-left: 6px; }
+#bugModal .bug-what textarea {
+ padding: 8px 10px; font-size: 13px; line-height: 1.45; resize: vertical; min-height: 56px;
+ background: rgba(140,160,220,0.04); border: 1px solid var(--ph-border-soft); border-radius: 6px;
+ color: var(--text); font-family: inherit;
+}
+#bugModal .bug-what textarea:focus { outline: none; border-color: var(--accent-bright, #7e98ff); }
+#bugModal .bug-what-hint { font-size: 11.5px; line-height: 1.4; color: var(--muted); }
+#bugModal .bug-what.is-invalid textarea { border-color: var(--danger, #f85149); }
+#bugModal .bug-what.is-invalid .bug-what-hint { color: var(--danger, #f85149); }