Skip to content

fix(desktop): separate relay readiness from background sync - #6998

Draft
wesbillman wants to merge 1 commit into
brain/diagnose-send-stallfrom
pinky/desktop-startup-coordination
Draft

fix(desktop): separate relay readiness from background sync#6998
wesbillman wants to merge 1 commit into
brain/diagnose-send-stallfrom
pinky/desktop-startup-coordination

Conversation

@wesbillman

Copy link
Copy Markdown
Collaborator

Pinky, an AI agent, is opening this PR on Wes's behalf.

Summary

Separate authenticated relay readiness from background history synchronization, and remove a redundant per-channel subscription family from Desktop startup.

  • Derive Home mention signals from the existing member-channel live streams instead of opening a second #p subscription per channel. Keep mention kinds, recipient/self/member policy, deduplication, latest callbacks/identity, and single-channel context for untagged auxiliary events.
  • Resolve connection readiness after AUTH rather than after reconnect replay/history repair. Start the watchdog and publish reconnect readiness while repair continues in the background.
  • Fence background replay failure recovery to its connection generation. New live subscriptions still wait for the shared admission gate and reject if superseded while waiting.
  • Snapshot reconnect subscriptions before any gate wait so a newly created subscription cannot also be replayed when a throttled timer fires late.

Scope: this is the first structural slice, not a claim that the reported startup send stall is fully fixed. Cold-start fan-out remains unpaced, both native relay sessions share the relay's per-principal quota, and exhausted/ambiguous send recovery remains separate work. This does not exempt user sends from authoritative relay backoff.

Related work and stack

Testing

At pushed head 49e57ce5557d5830b4adedb46e56b82f22196515:

  • All nine authoritative pre-push lanes passed: push-head-scope, branch-skew, file-size-check, desktop-check, rust-tests, desktop-typecheck, mobile-checks, desktop-test, and desktop-tauri-checks. Pre-commit formatting/lint passed too.
  • 10 mounted React-hook regressions count 20/50/129 member-channel streams (not 40/100/258), verify the remaining wire filter covers every Home mention kind, and exercise replay dedupe, notification boundaries, membership/callback/identity updates, auxiliary routing, setup retry, and cleanup.
  • 8 real RelayClient IPC-dispatch regressions cover held repair with a successful plain send, AUTH gating/rejection, stale/current replay failures, backoff admission, community replacement, and delayed-timer replay snapshot ordering. Only the Tauri transport/repair boundary is mocked.
  • Eight deliberate mutations were killed: restoring await-history, removing stale-replay fencing, bypassing admission, removing admission generation validation, delaying the replay snapshot, and removing mention recipient/dedupe/wire-kind guards.
  • Read-only independent review completed. Unpaced fresh subscriptions remain a follow-up; a suggested EVENT backoff exemption was rejected because the server quota is shared. The unconditional gate await is deliberately generation-guarded.

Not verified: native before/after send latency, a packaged composer click-through, and retained operation identity after exhausted/ambiguous failure. Native capture is paused. No visual UI changes or screenshots in this slice. GitHub CI will validate this exact stacked range separately from the local gates.

Derive Home mention updates from existing member-channel streams instead of a
second per-channel subscription family. Preserve kind/recipient policy,
notification dedupe and single-channel auxiliary routing.

Resolve connection readiness after AUTH without waiting for replay/history
repair. Fence background failure recovery, gate new live subscriptions, and
snapshot reconnect subscriptions before admission waits so new streams are
not replayed twice.

Add mounted-hook and real RelayClient IPC-dispatch regression coverage for
request counts, notification delivery, readiness, back-pressure and community
replacement.

Signed-off-by: Pinky <5f5ab050ec58ae208332edd544ebf705221e24c1b86d82a6ca07038a7a8f6ac9@buzz.block.builderlab.xyz>
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