Repository navigation
fix(net): route floors never cover a live session and stay bounded - #9370
Conversation
Quest-Claim: d40543f90fd54fd8
A relay names its own closed session only once every older session to the same relay closed too, so a newer session closing first no longer floors the older, live one and black-holes every route crossing it. Floors of pairs no heard route joins are kept only while they number no more than the joined pairs, oldest evicted first, bounding the table by the heard routes against restarts and a hostile routing peer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he route-floors quest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r session closes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou'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 1 minute. View limit details
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. |
There was a problem hiding this comment.
ℹ️ No critical issues. Two minor suggestions inline: one test no longer checks anything, and one doc sentence doesn't match the code.
Approach: sound. Deferring DEAD until no lower-numbered live session to the same relay remains is the smallest fix that makes FloorsClosed hold. Capping the number of loose floors at the number of joined pairs keeps the table linear in heard routes and doesn't need a timer.
Reviewed changes
Reviewed all six commits: the router change, the doc and draft text, and the new unit and integration tests.
- DEAD deferral:
Router::disconnectnow names its own closed session only when no live routing peer to the same relay has a lower session number. A deferred session is never named, so its stale routes go away when the routes are re-advertised. - Bounded floors:
Loosetracks floors whose pair no heard route joins anymore.forget()evicts the oldest of them while they outnumberrx_pairs, andcheck()asserts the bound on every input. - Why the bound holds when a floor is filed: a receiver files a floor only after
check_dead, which guarantees a live route joins the pair. Own-relay floors are never filed. So a new floor never enters the table already loose. - Docs and draft: updated the rule for when DEAD is sent, added a MAY-forget for floors, and rewrote the route-algebra
FloorsClosedargument. - Tests: added a three-router mesh, a 200-relay hostile-peer bound test, and a kio-simulated
cluster_two_sessionsintegration test using the newNet::dial_down.
claude-opus-5-5 | 𝕏
… deferred session is never named Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found. Both earlier suggestions are fixed.
Reviewed changes
Reviewed f0ea574, the only commit since the last review. f1ac740 was a merge of main and was already covered.
- Replaced the vacuous floor test: deleted
a_session_floor_keeps_an_entry_per_pair_of_relays, which always sampled 0 floors. Addeda_restart_replaces_the_pairs_floorinrelay.rs, which sends a ROUTE and a DEAD under start 5 and again under start 6. It checks that the higher start passes the old floor and that the pair keeps one entry. It passes locally, and it would fail if a restart added a second entry. - Clarified that a deferred session is never named: the README's
FloorsClosedargument, the draft's Closed Sessions rule and changelog, and the module anddisconnectcomments now say that a session closing while an older one to the same relay is live is never named, and that its routes go by replacement. This matchesRouter::disconnect.
claude-opus-5-5 | 𝕏
There was a problem hiding this comment.
✅ No new issues found. No commits have landed since the last review, and both earlier findings are settled.
Reviewed changes
No commits since the last review, which approved f0ea574. This run re-checked the two resolved threads against the current head.
- Replaced the vacuous floor test: the author confirmed that
a_restart_replaces_the_pairs_floorfails both waysfloor_of's order could break: with the start dropped, and with the start keyed into the pair. - Made the docs match
disconnect: the module doc, README, and draft now say that a session closing while an older one to the same relay is open is never named. The author confirmed this is the intended behavior (Decision 1).
claude-opus-5-5 | 𝕏

Finishes quest/m1/lite07-routing/route-floors.md.
Problem
Two relays that dial each other (a shared
cluster.connectlist, mDNS mixed with static peers, a one-sided redial) hold two lite-07 sessions. When the newer one closed first, the relay named it in DEAD. Each receiver then floored the pair at that session, which covers the older, live session too. So every route over the surviving session was refused, and a relay reaching the far side only through them showed the broadcast unavailable until the older session flapped.The floor table (
Router::closed) was also kept for good. A relay crash-looping under a fresh random ID added entries to every survivor without limit. A routing peer could grow it at will: a ROUTE naming made-up relays, then a DEAD for each.Approach
Router::disconnectnames its own session only when no live routing session to the same relay is numbered lower. A deferred session's routes are replaced by the usual re-advertisement. So no floor ever covers a live session (FloorsClosed).Router::checkasserts it on every input.moq_relay::sim::Net::dial_down(test-support) refuses one direction's dials, for the new relay test.Decisions
The maintainer accepted both on the merge pick (2026-11-22): ✅ DEAD names the closing session (rejected: DEAD names the highest closed session); ✅ the eviction rule below (rejected: evict once no live session or heard route names the relay).
DEAD names the session that just closed, not "the highest closed". A session that closes while an older one to the same relay is still open is never named. The plan said to name the highest closed session. But a DEAD naming a session that no live route crosses fails the receiver's
check_dead(Unrouted), which ends the session. Making that check pair-wide would add receiver code just for an accelerator. Under the deferral, the closing session lies below every live one, so its floor still covers only closed sessions. A deferred newer session gets no floor of its own, and its stale copies die by replacement.Eviction keeps recently loosened floors up to the joined count, instead of "once no live session or heard route names the relay". I measured the alternatives on
the_router_gives_the_prototypes_answers:home_dieson 6 shapes. On clique, for example: +1 settle round, stale 8→12, loops 38→55.The chosen rule regresses none of these and is linear.
Impact
moq_relay::sim::Net::dial_downis added behind thetest-supportfeature.-wip.Validation
Reproduced first with
route::relay::tests::a_second_session_keeps_the_route, a three-router mesh closing whichever A–B session the route crosses. Main fails it; the branch passes.The real surface:
cluster_two_sessions::losing_either_of_two_sessions_keeps_the_routeruns three moq-relay clusters on kio's simulator with peer grants: A and B dial each other, C dials A, and B publishes. It runs four combinations of which session is cheaper and which one closes. With the deferral reverted it fails:b's session to a closing lost [("live", false)] at C. With the fix it passes, in 0.3–0.4 s.Restart order:
a_restart_replaces_the_pairs_floorreplaces the sim test the eviction made vacuous. It fails both when the start is dropped fromfloor_of's order (start 6 is above every floor) and when the start is keyed into the pair (one floor for the pair after start 6, left 2).Bound:
a_peer_naming_made_up_relays_leaves_no_floorssends 200 made-up relays with a DEAD each. The router stays at ≤4 floors, and 0 after the peer disconnects; main grows by one floor per relay.Second, independent check, measured with
benchmark_relay_floor_growth(nightly), eviction off vs on, floors per lasting relay. Main grows linearly with each replaced identity, while the branch stays flat:Also ran:
--run-ignored only route::tests::multicast(_search|_cost)?): every-order searches, every failure at 32 relays, event work. All pass.mesh_sweep::seeded_meshes_hold_the_route_rules(500 cases, seed 12345), which passes.just checkonf0ea574f16, which passes: 11142 tests run, all passed. The local reviewer's sandbox runs no builds or tests by design, so this run stands in for them./verify-failoverwas not run: the change stays inside the router and doesn't reach how a front ends a track.Caused by
Router::disconnectnaming every closed session, and floors kept for good (found by person, the 2026-11-21 routing audit)Alternatives
Follow-ups
None.
Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown effort (arm B)
Implementer: Claude Code, claude-opus-5-5, unknown effort (iterate, M, arm B)
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Head: f0ea574
Base: origin/main at 1cdc73b
Risk: high,
It changes when a relay sends DEAD for a closing session, which is the lite-07-wip wire rule the draft now states, so a peer on a build that expects the old rule could black-hole routes it used to keep, and reverting the draft and relay.rs commits would undo it; RISK.md counts a change to an unpublished -wip wire version as high because the next cut publishes it.Classified: high by Claude Code, claude-haiku-5-5, low effort, session
3bf86b8a-6b22-433d-bab7-7c8cd30deae3Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a2047f-ce12-7253-b94e-b407716300ea, round 1Score: 9/10,
No actionable defects were found; the session-floor fix and bounded retention align with callers and regression tests, though builds and tests were not run.Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none