Skip to content

fix(moq-net): a relay fetches a group's missing head instead of dropping it - #9280

Draft
kixelated wants to merge 4 commits into
mainfrom
quest/m1/missing-head-asks-upstream
Draft

kixelated wants to merge 4 commits into
mainfrom
quest/m1/missing-head-asks-upstream

Conversation

@kixelated

@kixelated kixelated commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

A relay whose copy holds only the later frames of a group a subscription covers now fetches the earlier frames from upstream and serves the group whole. It names the group in SUBSCRIBE_DROP only when nothing upstream can supply them. Before, the lite publisher dropped any such group (position_group clamped the read to the first held frame and skipped the group), even though the model already knew how to fetch the head.

Changes

  • position_group (rs/moq-net/src/lite/publisher.rs) asks the group whether it can fetch the missing frames (group::Consumer::fetches_from). If it can, it starts the read at the asked frame without clamping (fetching_from). If it can't, it skips the group as before.
  • A group handed out from a front already recovers a frame below its copy's start from the serving route (the Lagged path in resume.rs). A plain track with a Requests handler now does the same through a flight: shed_next boards one for a frame below the copy's offset when no front recovers it. poll_finished judges the end from the copy's start in that case, so the publisher's give-up check doesn't treat the missing head as a failure.
  • If the fetch fails or is refused, the read fails, the Group Stream resets, and the existing settle_failed path names the group in SUBSCRIBE_DROP.
  • Draft (Positions): "A relay that holds only the later frames of a Group a subscription covers fetches the earlier frames from upstream and delivers the Group whole; a publisher that can't obtain them names the Group in a SUBSCRIBE_DROP."
  • @moq/net already behaves this way: a headless group asks a fill for its head (#askHead in track.ts, covered by fill.test.ts and lite/copy_fill.test.ts). It gives the group up with NotFound only when no fill serves it. No JS change was needed.
  • Deletes the quest and moves its link in quest/m2/time-addressing/range-table.md into that quest's Plan.

Choices for review

  • Fallback drop code. When a fetch fails after the stream opened, the drop carries the fetch's error, for example Evicted, instead of the NotFound the early skip uses. A group that can't be fetched at all still gets the early NotFound skip.
  • Stream opens before the head lands. The Group Stream opens before the fetched head arrives and waits on it within the subscriber's budget, as a flight already does for a shed frame. The alternative, holding the group until the head lands, would need a second wait state in TrackRun.
  • Scope beyond relays. The fix also covers a local track whose app serves history through Requests, not only relays. The rule is the same either way: a cache only makes things faster.

Impact

Public API: none (crate-private group::Consumer::fetches_from/fetching_from, track::flies). Wire: none. The draft's Positions rule changes for relays. This is a behavior change, so the title has no !.

Validation

  • Reproduced first. a_missing_head_is_fetched (a plain track with a Requests handler) and a_relay_fetches_a_missing_head_from_its_route (an origin front whose route copy holds a headless group) both failed before the fix: the group was dropped or no fetch was ever asked. With the fix, both pass. They check that the Group Stream carries Frame Start 0 and the head before the tail, with no drop. The refused variant checks that SUBSCRIBE_DROP names the group.
  • cargo test -p moq-net --all-features passes: 3485 lib tests plus the integration suites, including the existing a_missing_head_is_dropped_early and held_first_group_starts_past_a_skipped_head, which still drop when no handler serves.
  • just check passes.
  • Not run: an end-to-end relay binary run. A lite-only deployment rarely produces a headless copy, because a route switch lends the held head to the new copy. The realistic sources are moq-transport upstreams that join mid-group, so the front test drives the relay's real origin/front path in-process instead.

Caused by

No single PR. The drop was the draft's documented rule, which this quest (found by the 2026-11-20 subscription-rules audit) changes.

Follow-ups

None.

Models

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

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: fc28267, named in full once no reviewer reports a finding

  • Base: origin/main at 3728b96

  • Risk: medium, The missing-head fetch and group-read changes could disrupt frame delivery or completion for Rust relay subscribers, but preserve public APIs and wire compatibility, and a revert fully undoes them.

  • Classified: medium by Codex, gpt-6.1-sol, low effort, session 01a1fc03-d832-7ba0-b12a-58c5f8b5f2cd

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

  • Session: 01a1fc03-fb90-7442-bcea-8df3e3c86829, round 1

  • Score: 6/10, The fix needs rework because JS relays still drop recoverable groups that the change should cover.

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

  • Findings, open until the next round settles them:

    • Medium, rs/moq-net/src/lite/publisher.rs:4852: Recover missing heads in the existing JS publisher too

kixelated and others added 4 commits November 20, 2026 17:33
…ing it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ule asks upstream

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title A relay fetches a group's missing head instead of dropping it fix(moq-net): a relay fetches a group's missing head instead of dropping it Nov 21, 2026

This branch has not been deployed

No deployments
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