Repository navigation
Conversation
Quest-Claim: 1d368dd6047d5d37
…ute still owes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s, in Rust and JS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t mutant Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te landings An ordered front read passed a group the serving route still owed when a replaced route dropped it (as a relay losing it does), when the fill's bounded read was still asking for its head, or when it landed on another thread between the fill's read parking and the check. Only a skip now settles a group across routes; a fill still fetching a head owes it, and a fill whose track saw a group arrive since its read parked is read again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A group landing between the arrival check and the owed check read as neither. Checking arrivals after closes the window: a landing counts as arrived in the same step it stops being owed. A found landing wakes the read to walk again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claims and finishes quest/m1/ordered-read-lost-group.md.
Waiting
quest reviewstopped for your pick. The finding is atrs/moq-net/src/model/resume.rs:3033. Whenfill_owes_belowsees a group land on a fill during the hand-out, it wakes the read to walk again. That retry can run before the producer notifies the fill's cursor, so the cursor's idle gate (Subscriber::parked,track.rs:13237) returns its cachedPendingwithout peeking. The owed check then counts the group as arrived, and the read hands out the group above it and passes the landed group for good. The window is a thread race between the producer releasing the track lock and waking its waiters. The reviewer recommends disarming the fill cursor's idle gate when a landing is detected, so the retry peeks the copy. I agree: the finding matches the code, and the fix is small and local.mainProblem
An ordered read of a front's logical track passed a group below the serving copy's resume point that a replaced copy held and then lost from its cache. The walk asks the serving route for it with a backfill, but while that backfill had yet to answer, nothing held an ordered candidate above it: the next group went out and the lost one was passed for good. A plain ordered cursor on the route waits for it. Both Rust and JS behaved this way, whether the copy lost the group before the switch or after the switch left it that group to drain.
Approach
Before an ordered hand-out, the reader asks each fill (a backfill copy of the serving route) whether its own ordered read still waits on a group the reader lacks below the candidate. If one does, the read parks.
track::Subscriber::owesreports whether an ordered read of that subscription still waits on a group in a range. That is true for a group a fill it asked has yet to answer (Misses::wants), for one whose head its bounded window is still fetching (Heads::fetching), and for one its received copy's live feed owes within the arrival grace (TrackState::owed). A front's logical track asks its own copies.Reader::fill_owes_belowasks this of every fill whose read parked this pass. A fill still unanswered owes what it was asked, and a fill whose track saw a group arrive since its read parked (on another thread) is read again. A key the reader or any kept copy records skipped (Reader::skipped_in) is not waited for; a drop is only the dropping route's, so each fill judges its own. The fill's read, the grace fold, and the fill's budget wake the read.hooks.oweswraps the subscriber's own#waitOwed, which covers the same two cases and arms the read's wakeups.Reader.#fillOwesBelowmirrors the Rust check. Copies now carryfills, as in Rust, and skips come from the reader's existingskippedIn. JS needs no head or race case: a head is asked through the same fills#waitOwedalready consults, and reads are single-threaded.Impact
Decisions
a_held_back_group_goes_out_once_a_later_copy_places_the_windowandan_ordered_read_passes_a_replayed_group_an_arrival_read_handed_out.an ordered resumed reader keeps an older copy's owed hole until dropnow also has the serving route drop the group before the read passes it. Rejected: letting a final drop on any copy settle the group, which loses a group the serving route still delivers.Sub::Pending) holds the read, since its route has said nothing yet. Rejected: passing it, which loses the group whenever the serving route is slow to answer.Caused by
No single PR. The quest records the in-flight case behaving the same on
mainat 065a4c1, before moq-dev/moq#9750, and the hold never existed.Validation
an_ordered_read_waits_for_a_lost_group_the_serving_route_answers_late(lost before or after the switch; fill, fill drop, or feed answer; plain or nested front)an_ordered_read_waits_for_a_lost_group_while_the_serving_route_is_unansweredan_ordered_read_passes_a_group_a_replaced_copy_skipped_but_not_one_it_droppedan_ordered_bounded_read_waits_for_a_lost_groups_head(fails without theHeads::fetchingcheck)an ordered resumed reader keeps an older copy's owed hole until drop, extended to hold until the serving route drops the group tooan ordered read waits for a lost group its serving route answers late(6 cases)just cipasses on the review-round head too.poll_arrivedinfill_owes_below, checked after the owed check so a landing cannot fall between them) has no deterministic test, because the landing must fall inside one poll./verify-resume:ResumeReader.tladefault,ThreeRoutes.cfg, andEvict.cfgall pass (the default explores 20.1M distinct states). The model leaves ordered reads out, so this only confirms the arrival path is unchanged. Run on the first head; the review fixes touch only the ordered hold, which the model leaves out.cargo mutants --in-diffon the newowes/fill_owes_belowcode: 9 of 10 caught. The one missed (<to<=on a run starting at the candidate's key) is equivalent, since that run clips to empty. It joins the existingexhausted|lackingexclusion in.cargo/mutants.toml.Alternatives
See Decisions.
Follow-ups
None.
Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown (arm A)
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Head: ebdf9bd, named in full once no reviewer reports a finding
Base: origin/main at e91efb9
Risk: medium,
If the new ordered-read wait is wrong, a relay or JS consumer that reads ordered from a resumed front may stall on a lost group or hand out a group late, which affects subscribers of the shipped rs/moq-net and js/net packages; it changes no public API, wire format, or stored data, the internal additions are crate-private or unexported, and a revert fully undoes it, so this is a fix that the next cut publishes as a patch.Classified: medium by Claude Code, claude-haiku-5-5, low effort, session
001b5963-f8c3-48af-8798-d20d84ac0401Risk file: bb7b1c0de60b
Reviewer: Codex, gpt-6.2-sol, high effort
Session:
01a221e1-ff08-7ef3-b520-17f527e65a61, round 3Score: 8/10,
The reordered checks detect the late arrival, but an ordered reader can still skip the group if it polls again before the backfill cursor is notified.Rounds: 3; first round 3 (high 1, medium 2); findings 3 (high 1, medium 2): fixed 2, refuted 0, open 1
Findings, open until the next round settles them:
rs/moq-net/src/model/resume.rs:3033:Force the backfill cursor to re-peek after detecting a landingThe last round's findings, at 42e6a50:
rs/moq-net/src/model/resume.rs:3011:Check for new arrivals and owed groups under the same lock;The wake at `rs/moq-net/src/model/resume.rs:3033` can trigger a retry before the producer notifies the backfill cursor at `rs/kio/src/channel.rs:355`, so the cursor can still return its cached `Pending` at `rs/moq-net/src/model/track.rs:13237`.