Skip to content

fix(moq-net): a lite-07 relay waits for a claim's route before answering a request for it - #9052

Merged
kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-3/interop-finish-unroutable
Nov 18, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-3/interop-finish-unroutable

Conversation

@kixelated

@kixelated kixelated commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Claims quest/m0/test-flakes-3/interop-finish-unroutable.md and finishes it.

Problem

On lite-07 a relay could answer UNROUTABLE to a reader that subscribed the moment it heard of a broadcast, as the interop finish lane's readers do for <broadcast>.health. The refused reader never asks again.

Cause: the relay's route node shows a peer's claim to every session it reaches in the same flush that queues the claim's route (Output::Serve) for the session serving it. Each session drains its own outbox on its own task. Under load the downstream session can announce the claim to the reader, and the reader's SUBSCRIBE can arrive, before the upstream session's task runs Routed::serve → origin.forward. The origin then has no route for the path, and Consumer::lookup refuses (best_route → None). Traced in a failing run: lookup: no best route was logged before the upstream session's routed: announce for the same path. The "source closed" the quest's log showed after the refusals is the ended first broadcast's source on the same upstream task. It runs late for the same reason, and does not cause anything.

This is not a flaw in the route rule or the wire. The rule says the node shows a claim and a request follows it. The relay broke the local order by answering from the origin before the node's own output had landed there.

Approach

lite::publisher::Shared::poll_node_filter already waited on route::Node::poll_forward for a request naming a node, until the session that serves the claim confirms it (Stream::serving, which runs right after origin.forward). A request naming only an instance now waits on that same confirmation (poll_forward(tag, None, claim)) before it resolves. It still resolves through the whole origin, as before. A claim the node does not know (local, or not shown) returns at once, so only a request for a claim the node is still landing waits.

Impact

  • Public API: none. Wire: none.
  • Behavior: a lite-07 relay holds a request for a claim it has shown until the claim's route is in its origin, instead of refusing it.

Validation

  • New deterministic test lite::subscriber::routed::tests::a_request_for_a_claim_shown_waits_for_its_route. A real lite-07 reader session reads from a relay origin whose upstream claim has reached the node, but whose Serve output the test applies by hand only after the reader has subscribed. It fails without the fix (the request never reaches the claim) and passes with it.
  • Reproduced the lane's failure on a multi-threaded tokio runtime with a scratch stress test: publisher → relay → 8 readers over mock lite-07 sessions, ending one broadcast and announcing .health on the same session. On main it failed after 72, 148, 374, 544, 658 and 827 rounds, with the relay logging subscribed error ... err=unroutable and the reader hanging, as in the lane. With the fix: 6 × 3000 rounds, no failure. The stress test was not kept: moq-net tests don't use tokio, and the deterministic test covers the ordering.
  • just test interop --all --finish: every row passed except python -> *. Every python reader passed (health=ok), the relay refused nothing, and the python publisher hung before printing finish acknowledged. A rerun of the python row passed 9/9. This is a different, publisher-side flake, filed below.
  • just check passes.
  • Not model-checked with /verify-route: the route rule and what the node shows are unchanged. The fix orders a request after the node's own output lands in the origin, which RouteHandoff.tla does not model.

Caused by

  • moq-dev/moq#8987 - put lite-07's downstream announcements on the route node, ahead of the upstream session landing the route in the origin, while node-less requests still resolved against the origin alone (found by check: the interop finish lane while validating that PR). The same stress test on its parent, 0c14c87c49, ran 6 × 3000 rounds with no failure. Before it, a claim reached a reader only from the origin's table, so it could not be shown before it could be served.

Decisions

  • Fixed on the request side, not by holding the announcement until the serving session confirms. Holding announcements would change what the node shows and when, which the route rule (and its TLA+ model) owns. Waiting on the request reuses the confirmation the node-named path already waits on.
  • The wait applies only to requests that name an instance, which is every lite-07 request. Earlier versions announce from the origin's table and cannot hit this.

Alternatives

  • Land the route in the origin inside the node's flush. Rejected: Routed::serve needs the session's permit, hop chain and loop check, so it belongs on the session.
  • Retry on UNROUTABLE in the reader. Rejected by the quest: a viewer would see the same refusal.

Follow-ups

Models

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

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: d309bc1

  • Base: origin/main at 0a4a977

  • 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, high effort

  • Session: 01a1ecf3-9805-7911-a55c-316d6e126c6d, round 1

  • Score: 9/10, No actionable defects found: the fix reuses existing route-confirmation logic and adds a simulated regression test, 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 17, 2026 17:51
…ing a request for it

The route node shows a peer's claim to every session it reaches in the same
flush that queues the claim's route for the session serving it, and each
session applies its outbox on its own task. A reader that asked the moment it
heard could reach the origin before the serving session landed the route and
be refused Unroutable, with nothing to make it ask again.

A request naming an instance now waits on the node's confirmation, as one
naming a node already did, without narrowing the origin it resolves through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title A request right after its announcement is not refused unroutable fix(moq-net): a lite-07 relay waits for a claim's route before answering a request for it Nov 18, 2026
@kixelated
kixelated marked this pull request as ready for review November 18, 2026 04:41
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The lite publisher now waits for a claimed route before returning an origin when a request does not name a node. An asynchronous integration test checks this behavior. The change also removes an interop unroutable-subscription note and adds a note about a hanging Python finish publisher.

Merge Risk: Minimal · up to d309b

This change fixes a race where a relay could answer a request for a freshly announced claim with UNROUTABLE before its route arrived. It now waits for route confirmation first, and a new test covers that ordering. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: a lite-07 relay in moq-net now waits for a claim's route before answering a request for that claim. The raw summary and objectives show the publisher.rs wait logic and the …
Description check Passed The description explains the problem (lite-07 relay answering UNROUTABLE to a reader that subscribed right after a broadcast announcement), the cause (route node claim shown before the upstream sessio…
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 lite-07 relay in moq-net now waits for a claim's route before answering a request for that claim. The raw summary and objectives show the publisher.rs wait logic and the new routed test match this. The title is specific and related to the main change. It is a fix commit with a conventional prefix and is concise at 89 characters.

Full details: Description check

Explanation

The description explains the problem (lite-07 relay answering UNROUTABLE to a reader that subscribed right after a broadcast announcement), the cause (route node claim shown before the upstream session lands the route in the origin), the approach (request-side wait via poll_forward on instance-only requests), validation, and the related follow-up. This matches the changes in publisher.rs and the routed tests file, so it is related to the changeset.

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: 15581c90-ed3f-438a-955d-53a7fc1e9d5f
Commits

Reviewing files that changed from the base of the PR and between 61f8956 and d309bc1.

Files selected for processing: 4

  • quest/m0/test-flakes-3/interop-finish-unroutable.md
  • quest/m0/test-flakes-3/py-finish-publisher-ack.md
  • rs/moq-net/src/lite/publisher.rs
  • rs/moq-net/src/lite/subscriber/routed/tests.rs
Files with no reviewable changes: 1

  • quest/m0/test-flakes-3/interop-finish-unroutable.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 — the relay handed a peer's claim to other sessions in the same flush that queued the serving session's Output::Serve, so a reader could ask before the origin held the route; the fix reuses the confirmation the named-node path already waited on rather than moving route landing out of the session that owns the permit, hop chain, and loop check.

Reviewed changes — the whole diff (4 files, 2 commits) at d309bc1.

  • poll_node_filter now waits for an instance-only request's claim — the node = None branch computes claim once (origin.resolve(broadcast).zip(instance.cloned())) and, when present, waits on Node::poll_forward(tag, None, &claim) before returning the unfiltered origin. State::forward with named = None answers immediately unless the picked route's slot is Confirm::Waiting, and Stream::serving bumps moved right after origin.forward, so the wait is the same edge the named-node path already parked on. The discarded Via is right: the node's refusal must not become the answer, and the request still resolves through the whole origin.
  • No effect on pre-lite-07 sessions — lite::instance::decode_pin/decode_node no-op without version.has_routes(), so older requests carry no instance, claim is None, and origin.route_node() is never touched; on a non-proxy publisher app the own claims come back Via::Here, so nothing waits.
  • Regression test — a real lite-07 Client/Server pair over transport::memory::pair; the upstream asking() session files the claim and withholds its Serve output until after the reader has subscribed, then drains it via try_serve()/output(). The subscriber.sources.poll_pop assertion is the right observable: it only fires once the relay's lookup reached the source the claim landed, and without the fix the request is refused Unroutable and never retried. Simulated clock throughout.
  • Quest turnover — the claimed quest is deleted (no dangling references in quest/), and the one python publisher hang from the interop run is filed as a follow-up quest with a measurable goal and matching format.

I checked the interaction with REVIEW.md's "no cross-session waiting" rule and AGENTS.md's "reports what it knows now": the wait is on the node's own handoff to the origin, not on another node answering, and it is the only option the quest's constraints leave (holding announcements changes what the node shows, which the route rule owns). Residual gap — a request naming no instance — is only reachable through a covering-route announce and is recorded in the PR's Decisions.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash | 𝕏

@kixelated

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

(Written by Claude Opus 5.5)

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (2026-11-18, asked in the coordinating session with this PR's report): picked to merge, and the follow-up quest quest/m0/test-flakes-3/py-finish-publisher-ack.md is kept. Neither asks for a change to this head.

(Written by Claude Fable 5.2 with high effort)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Answering the decision in #9052 (comment): no change to the head is needed. The follow-up quest has no open decision to record, and the pick is queued.

(Written by Claude Fable 5.2 with high effort)

@kixelated
kixelated added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 2668d1a Nov 18, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m0/test-flakes-3/interop-finish-unroutable branch November 18, 2026 05:37
kixelated added a commit that referenced this pull request Nov 18, 2026
The switch (#8987, #9052, #9053) replaced lite-07's path rule. Delete the
switch quest, the Playwright bump whose only reason was the route key lane,
and route fan-out, whose surviving cost moves to route benches. Retarget
federation, the routing guide, route wakes, handoff routes, regrant,
interest-stream caps, the mesh condition, and route memory to the route
layer on main, and trim the two route epics to what still stands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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