Skip to content

A reannounced sibling instance never replays its finish - #9695

Merged
moq-bot[bot] merged 6 commits into
mainfrom
quest/m0/test-flakes-4/gst-sibling-finish-replay
Nov 27, 2026
Merged

moq-bot[bot] merged 6 commits into
mainfrom
quest/m0/test-flakes-4/gst-sibling-finish-replay

Conversation

@kixelated

@kixelated kixelated commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Claims and finishes quest/m0/test-flakes-4/gst-sibling-finish-replay.md, which this PR deletes.

Summary

a_reannounced_sibling_instance_does_not_replay_its_finish failed about once in 300 to 600 runs with CPU burners running. Tracing it showed the first play of the sibling exiting through its cancel arm without recording the track's end, then the same instance returning and a second play replaying the last group.

Cause: Play::stream polls the track first and the cancel second, so an end that arrived with a cancel is still recorded. But the track's poll right after its last group can answer Pending while it has already woken itself to continue to the end (a second poll with the same waiter was Ready(None) in 85% of runs). A cancel racing that poll consumed the self-wake and the play let go before seeing the end.

Fix: when the cancel wins, drained polls the track with a waiter that records its own wakes, until a poll parks without waking itself. If that reaches the end, the finish is recorded as before. A frame still unread or a failure records nothing, so a cancel with a backlog still replays on return.

Validation

  • Reproduced before the fix: failures at runs 593/1500, 250/2000, 28/4000, and 617/4000 of just rs test -p moq-gst -E 'test(a_reannounced_sibling_instance_does_not_replay_its_finish)' --stress-count N with 8 to 12 busy-loop burners.
  • After: 5000 of 5000 under 12 burners, plus 4000 of 4000 unloaded.
  • just rs test -p moq-gst: 236 of 236. just check: passes.

Impact

Public API: none. Wire: none.

Caused by

  • moq-dev/moq#8526 - recorded the end when the track and cancel arrive together, but left a cancel that beat the track's own continuation wake unhandled (found by check)

Models

Size: S
Implementer: Claude Code, claude-sonnet-5-5, unknown (arm B)

🤖 Generated with Claude Code

Decisions

  • Accept the drained finding: the walk is the same bounded-per-poll work the play loop already does, so a budget would only add a magic constant.

Review

mechanical fix by claude, claude-opus-5-5, medium effort: merged base; base #9722 deleted the other test-flakes-4 child, so this PR's deletion of the last child left an epic README without a size, failing quest check; deleted the finished epic README as #9573 did for test-flakes-3; ran sh/quest.sh check and nix develop --command just ci base (all modules passed, incl. check quest and test rs for moq-gst) (head d32c363)

Rewritten by quest review after each round.

  • Head: 87e9ae1

  • Base: origin/main at 7ea4e0d

  • Risk: medium, If the new `drained()` check in `rs/moq-gst/src/source/imp.rs` is wrong, it could mark a track as finished too early or too late, so a GStreamer source replays or drops a group after a route reannounce, which affects moq-gst users. It is a fix that keeps the API and wire format, and a revert fully undoes it, so it is medium rather than high; the quest plan deletion is low.

  • Classified: medium by Claude Code, claude-haiku-5-5, low effort, session 7cf9ebdb-4907-45d1-a2d8-4d9c83dbc562

  • Risk file: bb7b1c0de60b

  • Accepted by the maintainer: the walk is the same bounded-per-poll work the play loop already does, so a budget would only add a magic constant

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

  • Session: 01a2193f-4805-7271-b73d-eb69e36aba6e, round 3

  • Score: 6/10, The probe now records a clean finish behind one stop marker, but a backlog of empty groups can still delay pad handoff after cancellation.

  • Rounds: 3; first round 1 (medium 1); findings 2 (medium 2): fixed 1, refuted 0, open 1

  • Findings, accepted by the maintainer:

    • Medium, rs/moq-gst/src/source/imp.rs:1942: Keep cancelled readers from draining live input
  • The last round's findings, at 9fe06d1:

    • Open: medium, rs/moq-gst/src/source/imp.rs:1940: Keep cancelled readers from draining live input; The probe adds a read after cancellation wins, and the group pop, buffer refund, and internal loop at `rs/moq-mux/src/container/consumer.rs:971`, `:1847`, and `:700` let that read process more groups than the buffer holds at once.
    • Fixed: medium, rs/moq-gst/src/source/imp.rs:1942: Record a clean finish behind a final marker; The branch at `rs/moq-gst/src/source/imp.rs:1945` passes one stop marker so the next poll can record a settled clean finish.

kixelated and others added 4 commits November 26, 2026 09:26
A cancel that wins a poll the track answered Pending to (a wake the track
gave itself on the way from its last group to its end) skipped recording the
finish, so the same sibling instance announced again replayed its last group.

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

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (relayed from the maintainer's /quest-run round, 2026-11-26):

  • Codex's round-3 finding (a hostile publisher's backlog of empty groups walked by drained in one poll): ✅ accept it (rejected: add a group-advance budget; drop the PR). The normal read loop already walks the same backlog before it sees the cancel, so the probe adds no new kind of work, and a budget would add a magic number that gives up on long legitimate tails.

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Applied the maintainer decision in #9695 (comment): the round-3 finding on drained is accepted in the review record on 87e9ae1, with no code change.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Nov 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 27, 2026
@moq-bot

moq-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

quest land watch: the merge queue removed this pull request at 87e9ae1 because its merge_group build failed (failed_checks).

The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs.

Queue / Queue build / Build (job) failure at step Check:

…p]
ci: wall and CPU seconds per module
    14       0  check rs (cancelled)
     0       0  check rs_cross
     5      40  check biome
    12      10  check markdown
     9      14  check gh (cancelled)
     0       0  check drill
     2       2  check quest (failed)
    14      68  whole run
##[error]ci: check quest failed
error: recipe `ci` failed on line 121 with exit code 1
##[error]Process completed with exit code 1.
##[group]Run actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
with:
  name: cargo-timings
  path: target/cargo-timings/cargo-timing-*.html
  if-no-files-found: ignore
  retention-days: 14
  compression-level: 6
  overwrite: false
  include-hidden-files: false
  archive: true
env:
  BASE: 7ea4e0d27d546397e7f82aa666aadd73d8f22725
  CHECK_FAIL_FAST: 1
  NEXTEST_TEST_THREADS: 24
  MBX_CACHE_LINKS: 1
  MBX_REMOTE_URL: 
##[endgroup]
With the provided path, there will be 7 files uploaded
Artifact name is valid!
Root directory input is valid!
Uploading artifact: cargo-timings.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 425555
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is cb98e899811c9374378fe68513a292115be010d748cbf7ca8246937811af11fc
Finalizing artifact upload
Artifact cargo-timings successfully finalized. Artifact ID 15165288611
Artifact cargo-timings has been successfully uploaded! Final size is 425555 bytes. Artifact ID is 15165288611
Artifact download URL: https://github.com/moq-dev/moq/actions/runs/45923837877/artifacts/15165288611
Post job cleanup.
##[start-action display=Run jdx/mr-boxington-action@88acf2bb50552c7c508cbac13e5f8c576b95b1de;id=__045131c8-f9d0-4a14-8dac-6133d3d946ae.mbx]
##[end-action id=__045131c8-f9d0-4a14-8dac-6133d3d946ae.mbx;outcome=skipped;conclusion=skipped;duration_ms=0]
Post job cleanup.
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git version
git version 2.56.0
Temporarily overriding HOME='/var/cache/github-runner-work/_temp/9850cf7c-c890-4738-a109-c98db70697a7' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --global --add safe.directory /var/cache/github-runner-work/moq/moq
Removing SSH command configuration
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --local --name-only --get-regexp core\.sshCommand
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git config --local --name-only --get-regexp ^includeIf\.gitdir:
[command]/nix/store/i2m3w4ly2w6grrmk1j59rb7zp09bssia-git-2.56.0/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
A job completed hook has been configured by the self-hosted runner administrator
##[group]Run '/nix/store/ajk9j3ljl36w9dicih57gyvbl3v6m72q-ci-cache-gc.sh/bin/ci-cache-gc.sh'
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash --noprofile --norc -e -o pipefail {0}
##[endgroup]
evicted 6 objects and 0 action results (70.4 MiB logical); 50.0 GiB logical remain
dropped 4 session event streams
Cleaning up orphan processes

Queue / Queue build / Report Queue (job) failure at step Report the build's result as Queue:

Current runner version: '2.338.2'
Runner name: 'nixos-moq-ci'
Runner group name: 'moq-queue'
Machine name: 'moq-ci'
##[group]GITHUB_TOKEN Permissions
Checks: write
Metadata: read
##[endgroup]
Secret source: Actions
Cache mode: write
Prepare workflow directory
Prepare all required actions
Uses: moq-dev/moq/.github/workflows/queue-build.yml@refs/heads/main (7ea4e0d27d546397e7f82aa666aadd73d8f22725)
Complete job name: Queue build / Report Queue
A job started hook has been configured by the self-hosted runner administrator
##[group]Run '/nix/store/ajk9j3ljl36w9dicih57gyvbl3v6m72q-ci-cache-gc.sh/bin/ci-cache-gc.sh'
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash --noprofile --norc -e -o pipefail {0}
##[endgroup]
evicted 0 objects and 0 action results (0 B logical); 50.0 GiB logical remain
evicted 0 objects and 0 action results (0 B logical); 50.0 GiB logical remain
##[group]Run conclusion=failure
�[36;1mconclusion=failure�[0m
�[36;1m[[ "$RESULT" == success ]] && conclusion=success�[0m
�[36;1mgh api "repos/$REPO/check-runs" -f name=Queue -f head_sha="$SHA" -f status=completed -f conclusion="$conclusion" \�[0m
�[36;1m  -f 'output[title]=Queue' -f "output[summary]=The queue build ended $RESULT." --silent�[0m
�[36;1m[[ "$RESULT" == success ]] || { echo "::error::the queue build ended $RESULT" >&2; exit 1; }�[0m
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash -e {0}
env:
  GH_TOKEN: ***
  REPO: moq-dev/moq
  SHA: f65cd621dfbc6546789ae4b1a8ef09a8000ecae7
  RESULT: failure
##[endgroup]
##[error]the queue build ended failure
##[error]Process completed with exit code 1.
A job completed hook has been configured by the self-hosted runner administrator
##[group]Run '/nix/store/ajk9j3ljl36w9dicih57gyvbl3v6m72q-ci-cache-gc.sh/bin/ci-cache-gc.sh'
shell: /nix/store/lfm00fnq66xfgbn099vqckabyl5jllz6-bash-interactive-5.3p20/bin/bash --noprofile --norc -e -o pipefail {0}
##[endgroup]
evicted 0 objects and 0 action results (0 B logical); 50.0 GiB logical remain
evicted 0 objects and 0 action results (0 B logical); 50.0 GiB logical remain
Cleaning up orphan processes

Queue / Queue (job) failure:

(GitHub has no log for this job: HTTP 404)

(written by quest land watch)

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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

  • 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: 0ca24b57-997c-49a3-9052-56d96eff879b
Commits

Reviewing files that changed from the base of the PR and between 87e9ae1 and d32c363.

Files selected for processing: 3

  • quest/m0/test-flakes-4/README.md
  • quest/m0/test-flakes-4/gst-sibling-finish-replay.md
  • rs/moq-gst/src/source/imp.rs

No actionable comments were generated in the recent review.

Walkthrough

When cancellation ends a play, Play::stream now drains the track and records the rendition as finished if the drain reaches the end. The new drained helper allows one End marker and returns true only on Ok(None). It returns false for other ready results or a pending poll without a wake. The change also deletes a note describing an intermittent sibling-finish replay test failure.

Severity of issue fixed: Low

Merge Risk: Minimal · previous review 87e9a

This change fixes an intermittent case where a reannounced sibling instance replayed its last group after cancellation. The change is small and confined to the cancellation path, and the author reports stress and suite results as passing. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main behavioral change: a reannounced sibling instance replays its finish, and the PR fixes the missed finish record when a cancel races the track's continuation wake. The title is…
Description check Passed The description is closely related to the changeset. It names the deleted quest plan, explains the race in Play::stream where a cancel consumes the track's self-wake, describes the drained fix, and li…
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 behavioral change: a reannounced sibling instance replays its finish, and the PR fixes the missed finish record when a cancel races the track's continuation wake. The title is specific and matches the changeset, which adds the drained helper in rs/moq-gst/src/source/imp.rs and deletes the quest plan. It does not mention the fix mechanism, but that is acceptable for a title.

Full details: Description check

Explanation

The description is closely related to the changeset. It names the deleted quest plan, explains the race in Play::stream where a cancel consumes the track's self-wake, describes the drained fix, and lists validation runs and API impact. It matches the raw summary of the drained helper and the file deletion.

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: 8b98b597-0aa4-4551-b06b-f7c15783315a
Commits

Reviewing files that changed from the base of the PR and between 4fba5df and 87e9ae1.

Files selected for processing: 2

  • quest/m0/test-flakes-4/gst-sibling-finish-replay.md
  • rs/moq-gst/src/source/imp.rs
Files with no reviewable changes: 1

  • quest/m0/test-flakes-4/gst-sibling-finish-replay.md

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

@moq-bot
moq-bot Bot added this pull request to the merge queue Nov 27, 2026
@moq-bot

moq-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

claude, claude-opus-5-5, medium effort land fixer note:

The queue's check quest step failed: quest/m0/test-flakes-4/README.md: quest title must be '# [XS|S|M|L|XL] Title'. Base #9722 already deleted ffi-run-end-timeout.md, the epic's other child. This PR deletes gst-sibling-finish-replay.md, so test-flakes-4 was left with just its README. The checker then treats that README as a leaf quest, and leaf quests need a size in their title.

I merged base and added one commit that deletes quest/m0/test-flakes-4/README.md. That follows the epic's own plan ("once it completes, the next flake opens a fresh one") and matches how #9573 finished test-flakes-3. quest/README.md already covers the case where no test-flakes epic is open. No code changed. sh/quest.sh check and just ci base both pass on the new head.

(written by claude, claude-opus-5-5, medium effort)

@moq-bot

moq-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

quest land watch: re-enqueued this pull request at d32c363, at the back of the merge queue, with the land fixer's fix (claude, claude-opus-5-5, medium effort): merged base; base &#35;9722 deleted the other test-flakes-4 child, so this PR's deletion of the last child left an epic README without a size, failing quest check; deleted the finished epic README as &#35;9573 did for test-flakes-3; ran sh/quest.sh check and nix develop --command just ci base (all modules passed, incl. check quest and test rs for moq-gst).

(written by quest land watch)

Merged via the queue into main with commit f7d79c3 Nov 27, 2026
5 checks passed
@moq-bot
moq-bot Bot deleted the quest/m0/test-flakes-4/gst-sibling-finish-replay branch November 27, 2026 01:47
kixelated added a commit that referenced this pull request Nov 27, 2026
main finished test-flakes-4 (#9695) and deleted its README, so the replay
flake opens a fresh epic carrying the last one's rules.

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