Skip to content

fix(moq-net): a key-order read holding a copy wakes when the owed group lands - #9178

Merged
kixelated merged 2 commits into
mainfrom
quest/m1/resume-owed-wake
Nov 19, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m1/resume-owed-wake

Conversation

@kixelated

@kixelated kixelated commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m1/resume-owed-wake.md (deleted here).

Problem

A resumed key-order read on a front's logical track can leave a copy's cursor on a group outside its window, because the window still owes a lower group that may land on that copy (Reader::poll_lowest, the owes_below break in rs/moq-net/src/model/resume.rs). The copy's peek had returned the held group, so nothing parked the read on that copy. When the owed group then landed, the read stayed asleep until something unrelated woke it (another copy's group, a route change, a deadline). With the replaced copy dead it stalled until the budget ran out.

Approach

Before holding, register the copy's arrivals (track.poll_arrived), as the drained arm already does. If a group landed since the pass started, peek the copy again with a fresh arrival count, so a group that landed mid-pass is not missed and the loop stays bounded by arrivals. poll_arrived parks on any change to the copy's track state, so a later skip declaration or failure on that copy also wakes the read, which matters once moq-dev/moq#9115 makes owes_below depend on those.

Impact

  • Public API: none.
  • Wire: none.
  • Behavior: a resumed key-order read wakes when a group it holds a copy's cursor for lands on that copy.

Caused by

  • moq-dev/moq#8638 - added the owes_below hold in poll_lowest without parking the read on the held copy (found by reviewer, while killing mutants in moq-dev/moq#9144)

Validation

  • Reproduced first: the new test a_key_order_read_holding_a_copy_wakes_when_the_owed_group_lands (the quest's setup with a real Wake waiter) fails on main at the wake assertion.
  • Still reproduces with fix(net): a JS resumed reader hands out no group outside its window #9115's Rust change applied on top of main: group 0 is inside the local bounds on an open copy that does not skip it, so owes_below still holds and nothing parks. So the bug is not gone with fix(net): a JS resumed reader hands out no group outside its window #9115, and this PR proceeds rather than deleting the quest.
  • With the fix, the test passes, including the same task's next poll handing out group 0 instead of its parked idle answer.
  • Second check: the resume model sweep (resume_model.rs, readers_match_the_logical_track), which re-polls only readers whose waker fired, passes 3000 cases each at seeds 1, 3, 7 and 11.
  • cargo test -p moq-net --features async: all pass. just check passes.

Decisions

Follow-ups

None.

Models

Size: S
Implementer: Claude, claude-opus-5-5, high effort

(Written by Claude Opus 5.5 with high)

Review

Rewritten by quest review after each round.

  • Head: 9776289

  • Base: origin/main at 03bfeea

  • 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: 01a1f42f-5503-7a53-831e-3f510229796d, round 1

  • Score: 9/10, The change fixes arrival wake registration and covers wake-driven delivery with a regression test; source inspection found no actionable defects, though builds and tests were not run as instructed.

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

  • Findings: none

kixelated and others added 2 commits November 19, 2026 06:10
…up lands

A resumed key-order read leaves a copy's cursor on a group outside its window while
the window owes a lower one that may land on that copy. The peek returned the held
group, so nothing parked the read on the copy, and it stalled until another event
woke it. Register the copy's arrivals before holding, and peek again if one landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title A key-order read holding a copy's cursor wakes when the owed group lands fix(moq-net): a key-order read holding a copy wakes when the owed group lands Nov 19, 2026
@kixelated
kixelated marked this pull request as ready for review November 19, 2026 14:22
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

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 13 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: 45f1a6d1-aaa5-410e-94f3-ed8475912c1f
Commits

Reviewing files that changed from the base of the PR and between 03bfeea and 9776289.

Files selected for processing: 2

  • quest/m1/resume-owed-wake.md
  • rs/moq-net/src/model/resume.rs
  • 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

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge pick (maintainer away, granted the coordinator merges it confidently recommends): ✅ /quest-merge, accepting the decisions listed in the PR body. The JS counterpart (whether #9115's #owesBelow hold wakes when the owed group lands) gets checked with this PR's test ported to JS once #9115 lands.

(Written by Claude Opus 5.5 with high)

@kixelated
kixelated enabled auto-merge November 19, 2026 14:23

@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 parks the held read on the held copy's arrivals, the same way the drained arm already does, so the fix is where the wake was lost and not in a caller.

Reviewed changes: I reviewed the change to the owes_below hold in Reader::poll_lowest and its regression test.

  • Held copy registers its arrivals: before break, the hold calls copy.track.poll_arrived(arrivals, waiter). If a group landed since the pass's snapshot, it refreshes arrivals and peeks again. Each re-peek needs next_arrival to grow, so the loop stays bounded.
  • Regression test: a_key_order_read_holding_a_copy_wakes_when_the_owed_group_lands uses a real Wake waiter to check two things: writing group 0 to copy b wakes the parked read, and the next poll hands out group 0.
  • Quest file removed: deletes quest/m1/resume-owed-wake.md, which this PR finishes.

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

@kixelated
kixelated added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit a7e7e61 Nov 19, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m1/resume-owed-wake branch November 19, 2026 14:46
kixelated added a commit that referenced this pull request Nov 19, 2026
Keeps this branch's owes_below(index, ...) with #9178's arrival wake, and
ports #9178's wake test to JS: JS already wakes a held read on every copy's
group change, so it needed no fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated added a commit that referenced this pull request Nov 19, 2026
#9150 made createTrack return undefined for a taken name; the test this
PR ported from #9178 predates that, so the merge queue's type-check failed.

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