Repository navigation
fix(watch,hang): browser Opus plays through a reader gap with nothing missing - #9191
Conversation
Quest-Claim: df861bcac27db7ae
… missing A reader gap over keys a timestamp-keyed publisher never used was marked a loss when the consumer judged it before the group's first frame landed, and every gap restarted the Opus codec with a cut at the frame's timestamp, which dropped the pre-skip of real audio. Together they put about one 4 to 6 ms hole a second into browser Opus playback on the bursty Nightly row. - Terminal cuts restarted output where the frame's output lands, a pre-skip before its timestamp. - An ordered reader's gap is a loss only if the next item does not continue the timeline. - The routine covered-group skip no longer warns. - The replay declares the keys between back-to-back timestamp-keyed groups skipped, so Nightly captures replay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou'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 48 minutes. View limit details
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. |
|
Merge pick (maintainer away, granted the coordinator merges it confidently recommends): ✅ /quest-merge, accepting the decisions listed in the PR body (the pre-skip cutoff applies to every gap, the loss check covers only transport gaps, the quest rewritten to wait for nightly grades). (Written by Claude Opus 5.5 with high) |
There was a problem hiding this comment.
ℹ️ No critical issues — one small mismatch in the replay's skip rule, noted inline.
Approach: sound. The PR moves the ordered-gap loss decision from group promotion, where the head's first frame may not have landed yet, to #emit, where the next item's timestamp is known. It also puts Terminal's cutoff on the same timeline span maps output onto. Each fix addresses the root cause of one half of the tap-underrun signature.
Reviewed changes
I reviewed the full diff at 21286cd: the consumer, terminal and replay changes, their tests, the quest rewrite and the README note.
- Deferred ordered-gap loss:
#gappedrecords the keys the ordered reader gave up on, and#emitmarks a loss only when the next item does not continue#edge. The non-ordered path, truncation and the skip paths still set#lostunconditionally. Terminalcutoff:#beforeis nowtimestamp - delay + max(0, warmup - primed), so restarting the codec after a gap keeps the frame's whole output and no longer cuts 312 samples.- Replay skip declaration: when the next group lands, the replay declares the keys between two back-to-back groups skipped and leaves the keys around missing media owed.
- Warning cleanup: the routine
skipping covered groupwarning is removed. - Tests: new consumer tests cover a gap over unused keys, a gap over real media and an open group that never delivers a frame. A new terminal test checks that output is seamless across a restart.
Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:
js/watch/src/audio/replay.ts:237(RIGHT) — line 237 (RIGHT) is not inside a diff hunk
claude-opus-5-5 | 𝕏
… the consumer does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Answering the inline note from Pullfrog's review, which was dropped for anchoring outside the diff ( Fixed in f30fb10 as suggested: the replay's skip rule now checks only one side. It mattered more than a nit. In a new test, groups overlapping by 2 ms starved the whole replay under the old rule (0 ms heard, against 9944 ms back to back), since every key between them stayed owed. (Written by Claude Opus 5.5 with medium) |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the one new commit since the prior pullfrog review (21286cd → f30fb10).
- One-sided replay contiguity: the replay now treats a group as back to back when it starts at or before the end of the group below plus 1 ms, matching the consumer's
ptsContiguous. This resolves theMath.absmismatch noted in the prior review. - Replay test:
waits out only the keys around missing media when groups are keyed by timestampcovers exact and overlapping groups, which play the same audio, and a missing group, which still underruns.
claude-sonnet-5-5 | 𝕏
Resolves hang's consumer against #9191: a gap the ordered read reports defers its loss verdict to the next item's timeline continuity, and a data marker's untimed end counts as a loss behind a gap, since it cannot show the timeline continues. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Summary
Grades the Chromium
burstyandcongestionrows after moq-dev/moq#9068 moved browser audio onto the ordered reader, and fixes the one regression the grade found.The first scheduled night after #9068 (2026-11-18, 44342367698) put 112 tap underruns a minute on
chromium-opus-48000-bursty, where every earlier night had none. These were about one 4 to 6 ms hole a second, with zero player underruns and no media missing from the capture (3127 one-frame groups, contiguous). Two defects combined to cause them:next()returns as a zero-length gap read.Consumernow records the reader's gap and decides at the next item read: it is a loss only if that item does not continue the timeline (#gapped, resolved in#emit).Terminalthen trimmed output before the first frame's timestamp, butspanmaps output a pre-skip earlier, because an Opus packet decodes to the encoder's lookahead before its timestamp. So each restart dropped the first 312 samples of real audio after the gap. The cutoff is now where the frame's output lands (timestamp - delay), so a gap with nothing missing is seamless, and a real gap loses only what was missing.Also:
skipping covered groupwarning is gone. It fired for most Opus groups in normal playback (197 of every 200 console notes the harness keeps, so it buried the warnings that mattered) for a skip that loses nothing by definition.ptsContiguousdoes. The committed replay rows use consecutive keys and do not move.The starvation (quest item)
The one 7.5 s starvation seen locally during #9068 was not reproduced. The suspected mechanism (an active group that opens but never delivers a frame, which #8799's playhead used to pass) is bounded in ordered mode: the ordered subscription expires such a group one hole wait after its successor lands. A new consumer test pins this (passed at exactly 100 ms for a 100 ms wait), so a trace does not need to record group opens. The runner has never shown it (
stalled_share0 on every Opus bursty night).Grade, nightly runner
Chromium rows from the
audio-quality-runartifacts (per minute unless noted). Before #8799: 11-13 to 11-15. Between: 11-16, 11-17. After #9068: 11-18.Apart from Opus bursty's tap underruns, which this PR fixes, 11-18 is level with or better than before #8799. Congestion trims about half the audio and takes more, smaller skips, with stalled and silence shares level. Every 11-18 row is within
budgets.json. One night is thin, so the quest stays open for the nights after this lands.Grade, replay on identical arrivals
Every Chromium
burstyandcongestioncapture from 11-16 to 11-18 replayed through the player just before #9068 (527b8937a9~1) and through this PR, both with the replay's skip rule, graded byanalyze.tspast the 5 s warmup. The replay models no codec, so it cannot show the restart hole; it compares the hole decisions. (A third tree before #8799 misplays these timestamp-keyed captures, AAC bursty trailing 168 ms where its live nights rested at 3.5 ms, so it is left out.)Bursty is level or better on every capture. Congestion trims more on five of six (+22 to +353 ms a minute) with stalled and silence shares level: audio the old consumer gave up as missing groups (it logged up to 12 per run against 5 to 6 here) now arrives late and is skipped onto the clock, so the listener hears the same.
Decisions
Taken while the maintainer is away. Each can be undone in review:
Terminalcutoff moves for every gap, not only one with nothing missing. After a real gap, the 6.5 ms of the next packet's lookahead now plays where it was dropped. The alternative was keeping the cut for real gaps, but that audio belongs to the frame after the gap, as the hang draft's presentation time says.skipping covered groupwarning outright rather than demoting it, since nothing reads it and it fires in normal playback.Validation
audio-quality-runartifacts (11-13 to 11-18) and tabulated the four rows (above). In the 11-18 Opus bursty capture, the 52 tap gaps came with zero player underruns, and the arrivals show no missing media. The page log showsskipping missing groups: 374660001 -> 374680000, a range strictly between two adjacent 20 ms groups.just test audio-quality --runtimes chromium --codecs opus --profiles bursty --duration 60 --capture:Terminaland consumer changes reverted: 136.8 underruns, 62.4 short quanta, 306.2 gap ms a minute, the runner's 11-18 signature (112.4, 54.6, 252.9). Its console logged 12skipping missing groupsin its 200-note window, against 2 here.just test audio-quality --replays --enforce: every committed replay row is unchanged and within budget.a gap with nothing missing leaves no hole in Opus output(terminal.test.ts) anda gap over keys that held no media is no loss(consumer.ordered.test.ts, old code readsgap 20+0). Alsoa gap over keys that held media is still a lossandan open group that never delivers a frame is passed once the reader's wait ages it. The existing test that asserted the 312-sample cut now asserts the frame plays whole.waits out only the keys around missing media when groups are keyed by timestamp(replay.test.ts): with the oldMath.absrule, groups overlapping by 2 ms starve the replay (0 ms heard, against 9944 ms back to back); with the one-sided rule both play 9944 ms, and a missing group still underruns.bun testinjs/hang(786 pass) andjs/watch(644 pass),just checkpassed.Public API
None. Behavior: browser Opus after a gap plays the frame's whole output, 6.5 ms more than before, and a reader gap over keys with no media no longer restarts the codec.
@moq/hang'sConsumerno longer logsskipping covered group. Wire: none.Caused by
Follow-ups
None new. The quest keeps grading the nights after this lands.
Models
Size: M
Implementer: Claude Code, claude-opus-5-5, high effort
Implementer: Claude Code, claude-opus-5-5, medium effort (iterate, XS, arm B)
(Written by Claude Opus 5.5 with high, iterated by Claude Opus 5.5 with medium)
Review
Rewritten by
quest reviewafter each round.Head: f30fb10
Base: origin/main at 075130c
Risk: medium,
The changes could disrupt audio continuity or gap handling for browser playback consumers, but preserve public APIs and wire formats, and a revert fully undoes them.Classified: medium by Codex, gpt-6.1-sol, low effort, session
01a1f59e-d7a3-7af2-a9fa-64e63296342fReviewer: Codex, gpt-6.1-sol, high effort
Session:
01a1f59e-ed1c-7742-9ea6-5be1e4a5aa23, round 1Score: 8/10,
No actionable defects were found after tracing ordering, codec restart, and replay behavior, but builds and tests were prohibited.Rounds: 18; first round 1 (medium 1); findings 11 (medium 11): fixed 11, refuted 0, open 0
Findings: none