Skip to content

test(media): the lifecycle pages idle through the replacement section - #9494

Merged
kixelated merged 8 commits into
mainfrom
quest/m0/interop-green/firefox-replacement
Nov 23, 2026
Merged

kixelated merged 8 commits into
mainfrom
quest/m0/interop-green/firefox-replacement

Conversation

@kixelated

@kixelated kixelated commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The Nightly's Media (firefox player) failed the replacement case every night since it first ran on Firefox. During the section, the 4-vCPU ubuntu-24.04-arm runner, decoding in software, runs five media pages: the lifecycle fixture and player, which the section never measures, plus its own old and new fixtures and viewer. Each failing night, the lifecycle player underflowed together with the replacement viewer.

Approach

  • The replacement section detaches the lifecycle player and waits until it holds no session, audio graph, or worker. It also disables the lifecycle fixture's video, which onDemand: "retain" would otherwise keep encoding with no subscriber. After the section, it re-enables the video, reattaches the player, and waits for it to reach live (lifecycle player returns), so the cases after it run as before. The detach and its resource wait are now one detach() helper, which the detach case shares.
  • capture denial holds publication now opens its 1 s window only after the viewer leaves connecting. A viewer reports connecting until its session could have seen an announcement, and the check required offline from the first sample. It also prints the offending sample instead of the last one. On this x86 host, --media-cases capture-denial on Firefox failed 3 of 3 before and passes 3 of 3 after (Chromium passes too). On the ARM runner, base and fix both passed 10 of 10, so this race is not what turned the Nightly red.
  • The resume audio/video sync failure line in waitForLive now traces from the first sample's page clock. It used the driver's Date.now(), which printed +-1795469434.69s.
  • The quest is rewritten to what remains: the moq-lite-06 fallback's audio on ARM (see Validation).

Impact

  • Public API: none. Wire: none. Test harness only (test/interop/clients/js/media.ts).
  • The replacement section takes a few seconds longer, for the reattach and the wait for live.

Validation

Differential on the Nightly's runner class (ubuntu-24.04-arm), using a temporary pull_request workflow that ran just test media --media-engines firefox --media-cases replacement five times per job. The base variant checked out only the base's media.ts. The workflow is deleted from the branch.

Variant Runs Passed Run
base 20 4 45269012363
fix 20 19 45269012363
fix (final code) 10 10 45273438175
capture-denial, base / fix 10 / 10 10 / 10 45273438175

With the fix on ARM, the switch times are:

Wire Replacement Fallback
lite-07 133–395 ms 216–421 ms
moq-transport-22 159–262 ms 212–321 ms
lite-06 131–284 ms 716–1026 ms

The bound is 1039 ms, and the one fix-side failure in 30 was that lite-06 fallback. Its viewer showed the incumbent's picture with its audio unanchored (audioStalled: true, audioTimestamp: 0), after two skipping missing groups: track=audio. The relay log shows no err=old in that window. On x86, the lite-06 fallback takes 308 ms. This residual is the quest's remaining work.

Two full just test media --media-engines firefox runs on the fix (an earlier commit, without the capture-denial fix) failed before the replacement section, in code this PR does not change:

  • rejoin reaches live, with audio unanchored. Its relay log has a group error err=old, the mechanism moq-dev/moq#9492 (quest/m0/interop-green/reattach-old-groups.md) owns.
  • resume audio/video sync: reattach reaches live: offset 800ms. It was seen once, with no err=old. The Nightly triage owns it if it recurs.

Local (x86, host load 9–14 of 24 CPUs):

  • Focused replacement on Firefox passes.
  • A full just test media --media-engines chromium,firefox passed all three replacement wires within the full sequence, and every case after it on Firefox. Chromium failed audio tone: after codec rename at 67/75 samples, a case that runs before this PR's change.
  • just check passes.

Caused by

  • moq-dev/moq#8488: made a watcher report connecting instead of offline while its connection is down, but left capture denial holds publication requiring offline from the first sample (found by check).
  • moq-dev/moq#5272: traced the resume sync failure from the driver's clock against page-clock samples (found by check).
  • The starvation has no single culprit: the replacement section has run five media pages since it was added. It surfaced when Firefox on the ARM runner first reached the case.

Alternatives

  • Run the replacement section in its own media.ts invocation, without the lifecycle pages. It would cost another browser launch and cold start per engine, which detaching avoids.
  • Loosen the 1039 ms bound or retry the case. The quest rules both out.

Follow-ups

None new. The lite-06 fallback residual stays in this PR's quest, rewritten. The rejoin failure belongs to moq-dev/moq#9492.

Decisions

  • Land now as a partial fix, or hold until the lite-06 fallback residual is fixed too: ✅ land now, with the quest rewritten to the leftover moq-lite-06 ARM fallback (rejected: hold until the lite-06 fallback also passes). The load fix moves the Nightly's failure rate on its runner class from 16 of 20 to 1 of 30, and the residual is a separate cause. Decided by the maintainer in test(media): the lifecycle pages idle through the replacement section #9494 (comment).

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, high effort

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with high)

Review

Rewritten by quest review after each round.

  • Head: 5e58140

  • Base: origin/main at ed1d0b0

  • Risk: low, The change touches only quest plan and README documentation and the interop test client `test/interop/clients/js/media.ts`, so nothing a consumer, relay, or published package relies on can break, and a revert fully undoes it.

  • Classified: low by Claude Code, claude-haiku-5-5, low effort, session 68a8fda8-82e0-49dc-b446-e3a37e488b08

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

  • Session: 01a20a6d-7873-7f11-9238-6742163efce9, round 1

  • Score: 9/10, The altered contracts remain consistent with callers, state producers, and lifecycle cases, with no actionable defects found; builds and tests were not run as instructed.

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

  • Findings: none

@kixelated kixelated changed the title Firefox plays a live replacement and its fallback within the bound test(media): the lifecycle pages idle through the replacement section Nov 23, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (via /quest-run, 2026-11-23): ✅ land now as a partial fix, with the quest rewritten to the leftover moq-lite-06 ARM fallback (rejected: hold until the lite-06 fallback also passes).

(Written by Claude Opus 5.5)

@kixelated
kixelated marked this pull request as ready for review November 23, 2026 22:06
@kixelated

Copy link
Copy Markdown
Collaborator Author

Applying #9494 (comment): head 5e58140 already rewrites quest/m0/interop-green/firefox-replacement.md to the leftover moq-lite-06 fallback on ARM, so no code change was needed. The Waiting item moved to ## Decisions and the PR is marked ready to land as a partial fix.

(Written by Claude Opus 5.5 with high)

@kixelated
kixelated enabled auto-merge November 23, 2026 22:07

@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.

Approach: sound. It reduces load on the runner by idling the two lifecycle pages through the replacement section, instead of loosening the switch bound or retrying. Reusing the existing detach/reattach and disableVideo/enableVideo commands avoids launching another browser.

Reviewed changes

I reviewed all three files at 5e58140: the media harness and the two quest docs.

  • Replacement section idles the lifecycle pair: before the section, the lifecycle player detaches and the test waits until it holds no resources. The lifecycle fixture stops encoding video. Afterward the video is re-enabled and the player reattaches and must reach live (lifecycle player returns), so the cases after the section start from the same state as before. A failure inside the section throws and aborts the run, so the missing restore on that path is harmless.
  • Shared detach() helper: the detach case now calls the same helper. It keeps the resource baseline assertion name that the leak control depends on.
  • Capture denial waits out connecting: the 1 s absence window now opens only after the viewer has left connecting. A viewer that reaches live instead still fails the check, and the failure message now prints the offending sample.
  • Resume-sync trace origin: traceLine now counts from the first sample's page-clock at value instead of the driver's Date.now(). This fixes the nonsensical offset printed in the trace.
  • Quest docs: the docs now describe the remaining moq-lite-06 fallback audio problem on ARM.

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

@kixelated
kixelated added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 11ef35c Nov 23, 2026
11 of 12 checks passed
@kixelated
kixelated deleted the quest/m0/interop-green/firefox-replacement branch November 23, 2026 22:09
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