Skip to content

test(ariadne): fix StillOuterPeerReentryNoRealignNoFreeze's realign in package-linux / libcvc-debug-grpc - #847

Merged
transfix merged 3 commits into
masterfrom
fix/room-relay-realign-flake
Oct 28, 2026
Merged

transfix merged 3 commits into
masterfrom
fix/room-relay-realign-flake

Conversation

@transfix

@transfix transfix commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

RoomRelayLoopbackTest.StillOuterPeerReentryNoRealignNoFreeze failed most attempts in package-linux / libcvc-debug-grpc, on master and on most PRs. Each failing attempt had exactly one clock realign (B.h.clock_realigns() was 1, against a baseline of 0). This PR fixes the test harness. The product code is unchanged.

Root cause

The realign does not come from a pushed tick, and it is not a stall. It comes from B's own clock starting late relative to the relay's.

  • Clock start. The relay holon's clock starts on the server_pump in its first room step. A test client's replica clock started on that client's first frame, which runs after that step. In this lane the first step is slow because the joins land during it: it took 0.41 to 0.57 s.
  • First sample. B's first sample was its own pose, stamped partway through that step (tick 33 to 46). That is within max_skew_ticks (60) of B's clock at 0. The test clients set no lead, so holon::apply_authoritative left the replica where it was. B then ran 47 to 65 ticks behind the relay.
  • Settle. Both avatars stand still through the 0.5 s settle, and still poses are re-stamped only on the 1 s heartbeat. So no fresh sample reached B before the baseline was taken.
  • The realign. The first fresh sample was B's own pose on its first walking frame. It showed the full lag, and whenever that lag passed 60 ticks, B's clock re-aligned. The baseline had already been taken, so the test counted it.

The lag also weakened what the test guards. With B 60 ticks behind, a pushed heartbeat tick about 110 ticks old would sit only about 50 ticks from B's clock, inside tolerance, and the check would miss it.

CI evidence

The evidence comes from a diagnostic commit (since removed). It logged every relay step, every B frame, and every pose tick B applied, and failed on purpose so ctest printed all three attempts: run 40613441662, job 122570275883.

attempt first relay step B's lag at the baseline skew of first walk sample result
1 0.545 s 60 ticks 65 realign
2 0.566 s 65 ticks 67 realign
3 0.413 s 47 ticks under 60 no realign

In every attempt the realigning sample was B's own pose, on the frame after r.walk("B", 4, 0). Nothing re-aligned B after that:

  • C's entry push carried the relay's current tick (397 at server tick 397).
  • The WebSocket re-broadcast after a push resent a tick of C's that B had already applied, and B ignored it.

Fix

When the relay has not stepped yet, bring_up now advances every client's holon once, right before the relay's first step. This starts the replicas' clocks in step with the relay's, like clients that are already up when their server starts.

If the first step takes longer than 0.5 s, the client's next frame hits the 60-quantum catch-up cap and drops a few quanta. That leaves the replica a few ticks behind, far inside tolerance.

As a result, a heartbeat-old pushed tick is again well past max_skew_ticks from B's clock, so the check catches it. The assertion is unchanged. Its failure message now also prints B's lag at the start of the walk.

Verification

  • package-linux / libcvc-debug-grpc on a4179b5, two runs. The test passed on its first attempt both times, and every test in the job passed (5516 of 5516):
    • run 40626778376, job 122613499398: 5.05 s
    • re-run, job 122970340756: 4.71 s
  • Every other job in run 40626778376 is green.
  • After the merge, master's push runs (e7b28ac, 45dab15), jobs 122930841021 and 122923547543: the test passed on its first attempt both times (5.19 s and 4.92 s), and every test in each job passed (5522 of 5522).
  • clang-format 18.1.8 is clean on the changed lines.

…eze's realign

Temporary: logs each room step (server tick, dropped quanta, broadcast,
the relay tree's pose ticks, tiers), each of B's frames (its clock before
and after, the pose ticks it read, the realign count) and every pose tick
B's shard applies (live or snapshot), and dumps the log when the realign
check fails. To be replaced by the fix.
RoomRelayLoopbackTest.StillOuterPeerReentryNoRealignNoFreeze failed most
attempts in package-linux / libcvc-debug-grpc with one clock realign. A
diagnostic run (job 122570275883) showed that the realign is not caused by a
pushed tick: it is B's own clock joining the relay's late. A replica's clock
started at its first frame, after the relay's first step, which the joins
make slow (0.41 to 0.57 s there). Its first sample, stamped during that step,
was within max_skew_ticks (60), so apply_authoritative left the replica
47 to 65 ticks behind. Both avatars stand still through the settle (heartbeat
1 s), so the first fresh sample was B's own pose once it walked, and that
sample re-aligned it whenever the lag passed 60.

bring_up now starts every client's clock just before the relay's first step
when the room starts with them, so the replicas run in step with the relay.
That also restores what the test guards: a heartbeat-old pushed tick is now
well past max_skew_ticks from B's clock, where before a lagging B could miss
it. The failure message reports B's lag at the start of the walk.

Removes the temporary diagnostics.
@transfix
transfix marked this pull request as ready for review October 28, 2026 05:07
@transfix
transfix enabled auto-merge (squash) October 28, 2026 05:08
@transfix
transfix merged commit 6744512 into master Oct 28, 2026
24 of 25 checks passed
@transfix transfix changed the title test(ariadne): fix StillOuterPeerReentryNoRealignNoFreeze's realign in package-linux / libcvc-debug-grpc test(ariadne): start the replicas' clocks with the relay's (StillOuterPeerReentryNoRealignNoFreeze realign) Oct 28, 2026
@transfix transfix changed the title test(ariadne): start the replicas' clocks with the relay's (StillOuterPeerReentryNoRealignNoFreeze realign) test(ariadne): fix StillOuterPeerReentryNoRealignNoFreeze's realign in package-linux / libcvc-debug-grpc Oct 28, 2026
@transfix
transfix deleted the fix/room-relay-realign-flake branch October 29, 2026 20:54
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