Repository navigation
fix(relay): redial a cluster peer from the first backoff ceiling once an attempt connected (backport) - #9104
Conversation
… an attempt connected (backport) Backport of the redial backoff reset from #9055. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. Because run_remote_session can never return Ok, the old stable_threshold reset never ran. The PR deletes that dead branch and resets Redial when an attempt actually reached Status::Connected, which matches what #9055 does on main with the signal release has.
Reviewed changes
I reviewed the one-commit backport to rs/moq-relay/src/cluster.rs.
Infalliblesession result:run_remote_onceandrun_remote_sessionnow returnanyhow::Result<Infallible>, so the compiler enforces that an attempt only ends in an error. Thelet Err(err) = …inrun_remoteis irrefutable.connectedout-param: this is set in theStatus::Connected if connection.is_none()arm, andrun_remoteresets it tofalsebefore each attempt.Redial::next(connected, rng): this resets toRedial::default()before drawing, so the first wait after a connected attempt is at mostFIRSTand the ceiling then doubles as before.- Test: the new
redial_resets_after_an_attempt_that_connecteddrives the ceiling toCAPand then checks the reset. The existing jitter test now passesfalse.
A peer that accepts and then fails right away, such as a redirect straight after the handshake, now also resets the outer ceiling. The inner moq_tokio reconnect's own backoff and give-up still bound how fast that can repeat, and main behaves the same way, so this is not a regression.
claude-opus-5-5 | 𝕏
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (moq-dev#9100) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Backport of the redial backoff reset from moq-dev/moq#9055 to
release, for questquest/m1/precut-fixes/relay-backoff-backport.md(claimed by moq-dev/moq#9100).Problem
A relay redials a cluster peer through
Redial, whose ceiling doubles to 30 s.run_remotereset it only onOk(()) if elapsed >= stable_threshold, butrun_remote_oncenever returnsOk: its session loop runs untilreconnect.status()errors. So the ceiling never reset, and a peer that flapped after a long outage waited out a wait drawn below 30 s.Changes
rs/moq-relay/src/cluster.rs:run_remote_onceandrun_remote_sessionreturnResult<Infallible>and setconnectedoncereconnect.status()reportsStatus::Connected.Redial::next(connected, rng)starts over at the first ceiling when the attempt connected. The deadstable_thresholdbranch is gone.redial_resets_after_an_attempt_that_connected.Only the backoff reset is ported, as the maintainer decided when picking #9055. The two startup refusals (
cluster.api.rootwithoutcluster.api.url,cluster.tokenwith no peer to dial) stay onmain.Differences from #9055
releasehas no token rotation retry, panic isolation, ordial.observein this path, so:Status::Connectedfromreconnect.status(), thereleaseequivalent ofmain'sobservation.connects > 0.releasehas no immediate retry on rotation.main's drill mutationpeer-link-never-redialed.patchdoes not exist onrelease.Impact
No public API or wire change:
Redialand the session functions are private.Validation
cargo test -p moq-relay: all pass, including the new test.cargo clippy -p moq-relay --all-targets -D warningsandcargo fmt --checkclean.tests/cluster_drain.rs(paused clock, counting forwarder, not committed): relay A dials B through a forwarder that refuses for 600 s, B comes up and A connects, then B shuts down and stays down. Gap from the inner reconnect giving up to the next outer redial:origin/release: 14.5 s, drawn below the 30 s ceiling the outage built.Caused by
No single PR: the backoff branch was dead when written (see #9055).
Models
Size: XS
Implementer: Claude Code, claude-opus-5-5, medium effort
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with medium)
Review
Rewritten by
quest reviewafter each round.Head: 83ab8b9
Base: origin/release at c636e03
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1f048-50bd-7370-87b2-4f765eb14f2a, round 1Score: 9/10,
Source review found no actionable defects in reconnect backoff handling, but builds and tests were not run as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none