Skip to content

quest(m0): a browser publisher stall ratchets viewer latency - #6149

Merged
kixelated merged 3 commits into
mainfrom
claude/quest-plan-bug-071cfa
Oct 21, 2026
Merged

kixelated merged 3 commits into
mainfrom
claude/quest-plan-bug-071cfa

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Plans a user report from moq.dev/publish (Brave on Fedora 44 Wayland, also reproduced on macOS): a live camera publish makes the viewer's total buffer climb (8.8 s, 11 s, 12.7 s, 42 s) even at a 100 ms or Auto latency, while bbb.hang stays near 0.4 s.

Findings (code reading, not yet reproduced)

  • The publisher's Estimator (js/publish/src/jitter.ts) advertises the lifetime maximum flush-lateness spread as catalog jitter/delay, and the hang draft forbids lowering them, so one publisher-local stall persists for the broadcast.
  • The watcher adds both terms to its Auto target with no bound. The deployed release build also adds them on top of a fixed latency; main stopped that in feat(audio): measure the auto playout target from arrival timing #4162.
  • Likeliest trigger: the video encode loop never checks encodeQueueSize, so a software encoder slower than real time queues without bound. Alternatives: audio sample clock vs camera clock drift, throttled tab.
  • The alternating subscribe update flood is the watcher pushing every maxDelay change; remote error: 1 is a routine unsubscribe.

Quests

  • quest/m0/release-fixed-delay.md [XS]: port the fixed-latency behavior to release.
  • quest/m0/publish-stall-estimate.md [M]: reproduce, then remove the stall at its source.
  • quest/m1/subscribe-update-churn.md [S]: measure the update rate after the fix, then choose a cut.

Decisions

Goal: "A live publish from moq.dev/publish plays at the viewer's selected latency target; buffered media never grows past it, on any OS/browser."

  • ✅ Yes
  • Player guard only
  • Root cause only

Milestone

  • ✅ m0
  • m1

Subscribe update spam scoping

  • ✅ Decide after facts
  • Always separate
  • Always fold in

Publisher: how a local stall stops ratcheting the estimate

  • ✅ Fix stall at source, keep the never-fall rule
  • Let estimates decay (spec change)
  • Player-only

Player: bound the catalog's advertised jitter/delay in the Auto target

  • Reuse the 2 s AUTO_MAX_DELAY ceiling
  • ✅ No bound

Split

  • Two m0 quests
  • One quest
  • Epic + two children

(then, with no player bound) Second m0 quest

  • ✅ Just one m0 quest for the publisher (plus the backport below)
  • Reconsider player bound

Subscribe update churn

  • Drop it
  • ✅ Separate m1 quest

release runs the pre-#4162 player: act on it?

  • Next release cut
  • ✅ Backport quest

Backport milestone and scope

  • ✅ m0, release-only XS
  • m1

Where to cut update churn (first round's "coalesce in net" was withdrawn: SUBSCRIBE_UPDATE has no ack)

  • Power-of-two maxDelay in watch
  • Rate-limit per RTT in net
  • ✅ Measure first

m0 rank

  • ✅ After Release builds link
  • After Broadcast epochs
  • Top of m0

m1 rank

  • ✅ End of m1 (before the recurring audits)
  • Near the top

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

Plan the moq.dev/publish report where a viewer's buffer grows without bound:
fix the publisher-local stall feeding the never-falling catalog estimates,
port main's fixed-delay behavior to release, and measure the subscribe
update churn afterwards.

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

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 004219af-406e-4d91-b4f1-d97a81a8839a
📥 Commits

Reviewing files that changed from the base of the PR and between 2305f58 and 099f3f6.

📒 Files selected for processing: 5
  • quest/m0/README.md
  • quest/m0/publish-stall-estimate.md
  • quest/m0/release-fixed-delay.md
  • quest/m1/README.md
  • quest/m1/subscribe-update-churn.md
  • 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

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T17:26:48.855922Z 099f3f6 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merged origin/main; the only conflict was the m0 Required list in quest/m0/README.md, resolved by keeping both sides (main's qmux 0.5.3 and release shutdown backport entries, then this PR's release fixed delay and publisher stall estimate entries). quest check and just check pass. Codex reviewed the prior head with no findings; enabling auto-merge.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 21, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 099f3f6b6b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +60 to +61
- No player-side bound on the advertised terms. The player keeps trusting
the catalog's `jitter` and `delay`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bound untrusted catalog latency before resizing the audio ring

When an Auto viewer opens a broadcast whose audio rendition advertises a very large jitter or delay, this decision lets the valid U53 value flow through js/watch/src/audio/latency.ts:24-26 into ringSamples, and SharedAudioBuffer.setLatency then attempts to resize its shared ring to roughly twice that sample count (js/watch/src/audio/buffer.ts:220-233). A hostile publisher can therefore use a valid catalog to trigger a huge allocation, a RangeError, or an out-of-memory tab crash; retain adaptive behavior if desired, but clamp or reject values above a resource-safe ceiling before they size buffers.

AGENTS.md reference: AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

Merged via the queue into main with commit 13e06dc Oct 21, 2026
9 checks passed
@kixelated
kixelated deleted the claude/quest-plan-bug-071cfa branch October 21, 2026 22:13
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