Skip to content

fix(net): a stale run below a reader's floor never panics its drop cursor - #9318

Merged
kixelated merged 2 commits into
mainfrom
quest/m0/nightly/resume-model-cursor-panic
Nov 21, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m0/nightly/resume-model-cursor-panic

Conversation

@kixelated

@kixelated kixelated commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The Nightly resume model sweep panicked in DropCursor::next with range start is greater than range end in BTreeMap, on about one seed in four at 4096 cases.

Root cause: in DropCursor::grown (rs/moq-net/src/model/track.rs), when the reader's coverage widens (for example, its ranges drop from bounded to everything), the cursor adds each drop that a wider coverage newly settles. It asked state.drops.overlapping(&settling), where the settling run can reach below the cursor's span (its floor). A drop entirely below the floor, such as a give-up at 1..2 with a floor of 9, produced span.start..run.end = 9..2. The cache lookup state.lookup.range(9..2) then panicked.

Fix: only drops reaching into both the span and the settling run are candidates, and each run is clipped to the span. That is exactly the set a full rescan judges, which already clipped every changed run to the span. The reversed run is no longer produced, rather than being clamped at the lookup.

Quest: deletes quest/m0/nightly/resume-model-cursor-panic.md.

Validation

  • New unit test a_stale_run_below_the_floor_settles_nothing in track.rs: a reader floored at 9, whose open range starts at 12, widens to every group while a received stale run sits at 1..2. It panics on main and passes with the fix.
  • The quest's minimal model case is added to regressions() in resume_model.rs. It panics on main and passes with the fix.
  • readers_match_the_logical_track at MOQ_RESUME_CASES=4096, seeds 1 to 21: no drop cursor panic on any seed. Seeds 2, 3, 9, 11, 14 and 16 panicked before and pass now.
  • Seeds 8 and 19 still fail with model divergences about how a group ends when its route closes, not panics. Seed 19 fails the same way on main, with this PR's track.rs reverted. On main, seed 8 panicked before reaching its divergence. Both are planned in the follow-up below.
  • cargo test -p moq-net --features async --lib model:: passes (1603 tests), and so does just check.

Caused by

  • moq-dev/moq#9142 - folded in settling drops overlapping the settling run without bounding them to the cursor's span (found by check: Nightly resume model sweep)

Follow-ups

  • A group a closing route cuts short ends as the resume model expects - the seed 8 and 19 divergences, with their minimal cases. Open decision, recorded in its Plan: for each case, whether the implementation or the model is wrong. Recommendation: start with seed 8, where the only remaining route gave up the group, so the model's closed_at check is likely too strict.

Overlap

This changes only DropCursor::grown and a test in track.rs, plus one case appended to regressions() in resume_model.rs. It does not touch resume.rs. The live-join work (Start::Live(min_age)) and resume-ordered-lower-group may also append to regressions(), which would be a trivial textual conflict.

Impact

Public API: none. Wire: none.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, medium effort (arm A)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: a82a453

  • Base: origin/main at 4709906

  • Risk: medium, The drop-cursor fix changes which stale drops Rust track readers receive and could misreport or omit drops for consumers, but preserves the public API and wire format and is fully undone by a revert.

  • Classified: medium by Codex, gpt-6.1-sol, low effort, session 01a2006c-86e5-72b2-91ad-6426056d6f0c

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

  • Session: 01a2006c-9de7-77e0-b0f7-5553bbcfba7b, round 1

  • Score: 9/10, Source review found no actionable defects and focused regression coverage, but 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 21, 2026 14:48
…rop cursor

A drop cursor folding in what a wider coverage newly settles took every drop
overlapping the settling run, so one wholly below the span came out read
backwards from the floor, and the cache lookup over it panicked. Only drops
reaching into both the span and the settling run are candidates now, clipped
to the span.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title The Rust resume model sweep never panics in a drop cursor fix(net): a stale run below a reader's floor never panics its drop cursor Nov 21, 2026
@kixelated
kixelated marked this pull request as ready for review November 21, 2026 23:25
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

DropCursor::grown now clips newly settled stale runs to the scan span and the run’s end. A test covers a stale run below the reader’s floor. The resume model adds a route and reader regression case. The Nightly notes add two route-close failures and remove an earlier cursor-panic note.

Merge Risk: Minimal · up to a82a4

This fixes a panic in the drop cursor when a stale drop lies below a reader's floor, and adds regression coverage. No public API or wire changes are involved, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: a stale run below a reader's floor no longer panics the drop cursor. The changeset clips DropCursor::grown candidate runs to the span, which matches the title's fix(net) sc…
Description check Passed The description is detailed and on-topic. It explains the panic in DropCursor::next, the root cause in DropCursor::grown, the clipping fix, the new unit test and regressions() case, the deleted quest …
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 change: a stale run below a reader's floor no longer panics the drop cursor. The changeset clips DropCursor::grown candidate runs to the span, which matches the title's fix(net) scope. The title is specific and related to the main change, so it passes.

Full details: Description check

Explanation

The description is detailed and on-topic. It explains the panic in DropCursor::next, the root cause in DropCursor::grown, the clipping fix, the new unit test and regressions() case, the deleted quest file, and the validation results. It matches the changeset, so it passes.

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: 5ca1b9e1-3468-4ec3-be7a-4281ac86e5f9
Commits

Reviewing files that changed from the base of the PR and between 4709906 and a82a453.

Files selected for processing: 4

  • quest/m0/nightly/resume-model-cursor-panic.md
  • quest/m0/nightly/resume-model-route-close.md
  • rs/moq-net/src/model/resume_model.rs
  • rs/moq-net/src/model/track.rs
Files with no reviewable changes: 1

  • quest/m0/nightly/resume-model-cursor-panic.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 new issues found.

Approach: sound. It fixes the cause where the reversed run is produced in DropCursor::grown, rather than clamping it at the state.lookup.range call that panicked.

Reviewed changes I reviewed the full diff: the grown fix, its unit test, the model regression, and the quest file changes. I also ran both new tests locally, and they pass.

  • DropCursor::grown bounds settling drops to the span: It intersects the settling run with the span, skips an empty result (needed, since an inverted range into the drop map would panic too), and clips each candidate's end to span.end. For every valid run, the set is the same as before: a run whose clipped start lies in settling must overlap settling ∩ span. So the only output that changes is the reversed or out‑of‑span runs that used to break the lookup.
  • Unit test a_stale_run_below_the_floor_settles_nothing: A reader floored at 9 widens to every group while a received stale run sits at 1..2. It covers the exact failure shape.
  • regressions() case: Adds the quest's minimal model case.
  • Quests: Deletes the fixed quest and adds resume-model-route-close.md for the seed 8 and 19 divergences, which are separate from this fix.

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

@kixelated

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (2026-11-21):

  • Merge: /quest-merge.
  • Follow-up quest/m0/nightly/resume-model-route-close.md: Keep. It already exists on this branch, so nothing needs to change.

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Answers the maintainer decision: landing as decided.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 109f4cb Nov 21, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m0/nightly/resume-model-cursor-panic branch November 21, 2026 23:57
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