Skip to content

fix(net): an END_OF_TRACK after a local unsubscribe no longer closes the session - #8769

Merged
kixelated merged 4 commits into
mainfrom
fix/interop-end-of-track-after-release
Nov 14, 2026
Merged

kixelated merged 4 commits into
mainfrom
fix/interop-end-of-track-after-release

Conversation

@kixelated

@kixelated kixelated commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The scheduled Interop run 43606836954 (2026-11-14, bd617cc1e) failed only Media output and lifecycle, on live incumbent fallback plays over moq-transport-22. The viewer's own log shows why the fallback took longer than its 1039 ms bound: its session closed with invalid END_OF_TRACK: track is closed and reconnected.

The relay forwards a withdrawn route's END_OF_TRACK while the viewer, following the route change, releases that track. #endPending refuses an end on a released track, and js/net's moq-transport subscriber turns that refusal into a ProtocolViolation, which closes the whole session, every other subscription included. The publisher did nothing wrong: the track was already gone.

Approach

When the END_OF_TRACK stream's track is already released with no end declared, the marker has nothing to end: return, as an already-ended subscription does. A released track that did declare an end still goes through endTrack, so a conflicting end stays a violation. A test holds the marker's stream open, releases the track, and checks the session stays open; it fails on main.

The Rust subscriber (end_track) reads the marker in one poll after poll_aborted, with no await in between, so it has no such window.

Impact

  • Public API: none. Wire: none.
  • Behavior: @moq/net no longer closes a moq-transport session for an END_OF_TRACK that lands after the local unsubscribe.

Alternatives

  • Make #endPending ignore a closed track for every caller (lite, FETCH): wider than this race, and it would hide a real contradiction elsewhere.
  • Loosen the harness's 1039 ms switch bound: it would hide the session close instead of fixing it.

Validation

  • bun test src/ietf in js/net: 656 pass. The new test fails on main's subscriber.ts with Error: track is closed and passes with the change.
  • just test media --media-cases replacement at ce616b52c (no change): this PR does not make it reliable. Over 14 local runs on a host at load 50 it failed 4 times, always as live incumbent fallback plays or the fallback audio tone, on moq-lite-06 and moq-transport-22. The one failure whose log I kept (lite-06, no reconnect) shows no END_OF_TRACK violation, so it is a separate cause (see Waiting).

Caused by

  • moq-dev/moq#4086 - added the strict END_OF_TRACK refusal without considering a locally released track (found by canary: the scheduled Interop run).

Decisions taken without the maintainer

  • Keep the replacement case running on Chromium (recommended: the 2026-11-09 decision closes quest/m0/interop-green/ on a pass that runs it). Since moq-dev/moq#8443 dropped its quarantine it also flakes for a second reason this PR does not fix: after a fallback the audio stalls past the 1039 ms bound, with skipping missing groups on the audio track in both failing logs. If the scheduled run keeps failing on it, quarantine it for Chromium again, as for Firefox, until quest/m2/audio-playout/ or the cluster-routing quest owns it. Rejected: widening SWITCH_MS.
  • No Rust change: the Rust subscriber reads the marker in one poll after poll_aborted, with no await in between.

Models

Size: XS
Implementer: Claude Code, claude-sonnet-5-5, unknown effort

(Written by Claude Sonnet 5.5)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: ad39f0e

  • Base: origin/main at a4dee24

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1dbcf-a833-74e3-bb08-a006fc7033f6, round 2

  • Score: 9/10, The incremental change ensures test spies are restored even on failure, with no actionable defects found by source inspection; builds and tests were not run as instructed.

  • Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

  • Reviewer: Codex, gpt-6.1-sol, low effort, shadow

  • Session: 01a1dbcf-a833-7c42-b608-fdd5d346cff8

  • Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0

kixelated and others added 3 commits November 14, 2026 12:13
…the session

The moq-transport subscriber refused an END_OF_TRACK marker that landed on a track
its own unsubscribe had already released, which is a protocol violation that closes the
whole session. A viewer following a relay's route fallback then reconnected, and the
fallback missed Interop's switch bound.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…cement flake

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 14, 2026 20:47
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Subscriber.handleGroup now ignores END_OF_TRACK when the track has been released but is not finished. A regression test checks that this marker does not close the session. The Interop README updates prior fix status and records November 13–14 run results, including the marker violation and separate replacement failures.

Severity of issue fixed: Low

Merge Risk: Minimal · up to ad39f

This change stops a late end-of-track marker from closing a session after the track has been locally released. It makes no public API or wire changes and adds a regression test. No remaining merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: an END_OF_TRACK marker arriving after a local unsubscribe no longer closes the moq-transport session in @moq/net. The raw summary confirms the subscriber.ts change tha…
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 states the problem (a failing Interop run where an END_OF_TRACK marker arriving after a local unsubscribe closes the moq-transport session), the approach (return early when a released …
Full details: Title check

Explanation

The title names the main change: an END_OF_TRACK marker arriving after a local unsubscribe no longer closes the moq-transport session in @moq/net. The raw summary confirms the subscriber.ts change that ignores such a marker after the track is released, with a matching test. The title is specific and matches the changeset.

Full details: Description check

Explanation

The description states the problem (a failing Interop run where an END_OF_TRACK marker arriving after a local unsubscribe closes the moq-transport session), the approach (return early when a released track declared no end), the test added, the Rust subscriber rationale, and validation results. It is specific to the changeset and related to the summarized changes in subscriber.ts, subscriber.test.ts, and the interop README notes.

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: a8bd95af-e180-44fd-b3bc-dd75263ccf0b
Commits

Reviewing files that changed from the base of the PR and between 6f8b127 and ad39f0e.

Files selected for processing: 3

  • js/net/src/ietf/subscriber.test.ts
  • js/net/src/ietf/subscriber.ts
  • quest/m0/interop-green/README.md

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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one test-hygiene suggestion inline.

Reviewed changes

Reviewed the full diff: the moq-transport subscriber's END_OF_TRACK handling, its regression test, and the quest notes.

  • Tolerate END_OF_TRACK on a released track: the new guard in subscriber.ts returns early exactly when #endPending would throw track is closed. That case is a released track with no declared end. A released track that did declare an end still goes through endTrack, so a conflicting end is still a violation. The check runs synchronously right before endTrack, so nothing can release the track in between.
  • Regression test: holds the marker's stream open, releases the track, and asserts the session is not closed. subscribeTrack now also returns the transport pair.
  • Quest notes: record the 11-13 and 11-14 interop triage and the separate replacement audio-stall flake.

I could not run bun test here: bun install fails because @moq/libav needs Nix to build. I checked the logic against #endPending in js/net/src/track.ts by reading the code.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread js/net/src/ietf/subscriber.test.ts Resolved
@moq-bot
moq-bot Bot disabled auto-merge November 14, 2026 20:56
@moq-bot

moq-bot Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

quest land watch: ended this pull request's pick, disarming its auto-merge, since its head efab5ec is held by finding by pullfrog[bot]: Tail.prototype.open is patched for every test in the process, but it is only restored on the last line. If `await open (#8769 (comment)). Push a fix, or answer each by a thread reply or a comment linking its review or decision, then land it again.

(written by quest land watch)

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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Reviewed the one new commit since the prior pullfrog review.

  • Restored test spies in onTestFinished: Tail.prototype.open and close spies are now restored, and the held END_OF_TRACK stream released, even when a wait or assertion fails. This addresses the prior test-hygiene suggestion; onTestFinished is already imported.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 2f328ef Nov 14, 2026
7 checks passed
@kixelated
kixelated deleted the fix/interop-end-of-track-after-release branch November 14, 2026 23:49
kixelated added a commit that referenced this pull request Nov 15, 2026
Drop #8769's group-stream guard and this branch's duplicate test: the
track's wire end now ignores a late end for every path.

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