Skip to content

fix(net): a held or kept route stream resumes with what it missed - #8860

Merged
kixelated merged 2 commits into
mainfrom
fix/route-held-stream-resume
Nov 16, 2026
Merged

kixelated merged 2 commits into
mainfrom
fix/route-held-stream-resume

Conversation

@kixelated

@kixelated kixelated commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

OPEN

Problem

Nightly's Tests (test route-sweep) fails on main (run): route::tests::scope::sweep_scoped_meshes_show_what_the_rule_says (scenario 5413 of MOQ_ROUTE_SCENARIOS=20000, step 82) panics on the router's own check that an incremental batch equals the whole presentation:

incremental presentation of 7 Path("a") to 0
  left:  {a: 9} a/x, a/y
  right: {a: 9} a/y

A route stream that is held (or kept) is sent no batches, so what it was last sent falls behind its view: here a/x was withdrawn while relay 1's stream (7, "a") to relay 0 was held. Relay 0 then edited its interest from "" to a, which moved the held stream onto the live "" route. No route changed, so the update had no dirty region, and the incremental batch, built from dirty claims alone, never withdrew a/x. Relay 0 would keep showing a withdrawn claim.

Approach

A stream that is sent nothing loses its presented-from prefix (SentOffer::from = None, the mechanism a rekeyed stream already uses), so its next batch diffs against everything it holds. Sent::hold and a Want::Keep visit both mark it (Sent::behind).

That makes the per-region patch in present ("A held stream may have missed withdrawals ... include its own previous claims") redundant, so it goes: every route and lite test, including all route sweeps at 20,000 scenarios, passes without it once kept streams are marked too. (Without the Keep marking, dropping the patch fails sweep_handoff, so the patch was covering the same root cause for kept streams.)

Impact

  • No public API or wire change. A stream resumed after a hold or keep is diffed whole once, the cost a fresh stream pays.

Validation

  • Reproduced locally with Nightly's command: MOQ_ROUTE_SCENARIOS=20000 on the scoped sweep fails at the same assertion and claims; traced it to scenario 5413 step 82 (relay 1 handling relay 0's Edit { remove: [""], add: ["a"] } with the held stream).
  • With the fix: the scoped sweep passes at 20,000 scenarios; route:: and lite:: tests (375) pass at MOQ_ROUTE_SCENARIOS=20000 in release with debug assertions; just test route-sweep with the failing run's MOQ_ROUTE_SEED=1225026421 passes every stage (mesh sweep, the four handoff and scoped sweeps, the 7 delivery-order searches, the long cache sweep).
  • Second check: the router's #[cfg(test)] assertion in present compares every incremental batch to the full presentation on every update of every sweep, so the sweeps check the fix differentially.
  • just check passes.
  • After merging main (through moq-dev/moq#8881, moq-dev/moq#8890, moq-dev/moq#8827): just test route-sweep with MOQ_ROUTE_SEED=1225026421 passes every stage again, route:: and lite:: tests (383) pass at MOQ_ROUTE_SCENARIOS=20000 in release with debug assertions, and just check passes. The TLA+ route model (verify-route) was not rerun: neither this PR nor the merge changes the route rule, only how an incremental batch is diffed.

Decisions

  • Merge conflict in present: main changed the incremental batch to carry owned Option<A> values, and this PR drops the held-stream region patch. ✅ keep the patch removed and take main's owned values (rejected: keeping the region patch alongside Sent::behind, which the sweeps show redundant). Recorded unattended; a review can undo it.
  • moq-dev/moq#8835 (one routing stream per side) does not touch Sent::hold, the Want::Keep visit, or present's incremental diff, so this PR needs no coordination with it.

Alternatives

  • Mark the stream dirty only when an edit switches its source route. Narrower, but leaves a kept live stream resumed the same way stale, and keeps the region patch.
  • Pin scenario 5413 as a plain test. Building it by hand needs a narrow route held while a covering one is live through the peer, then that peer narrowing; two attempts at a 4-node mesh did not reach it, and the nightly sweep already replays it.

Caused by

  • moq-dev/moq#8728 - an interest edit keeps the neighbour's streams through rekey (before, peer_interest dropped them all), so a held stream can now resume on another route with no route change, which the region patch did not cover (found by check: Nightly route sweep)

Models

Size: S
Implementer: Claude Code, claude-opus-5-5, unknown effort
Implementer: Claude Code, claude-opus-5-5, unknown effort (iterate, S)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 376e616

  • Base: origin/main at 1ca6136

  • 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: 01a1e3e7-ab8b-7ee3-b8a9-8dcb2f412d48, round 1

  • Score: 9/10, Source review found no actionable regressions in reconciling held or kept streams when batching resumes; tests were not run as instructed.

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

  • Findings: none

A stream that is held or kept is sent no batches, so the claims it was last
sent can fall behind its view. An edit that moves such a stream onto another
route resumes it with no dirty region, and the incremental batch missed
withdrawals made meanwhile. Holding or keeping a stream now clears its
presented-from prefix, so its next batch diffs against all it holds, and the
per-region patch for held streams goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 15, 2026 17:43
@coderabbitai

coderabbitai Bot commented Nov 15, 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 15 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: 07b0f325-3f26-473f-968b-b7a02d8dff49
Commits

Reviewing files that changed from the base of the PR and between f3ed57e and 376e616.

Files selected for processing: 1

  • rs/moq-net/src/route/path.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

pullfrog[bot]
pullfrog Bot previously approved these changes Nov 15, 2026

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

Reviewed changes

Reviewed the single commit that fixes the nightly route-sweep failure in rs/moq-net/src/route/path.rs: a route stream that was sent nothing is now diffed whole when it resumes.

  • Sent::behind: a new helper clears SentOffer::from. This is the same signal Carried::view already uses after a rekey, and it makes present take the fresh full-diff path on the next batch.
  • Sent::hold marks behind: every hold now clears from. That covers advertise's Want::Hold and both hold sites in the dead-hop report path.
  • Want::Keep in advertise: this arm used to do nothing. It now marks the sent entry behind, so a kept stream that resumes on another route can't keep a claim that was withdrawn while it was kept.
  • Region patch removed from present: the code that merged the old sent view's claims under each dirty region is gone. Held and kept streams now take the full-diff path, so the patch has nothing left to cover. meet, below and dirty.regions are still used by expand_dirty, stream and run.

I traced the change against stream, expand_dirty and the dead-hop Want::Keep path that doesn't call hold(). That path sends no batches, and the next advertise visit marks the stream behind, so I found no case where a stream misses batches and still keeps from. The #[cfg(test)] assertion at the end of present compares every incremental batch with the full presentation, so the 20,000-scenario sweeps the author ran check the fix differentially. from is local to the sender and isn't part of the TLA Mirrored state, so the models don't need to change.

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

…-resume

# Conflicts:
#	rs/moq-net/src/route/path.rs

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed commit: c69c2127fe74b4cafebda1d3a37ee3201f625e30

No actionable defect found in the changed code. I traced Sent::hold, Want::Keep, and present: clearing SentOffer::from forces a full presentation diff after either path skips batches, including a resume with no dirty region. Updating the marker after a sent batch restores incremental operation. That addresses missed withdrawals without retaining the old region-specific workaround.

Limits: static review of the GitHub diff and relevant surrounding source only. I did not build, run tests, replay the model sweeps, or run performance/TSan checks. This is a COMMENT review, not an approval.

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

Reviewed changes

The only change since the last Pullfrog review is the merge from main. I checked how the conflict in present was resolved.

  • Merge conflict in present: the incremental branch now uses main's owned Option<A> values (view.items.get(claim).cloned()). The held-stream region patch stays removed, so Sent::behind is still the only path that resyncs a held or kept stream. meet and below are still called by the scope, stream and expand_dirty paths, so the merge leaves no dead helpers.

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

@kixelated
kixelated added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 835a769 Nov 16, 2026
8 checks passed
@kixelated
kixelated deleted the fix/route-held-stream-resume branch November 16, 2026 11:06
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