Skip to content

fix(net): preserve splice boundary and warm-head state - #4484

Merged
kixelated merged 6 commits into
mainfrom
quest/m1/splice-edges
Sep 30, 2026
Merged

kixelated merged 6 commits into
mainfrom
quest/m1/splice-edges

Conversation

@kixelated

@kixelated kixelated commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Spliced tracks could skip valid groups behind an unstamped successor, retain stale boundary groups from a pruned segment, or abort a warm group's cached prefix during another route takeover.

Approach

Preserve the identity of an unstamped successor, find later segments even when a reader's original segment has been pruned, and retain the warm head until a new head replaces it. A handed-out group judged against an unstamped successor registers for that successor's first frame, so a read parked at its tail is re-judged when the successor stamps. The successor is resolved afresh on every judgment rather than cached, so one aborted or evicted before its first frame hands the bound to the next servable group, in the same or a later segment. Add regressions for each case, including replay after another park, update the failover documentation, and complete the quest.

Impact

  • No public API or wire-format changes.
  • Native readers retain unbounded reach behind an unstamped successor until its first frame, which wakes a parked read to re-judge it; apply the existing age budget across pruned boundaries; and retain cached frames through repeated takeovers.

Alternatives

Skipping unstamped groups guesses a timestamp bound that has not been established. Keeping every retired segment would avoid the lookup bug by abandoning the existing bounded retention policy.

Validation

All six regressions fail without their fixes and pass with them. just check passes its lints and all 4,508 Rust tests (the trailing feature-combination cargo check ran out of local disk); just test interop passes; quest check passes.

Follow-ups

No new quests. The separately tracked resume-latest work (#4491) edits the same files; the quest README and quest/m1/resume-latest.md will conflict with whichever lands second.

(Written by GPT-6 Astra, updated by Claude Opus 5.5)

🤖 Generated with Claude Code

@kixelated
kixelated marked this pull request as ready for review September 29, 2026 13:20
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 9778984e-ee90-4153-a43e-5d8e4d25a8a4

📥 Commits

Reviewing files that changed from the base of the PR and between 2e547af and b9398f7.

📒 Files selected for processing (7)
  • doc/concept/moq-lite.md
  • quest/m1/README.md
  • quest/m1/resume-latest.md
  • quest/m1/splice-edges.md
  • rs/moq-net/src/model/origin.rs
  • rs/moq-net/src/model/resume.rs
  • rs/moq-net/src/model/track.rs

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

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T17:48:06.443635Z 4206dad New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06bcadd06c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-net/src/model/track.rs Outdated
sequence: slot.group.sequence,
stamp: slot.stamp,
timestamp: slot.group.timestamp()?,
timestamp: slot.group.timestamp(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Register for the unstamped successor's first frame

When an open group from a preceding segment is handed out while this successor is unstamped, Successor::start() returns None, but GroupExpiry registers its waiter only on the anchor and the preceding track's groups. If the reader then parks at the open group's tail, writing the successor's first frame wakes only the successor group channel, so the age verdict is not recomputed and the reader can remain stuck until an unrelated splice or track mutation. Preserve the identity, but also poll the successor group's timestamp with the expiry waiter.

AGENTS.md reference: rs/moq-net/AGENTS.md:L14-L15

Useful? React with 👍 / 👎.

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.

Confirmed and fixed in 9636204. With the successor now kept while unstamped, a read parked at the open group's tail registered only on the anchor, its own track, and that track's unstamped groups, so the successor's first frame woke nothing (unstamped_successor_first_frame_wakes_a_parked_read reproduces the lost wakeup). Successor::start became poll_start(waiter), which registers on the successor group's first timestamp while it is unstamped, still outside the other track's lock. Both callers (GroupExpiry::is_expired and the cursor's poll_stale) use it.

(Written by Claude Opus 5.5)

kixelated and others added 2 commits September 29, 2026 10:07
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	quest/m1/README.md
#	quest/m1/relay-late-joiner-history.md

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4206dadd09

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-net/src/model/track.rs Outdated
/// group is gone or while it is unstamped. An unstamped start registers `waiter` for
/// the first frame, which bounds a reach without touching either track. Takes that
/// track's lock, so never call it under another's.
fn poll_start(&self, waiter: &kio::Waiter) -> Option<Timestamp> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Re-resolve an aborted unstamped successor

When the first later segment contains an unstamped group and that group is aborted or evicted before its first frame, this waiter wakes once, but poll_start returns None and the cached anchor is never re-resolved to the next servable segment. A reader parked at the preceding group's tail therefore keeps its reach unbounded and parks again even when a later stamped group proves it stale; unless the outer subscriber is independently polled, no subsequent event needs to wake it. Re-resolve or watch the successor track when the stored unstamped identity disappears.

AGENTS.md reference: rs/moq-net/AGENTS.md:L14-L15

Useful? React with 👍 / 👎.

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.

Confirmed and fixed in b9398f7. Reproduced first: aborted_unstamped_successor_re_resolves_a_parked_read (same segment, then a later group arriving after the abort) and aborted_unstamped_successor_re_resolves_across_segments (the next segment's only group aborted, the segment after it continuing) both failed on 4206dad: the parked read woke once and stayed pending.

Fix at the source: Anchor::successor no longer caches a resolved group identity. It now holds the query (the splice's state, the segment it follows, the boundary, and the cap), and Successor::poll_start re-resolves it on every judgment across the later segments, registering the waiter on the splice state, each consulted segment track, and an unstamped group's first frame. An aborted or evicted successor therefore hands the bound to whichever group serves there next, and a group arriving later wakes the parked read. This deletes the stamp revalidation (ServedStart, TrackState::served_start, track::Consumer::served_start) and the plain-track an_evicted_successor_convicts_nothing test, whose cached-identity premise no longer exists.

(Written by Claude Opus 5.5)

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

Direction: worthwhile targeted repair. Preserving unstamped identity and warm-head ownership is preferable to guessing timestamps or retaining every retired segment.

P2: independently confirmed the remaining stale-successor case in rs/moq-net/src/model/track.rs:3375–3380. If the unstamped successor aborts before its first frame, poll_start returns None, but GroupExpiry keeps the same cached anchor and cannot locate the next stamped successor. A reader parked in the preceding segment can therefore remain parked unless its outer subscriber is polled separately. Re-resolve when the stored successor identity disappears; retain the new first-frame waiter. Existing thread: #4484 (comment)

Verification: static diff and targeted source inspection. I did not run the repository test/build suites or reproduce runtime scenarios in this review. This is a COMMENT review, not a merge approval.

An unstamped successor aborted or evicted before its first frame left the
cached anchor naming a dead group, so a read parked at the previous
group's tail stayed unbounded. The anchor now holds the successor query
and re-resolves it across the later segments each time, registering on
the splice state, the consulted tracks, and an unstamped group's first
frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge summary

Preserves splice boundary and warm-head state across native route failover (quest m1/splice-edges, completed and removed here).

  • An unstamped successor keeps its identity, so a splice never skips it for a later segment's stamped start.
  • Successor lookup still finds later segments after the reader's own segment has been pruned.
  • The warm head survives a second takeover before a park, so the cached prefix stays readable.
  • Anchor::successor is now re-resolved on every judgment instead of being cached (b9398f7, answering Codex P1 r4136574928). A successor aborted or evicted before its first frame passes the bound to the next servable group, in the same segment or a later one. A read parked at the preceding group's tail is woken to re-judge. This removes the cached-identity revalidation (ServedStart, TrackState::served_start, track::Consumer::served_start) along with its plain-track test.

Decisions

  • Chose lazy re-resolution over re-resolving only after the cached identity disappears: it is a single code path, and it also picks up a lower group that arrives out of order.
  • The Codex follow-up review hit its usage limit. A fresh-context Claude review of b9398f7 found no lock-order, lost-wakeup, or wrongful-conviction issues.

Impact: no public API or wire changes. just check passes locally and CI is green on b9398f7.

Follow-ups (optional)

  • A resume-level regression test for eviction, as opposed to abort, of the successor.
  • A stamped group aborted in place, without eviction, wakes no one. This affects the own-track reach as well as the successor, and only matters under a timestamp rewind.

(Written by Claude Opus 5.5)

@kixelated
kixelated merged commit a8c50f3 into main Sep 30, 2026
7 checks passed
@kixelated
kixelated deleted the quest/m1/splice-edges branch September 30, 2026 02:36
@moq-bot moq-bot Bot mentioned this pull request Sep 30, 2026
@moq-bot moq-bot Bot mentioned this pull request Sep 30, 2026
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