Skip to content

feat(room): live MoQ telemetry HUD in Debug mode - #64

Merged
kixelated merged 9 commits into
mainfrom
quest/m2/network-xray
Nov 26, 2026
Merged

kixelated merged 9 commits into
mainfrom
quest/m2/network-xray

Conversation

@kixelated

@kixelated kixelated commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Works on quest/m2/network-xray.md and rewrites it to the work that remains.

Problem

Debug mode only drew static catalog boxes, so you couldn't see MoQ's per-tile adaptive subscription or delivery health happening.

Approach

app/src/room/debug.ts now draws, only while Debug is on:

  • Per remote tile
    • each rendition, with the active one ringed green (red on a decode error)
    • the pixel target that the tile's size × room scale × zoom sets
    • an amber ▲ selected sd → hd / ▼ selected hd → sd banner, with the new rendition ringed amber for 3 s, whenever the simulcast selection moves (the ringed box is labeled selected, since the decoder may still show the old rendition until the new one arrives)
    • @moq/ui sparklines of video bitrate and frame rate, plus the decoders' late/stall/underrun/skip counters
    • the sparkline panel shows only on tiles at least 240 px tall where it fits beside the audio rendition box at their rendered widths (a ResizeObserver keeps that current), so a small tile doesn't get buried
  • Room-wide panel (top left, under the logo): PROBE round trip sparkline, downlink estimate, and PROBE target (the watched tiles' ceilings summed).
  • Zero overhead when off: every timer, subscription, ResizeObserver, and the PROBE observation lives inside the effect that Debug gates, so turning Debug off tears all of it down. Observing PROBE is what asks the relay for updates.

An audio jitter sparkline is left to the quest: the decoder's own ingress estimate, which sees every arriving group, is private at the pin, and a trace derived from the decoder's newest-arrival stats misses groups that arrive too late to be read, so it stayed flat through the dropouts it should explain.

WatchBroadcast now exposes its decoders' stats. The app depends on the workspace-only @moq/ui for graph and the formatters. Its stylesheet targets MoQ's shadow roots, so the HUD lays out the sparkline with Tailwind.

What the pinned moq/ lacks (the quest now waits on these)

  • Hang.Health exists in moq/js/hang/src/health.ts, but @moq/hang doesn't export it (not in index.ts, not in package exports). Upstream main doesn't either. A viewer grade also needs the player's own feedback snapshot, and Decoder.feedback() is @internal.
  • The audio decoder's measured ingress jitter (#measured in moq/js/watch/src/audio/decoder.ts, fed from the container consumer's spread) is private, so the HUD shows no audio jitter sparkline yet.
  • Publish-side counters for local tiles: @moq/room Local neither passes stats to its Publish.Broadcasts nor exposes its encoders, and Publish.Broadcast keeps its renditions private. So local tiles still show no HUD, the same as before.
  • The per-tile downlink grant (holdViewer in Watch.Player) is private. The HUD shows the connection-wide PROBE target instead.

Impact

  • Public API / wire: none. This is app-only, and WatchBroadcast is internal to the app.
  • Behavior: Debug mode only. Non-debug users see no change and pay no cost.
  • New dependency: @moq/ui (workspace:*, already a workspace member).

Decisions

Taken while the maintainer was afk; all are revertible:

  1. Land the HUD now; keep health grades, publisher counters, and grants in the quest under ## Waiting on moq-dev/moq. I didn't hold the PR or patch moq/ here. Alternative: hold the PR until upstream exports land, which would block a working HUD on three upstream changes plus a pin bump.
  2. Jitter from newest-arrival stats, superseded by the review fix below.
  3. No stats: true on local broadcasts. @moq/room Local doesn't take it, and nothing in Hang would read the track yet. That moves upstream together with the publisher-counters item.
  4. Network panel is room-wide, not per tile. RTT and the downlink estimate are per connection, and repeating them on every tile would be noise.
  5. Hide the sparkline panel on short tiles and wherever it would overlap the audio renditions, measured at rendered widths (was a fixed 440×240 CSS px threshold, which overlapped the audio box around 440 px). Rendition boxes still show.
  6. Follow-up quest quest/m2/network-xray-promote.md: the maintainer tries the HUD and decides how to promote it. It requires the health grades.
  • Maintainer, via /quest-run (comment): ✅ /quest-merge this PR (rejected: iterate, skip); follow-up quest/m2/network-xray-promote.md ✅ keep (rejected: drop). The head applies both: the PR is ready and the follow-up quest stays in the diff.
  • Taken while the maintainer was away (afk), by the /quest-run coordinator on the implementer's recommendation: accepted the review's last finding (silent audio intervals are skipped in the jitter trace, not drawn as gaps). Moot now that the jitter trace is gone.
  • Review fix on the merged head (iterate, no maintainer input): ✅ drop the audio jitter sparkline and app/src/room/jitter.ts until moq-dev/moq exposes the decoder's ingress estimate, as the reviewer recommended (rejected: keep the derived trace, which misses late groups the ordered reader skips). The audio counters stay; the quest's Goal and Waiting carry the sparkline.

Alternatives

  • Grading health locally in Hang by copying health.ts. Rejected: reusable diagnostics belong upstream, and a fork would drift.
  • Deep-importing moq/js/hang/src/health.ts by relative path. Rejected: it bypasses the package's exports and type-checks foreign code under the app's settings.

Follow-ups

  • quest/m2/network-xray-promote.md: maintainer tries and promotes the HUD (requires the health grades). No open decisions beyond its Maintainer: item.
  • For /quest-plan in moq-dev/moq (Hang's quest waits on each):
    • export Health from @moq/hang, and give Watch.Player a public feedback snapshot or a graded health output
    • let @moq/room Local pass stats/echoPath through and expose each published rendition's stats
    • expose Watch.Player's downlink grant
    • expose the audio decoder's measured ingress jitter, for the HUD's audio jitter sparkline
  • For /quest-plan in moq-dev/moq: @moq/ui's graph should draw an undefined sample as a break in the line instead of a zero (moq/js/ui/src/graph.ts:16). The HUD's bitrate and frame-rate traces draw a decoder restart's missing interval as zero, as MoQ's own watch overlay does today.
  • Noticed and left alone: the Debug HUD's z-index (100 + z, unchanged from before) draws over the Settings panel. It's minor and Debug-only.
  • Overlap: #58 (quest-tree audit) landed mid-iteration and conflicted on this quest's Plan. I kept this PR's rewrite and did not fold in quest: audit the quest tree #58's per-frame-arrival jitter wording: it describes the derived trace the review just replaced with the decoder's own estimate.

Validation

  • quest gate just check: Quest, TypeScript, Biome, API tests (41), app tests (64, including 7 new Jitter tests), and media tests (2) all pass.
  • Real surface: ran just dev, then joined room @xray-hud from two isolated headless Chrome sessions (agent-browser, fake camera and mic) with Debug on:
    • Rendition boxes, pixel target, sparklines, and the PROBE panel render. RTT reads 1 ms and the downlink estimate is live.
    • Wheel-zooming the remote tile raised the target from 0.13 to 1.03 MP and fired ▲ sd → hd (ring moved to hd). Zooming out fired ▼ hd → sd. The amber banner and ring showed up in a screenshot.
    • After the review fixes, re-ran quest gate just check on each head (all pass). I didn't repeat the browser run for the label and jitter-gap changes; they are text and a skipped push, covered by unit tests and types.
    • Toggling Debug off removed every HUD element (0 graphs, 0 boxes). Toggling it back on restored them without a rate spike. Before the fix, the first interval diffed the cumulative counters against zero; this run caught that and the fix is in.
    • Small tiles show only rendition boxes.
    • The host was at load 30 running two software-WebGL browsers. The HUD duly reported the resulting video stalls and up to 4 s of audio jitter, which is the degraded tile it exists to expose.
  • After merging main (clean merge, no conflicts): quest gate just check passes quest check, fallow --unused-deps (it accepts @moq/ui, which debug.ts imports), TypeScript, Biome, API tests (45), and app tests (81). The browser media tests timed out locally at load 25-30 (Vite page loads over 30 s in tests that never turn Debug on); CI on the merged head is the signal for those.
  • Review fixes on this head (bun run --cwd app check, quest check, fallow pass): ran just dev and drove two headless Chromium peers (Playwright, fake camera and mic, Debug on) through app/test/room.html with the app stylesheet, sweeping the viewport so the remote tile went from 196 to 620 px wide:
    • At a 440×248 tile (panel 188 px, audio box 260 px) the panel now hides; the old 440×240 rule showed it over the audio label. At 517×291 and 620×349 it shows beside the audio box with no overlap (screenshot checked).
    • Without the jitter trace the panel renders the video bitrate and frame-rate sparklines and both counter lines; the PROBE panel still renders.

Models

  • Size: M
  • Implementer: Claude Code, claude-opus-5-5, high
  • Implementer: Claude Code, claude-opus-5-5, medium effort (iterate, S)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with medium)

Review

Rewritten by quest review after each round.

  • Head: 1dbb66f

  • Base: origin/main at 9234698

  • Risk: medium, it adds to plans under quest/, which agents start without a person reading them

  • Classified: medium by default

  • Risk file: none

  • Reviewer: Codex, gpt-6.2-sol, high effort

  • Session: 01a219f7-29f8-7863-90d3-beee1ac1efa4, round 4

  • Score: 10/10, The branch’s only changes since the last review clarify the follow-up quest title and wrap a line, so the head is ready to land.

  • Rounds: 4; first round 2 (medium 2); findings 2 (medium 2): fixed 2, refuted 0, open 0

  • Findings: none

kixelated and others added 3 commits November 25, 2026 23:11
Quest-Claim: afe11371f13fc5b0
Debug mode now shows, per remote tile, its renditions with the live one
ringed, its simulcast pixel target, an amber flash on every HD/SD switch,
and sparklines of video bitrate, frame rate, and audio arrival jitter
beside the decoders' late, stall, underrun, and skip counters. A room-wide
panel shows the PROBE round trip, downlink estimate, and PROBE target.
Nothing is subscribed or timed while Debug is off.

Health grades and publish-side counters wait on moq-dev/moq exposing them;
the quest now tracks that remainder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title MoQ Network X-Ray HUD feat(room): live MoQ telemetry HUD in Debug mode Nov 26, 2026
kixelated and others added 2 commits November 25, 2026 23:33
A publisher sends no audio through a mute or a pause in speech, so an
interval without arrivals now reports nothing instead of a growing delay.
The simulcast flash names the source's selection, which the decoder may
not show yet. Sparklines need a 440px-wide tile so they clear the audio box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the jitter trace

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 26, 2026 08:23
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The room debug HUD now displays rendition states, video targets, delivery graphs, and counters. Watch video and audio expose decoder statistics, and the new Jitter class tracks arrival offsets. NetworkDebug samples PROBE metrics and is tied to the room’s signal cleanup. Quest documents describe the HUD status and promotion steps.

Merge Risk: Minimal · up to 4ef43 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(room): live MoQ telemetry HUD in Debug mode" matches the main change. The changeset adds a Debug-gated telemetry HUD in app/src/room/debug.ts, including rendition boxes, sparklines, PR…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is specific and related to the changeset. It explains that the PR adds a Debug-only telemetry HUD in app/src/room/debug.ts, that it exposes decoder stats through WatchBroadcast, and th…
Full details: Title check

Explanation

The title "feat(room): live MoQ telemetry HUD in Debug mode" matches the main change. The changeset adds a Debug-gated telemetry HUD in app/src/room/debug.ts, including rendition boxes, sparklines, PROBE round-trip and downlink panels, and audio jitter. Supporting changes add the Jitter class, the NetworkDebug class, and WatchBroadcast stats getters. The title is concise and follows the conventional-commit style.

Full details: Description check

Explanation

The description is specific and related to the changeset. It explains that the PR adds a Debug-only telemetry HUD in app/src/room/debug.ts, that it exposes decoder stats through WatchBroadcast, and that it adds the @moq/ui workspace dependency. It also describes the rewritten quest document, the deferred upstream API work, the validation run, and the review fixes that removed the audio jitter sparkline. The changeset summaries match these claims. The description is not off-topic and not vague, so the check passes.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 644ab0d6-1e09-45ba-ba1e-13322c5f141b
Commits

Reviewing files that changed from the base of the PR and between fc0dc04 and 4ef432b.

Files ignored due to path filters: 1

  • bun.lock is excluded by !**/*.lock
Files selected for processing: 8

  • app/package.json
  • app/src/room/debug.ts
  • app/src/room/index.ts
  • app/src/room/jitter.test.ts
  • app/src/room/jitter.ts
  • app/src/room/watch.ts
  • quest/m2/network-xray-promote.md
  • quest/m2/network-xray.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (via /quest-run): ✅ /quest-merge this PR (rejected: iterate, skip). Follow-up quest/m2/network-xray-promote.md: ✅ keep (rejected: drop).

(Written by Claude Opus 5.5)

kixelated and others added 4 commits November 26, 2026 13:49
… renditions

Measure both bottom panels with a ResizeObserver instead of a fixed
440 px width threshold, which let the panel cover the audio rendition
label on tiles around 440 px wide. Record the decoder's own jitter
estimate as an upstream ask in the quest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mate

The trace came from the decoder's newest-arrival stats, which miss
groups that arrive too late to be read, so it stayed flat through the
dropouts it should explain. Keep the audio counters, and move the
sparkline to the quest, waiting on moq-dev/moq to expose the decoder's
own ingress jitter estimate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep this branch's quest rewrite over #58's Plan, whose derived audio jitter the review replaced with the decoder's own estimate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant