Skip to content

fix(mesh): retain echo receive across housekeeping ticks - #7140

Draft
loganj wants to merge 1 commit into
mainfrom
fix/mesh-echo-standalone-ecd32187
Draft

fix(mesh): retain echo receive across housekeeping ticks#7140
loganj wants to merge 1 commit into
mainfrom
fix/mesh-echo-standalone-ecd32187

Conversation

@loganj

@loganj loganj commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

🤖

Summary

The relay's mesh echo probe can time out even after receiving the message it should echo. Slow session validation makes this more likely: a periodic shutdown check can discard a message that has already been read. This change keeps that pending receive alive until validation finishes or the stream actually shuts down.

The fix is limited to the echo consumer. It is independent of Multiverse and contains none of its feature changes.

A single pending recv_validated() operation now survives non-draining 100ms housekeeping ticks. That protects both partially read transport frames and messages awaiting Redis, the shared session directory. The invariant is that housekeeping never discards an in-flight receive. Actual shutdown may discard it, but never echoes unvalidated data. The pending receive releases its mutable stream borrow before the existing Goodbye/finish path runs. Session ownership and community validation, EOF/error handling, and tick timing remain unchanged; this does not add drain priority over already-ready data or change transport backpressure behavior.

Related issue

Related: #2458. Existing PR #2745 addresses the same cancellation mechanism with broader transport/API and test changes; this is a smaller consumer-only alternative, not a claim that the earlier work is merged or superseded. Maintainers should choose which approach to carry forward.

Testing

On standalone head a02372ad5636856af41a219b87a64d3be3f98768, with isolated PostgreSQL/Redis and Rust 1.95.0:

  • Five consumer regressions passed, explicitly including all four Redis-dependent tests: consumed-frame contention, sequential echoes/no duplicates, drain before/after community latch, EOF, and stale-session rejection.
  • Real-QUIC echo: 1 passed; reliable-stream suite: 6 passed.
  • Full buzz-relay package, run serially: 997 library + 13 binary tests passed; 92 library + 1 binary ignored. The four new ignored-by-default Redis tests were explicitly run above.
  • Affected-package all-target Clippy, workspace Rust formatting, and patch whitespace checks passed.

Repository-wide local just ci completed successfully (exit 0), including workspace/Tauri checks and tests, desktop checks/tests/build, web checks/build, and 2,015 mobile tests. The just test wrapper was not run because it overwrites inherited service URLs and invokes default-service startup on this shared host; package tests instead used explicit isolated resources. Worker-only Redis/database and local diagnostic listeners have been cleaned up.

Remote CI completed with the required Desktop aggregate red: smoke shard 3 failed the profile/channel hover CSS assertion on all three built-in attempts. Diagnosis and separate test-only proposal: the test captures an intermediate channel animation color (.03/.027), then compares it to the profile's settled .04. Both selectors use the same 4% hover token. On the base-identical desktop tree, an isolated diagnostic confirmed equal settled colors in five samples; a copy with a pre-sample animation wait passed 3/3. These local results do not clear the required remote failure, and no frontend change is bundled here. Maintainer disposition of this existing test race is still required; no remote rerun was dispatched.

All other executed required checks passed, including Rust Lint, Unit Tests, Security, Windows Rust, macOS build, both Desktop E2E Integration shards/aggregate, Backend Integration, Desktop E2E Relay, Relay E2E, DCO, and Desktop Release Candidate. Remote Mobile and Web were path-filter skipped (local checks/build/tests above ran). Advisory exact-range security review run 33432941909 is still reported in progress as of 2026-08-31 20:36 UTC (over 43 minutes, no current-range result posted), separately from the passed required Security check. Workflow-owner follow-through is needed; no advisory approval or absence of findings is inferred. This remains a draft, not an all-green or approved PR; human/codeowner/last-push review is still required.

The regression's negative control uses the exact original consumer and the same test: it fails because the receive is recreated four times instead of once. This is reused evidence from the unchanged source/test pair, not a fresh full-main baseline build.

The separate real-QUIC echo fixture tests loopback transport and session routing. Controlled-transport drain tests are not QUIC fault injection. Neither proves HTTP authorization, model execution, Desktop compute parity, or packaging readiness.

Keep the pending reliable receive and Redis validation alive until a frame arrives or shutdown actually drains the stream. Drop its mutable borrow before the existing Goodbye/finish path.

Cover consumed-frame pool contention, drain before and after community latch, EOF, sequential echoes, peer Goodbye, and stale lease rejection.

Signed-off-by: Logan Johnson <loganj@squareup.com>
@github-actions

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is bc006f67087b049e2f9c4d8a2f26faceff628225...a02372ad5636856af41a219b87a64d3be3f98768.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review a02372ad5636856af41a219b87a64d3be3f98768 to authorize a new review.
Any previous review applies only to its recorded range.

@loganj

loganj commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

@buzz-security-review a02372a

@loganj

loganj commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

Desktop smoke failure: existing animation-sampling race

The required Desktop aggregate remains red because smoke shard 3 failed profile hover uses the channel hover surface at message-feedback-snapshots.spec.ts:108. This is a CSS equality assertion, not a pixel-snapshot mismatch. Initial expected alpha was .03; both built-in retries expected .027; actual profile color settled at .04.

The failure mechanism is identifiable:

  • The test reads the channel's computed color immediately after hover and freezes that string as the expected value. Its animation wait is after the assertion.
  • The channel has a 100ms background transition. Both channel and profile hover explicitly use the same --buzz-hover-surface, defined as 4% black. .027/.03 are intermediate samples, not that endpoint.
  • The downloaded retry-1 trace preserves the .027 expectation and eleven polls of settled .04. Its embedded spec matches the checked-in source byte-for-byte.

On macOS arm64/Chromium 148.0.7778.96, with an isolated E2E build/private port and no relay, the exact unmodified single test passed once. A separate diagnostic recorded a running channel transition from transparent to .04 immediately after hover, then identical settled channel/profile colors (.04) in five of five samples. The complete desktop tree is identical at this PR's base and head (c6ed1db8e496ab46c2d8f1788957f64be9abef5f). This supports an existing base test timing defect, not a mesh regression, beyond merely observing that the frontend diff is empty.

Suggested separate test-only follow-up, not applied to this two-file mesh PR:

   await channel.hover();
+  await waitForAnimations(page);
   const channelHoverColor = await channel.evaluate(

A copy with this stabilization passed 3/3, no retries, against the same unchanged build. No production CSS change was needed. A lucky rerun can also compare transient values, so these local passes do not clear the required remote check; no remote rerun was dispatched.

Maintainer action: choose a policy-compliant disposition for the red Desktop gate, preferably a separate test stabilization, then establish a valid green gate for the relevant revision. This PR remains draft; human/codeowner/last-push review and the choice versus overlapping #2745 remain outstanding. Independently, the existing repository-wide local just ci completed successfully (exit 0, including 2,015 mobile tests); worker-only test Redis/database and diagnostic listeners are cleaned up.

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