Skip to content

test(interop): the native JS subscriber fails on an audio gap it reads - #9769

Merged
kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-5/interop-ffi-publisher-audio-gaps
Nov 27, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-5/interop-ffi-publisher-audio-gaps

Conversation

@kixelated

@kixelated kixelated commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m0/test-flakes-5/interop-ffi-publisher-audio-gaps.md and deletes it.

Problem

python -> * and go -> * interop cells once failed tone.py with timestamp gap on a loaded host (moq-dev/moq#9720), and nobody knew whether the gap came from the FFI encoder, the relay, or a reader.

Cause

Reproduced on that run's base (54c862e955), not on main:

  • Before moq-dev/moq#9561, every audio packet was its own group. The FFI publishers encode 2.5 ms Opus frames, so that was 400 groups (streams) a second.
  • A starved Node reader stopped granting stream credit fast enough. The subscription is newest first, so the relay shed the backlog behind the group waiting for credit (shedding a group ranked below one waiting for credit, 53 times in one failing round). That is the designed newest-first behavior.
  • @moq/hang's Container.Consumer reported each shed run as a gap read (skipping missing groups: track=tone 540001 -> 800000). The native JS subscriber skipped gap reads, so the cell failed later in tone.py as a timestamp gap.
  • The gap sizes were 20.5 to 420.5 ms: runs of whole 2.5 ms groups, not an encoder frame or write batch. The FFI encoder's stamps stayed contiguous. Every failure was -> js-native-node.

moq-dev/moq#9561 (100 ms audio groups, 10 streams a second) removed the cause. main passes every Python and Go cell under the same load.

Approach

  • test/interop/clients/js-native/subscribe.ts fails on a gap read, as the FFI clients already do, and names it: audio gap after N samples, at Tus for Dus. A delivery hole now says so, instead of surfacing as a decoder timestamp complaint in tone.py. Over the 600 ms it reads, this fails no cell that did not already fail: a gap inside the window already broke tone.py's continuity check.
  • tone.py's bound is unchanged. No retry or timeout was added.

Impact

Public API: none. Wire: none. Test client only.

Validation

All loops ran the media rounds alone (a scratch loop over start_publisher and run_round in interop.sh, not committed), through quest gate, under stress-ng --cpu 64 on a 32-core host. stress-ng ran bounded inside the gated command and was stopped by PID.

Tree Subscribers Rounds Python and Go cells Failures
54c862e955 (old base) cpp, c, gst, js-native-node, js-native-bun, rust 40 480 20 of 720, all python/go -> js-native-node, timestamp gaps
54c862e955 + this change same 12 144 3 of 216, each now audio gap after N samples, at T for D
main (541c0839bf) same 40 480 0 of 720
main + this change all nine, browser included, --timeout 30 30 540 1 of 810, rust -> js-native-node (follow-up below)

Also one unloaded full just test interop --publishers python,go,rust --subscribers cpp,c,gst,js-native-node,js-native-bun,rust: every media cell passed; finish go -> js-native-node failed (follow-up below). just check and just ci pass.

Caused by

No single PR: per-packet audio groups were the long-standing default until moq-dev/moq#9561, and the native JS client's audio feed skipped gap reads.

Alternatives

  • Keep the quest open until a Python or Go failure shows on main: 1,020 loaded Python and Go cells found none, and the old base's failures name a cause main no longer has.
  • Make the relay keep the backlog for newest-first subscribers waiting on credit: that is the designed shedding, and the 100 ms groups make it rare.

Decisions

Taken on my recommendation while the maintainer was away:

  • Finish the quest on the old-base reproduction plus clean loaded runs on main, instead of waiting for a main failure.
  • Fail the native JS subscriber on a gap read rather than leave it to tone.py.

Follow-ups

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, unknown (arm A)

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: 9bf4df8
  • Base: origin/main at ed3a269
  • Risk: low, The change deletes one quest plan file and adds two, plus a test-only interop client edit in test/interop/clients/js-native/subscribe.ts that throws on an audio gap; nothing a published consumer or deployed peer relies on changes, and a revert fully undoes it.
  • Classified: low by Claude Code, claude-haiku-5-5, low effort, session 9c2a8438-4616-4670-a97a-135c7e25becb
  • Risk file: bb7b1c0de60b
  • Local review: none, since the head is low risk

kixelated and others added 2 commits November 27, 2026 05:05
The FFI publishers' tone gaps came from 2.5 ms per-packet audio groups: a
starved Node reader ran out of stream credit, and the relay shed the
newest-first backlog behind the group waiting for it. The reader reported
each shed run as a gap, but this client skipped gap reads, so the cell
failed later in tone.py as a timestamp gap. #9561's 100 ms
groups removed the cause. This client now fails on the gap itself, as the
FFI clients do, naming where it is and how long.

Finishes quest/m0/test-flakes-5/interop-ffi-publisher-audio-gaps.md and
adds two follow-ups found while looping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title The Python and Go publishers' tone reaches every subscriber without a timestamp gap test(interop): the native JS subscriber fails on an audio gap it reads Nov 27, 2026
@kixelated
kixelated marked this pull request as ready for review November 27, 2026 15:45
@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The JavaScript native audio reader now throws an error when it receives a gap, including the decoded sample count, timestamp, and duration. The changes add an investigation note about AAC gaps under load, remove an earlier publisher timestamp-gap report, and add a note about a Node finish-reader timeout.

Merge Risk: Minimal · up to 9bf4d

This change makes the Node interop subscriber fail immediately when it reads an audio gap, and it adds investigation notes. The change affects only test tooling, with no API or wire impact, so it is low risk to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the native JS interop subscriber now fails on an audio gap read. It matches the subscribe.ts edit and the stated objective. The title uses the test(interop) scope and …
Description check Passed The description explains the problem, cause, approach, validation, and follow-ups. It relates directly to the changeset, which deletes the quest note and changes the native JS subscriber to throw on a…
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.
Full details: Title check

Explanation

The title names the main change: the native JS interop subscriber now fails on an audio gap read. It matches the subscribe.ts edit and the stated objective. The title uses the test(interop) scope and is specific enough for a reader scanning history.

Full details: Description check

Explanation

The description explains the problem, cause, approach, validation, and follow-ups. It relates directly to the changeset, which deletes the quest note and changes the native JS subscriber to throw on a gap read.

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: d3240609-af0f-447b-bfe1-0c1c1841c95f
Commits

Reviewing files that changed from the base of the PR and between 541c083 and 9bf4df8.

Files selected for processing: 4

  • quest/m0/test-flakes-5/interop-ffi-publisher-audio-gaps.md
  • quest/m0/test-flakes-5/js-native-aac-gap-under-load.md
  • quest/m0/test-flakes-5/js-native-finish-reader-exit.md
  • test/interop/clients/js-native/subscribe.ts
Files with no reviewable changes: 1

  • quest/m0/test-flakes-5/interop-ffi-publisher-audio-gaps.md

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

@kixelated
kixelated added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 65ce143 Nov 27, 2026
8 checks passed
@kixelated
kixelated deleted the quest/m0/test-flakes-5/interop-ffi-publisher-audio-gaps branch November 27, 2026 15:57
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