Skip to content

fix(mobile): reconcile presence snapshots after reconnect - #4850

Open
syntaxafterdark wants to merge 1 commit into
block:mainfrom
syntaxafterdark:fix/mobile-presence-snapshot
Open

fix(mobile): reconcile presence snapshots after reconnect#4850
syntaxafterdark wants to merge 1 commit into
block:mainfrom
syntaxafterdark:fix/mobile-presence-snapshot

Conversation

@syntaxafterdark

Copy link
Copy Markdown

Summary

  • Query the relay's current presence snapshot when mobile begins tracking users, reconnects, and periodically while connected.
  • Resolve relay-signed snapshot subjects from the p tag, with the event pubkey as a fallback.
  • Mark tracked users absent from a snapshot as offline without overwriting a live event that arrived while the query was in flight.
  • Batch and deduplicate snapshot requests, and ignore stale responses from an earlier connection generation.
  • Preserve the existing live kind-20001 subscription for immediate updates.

Presence events are ephemeral, so stored-event backfill cannot recover updates missed while Android is backgrounded or reconnecting. Mobile previously depended only on live presence events; a missed event could therefore leave the displayed status stale indefinitely. This adds the snapshot reconciliation path already needed for ephemeral state while retaining live updates.

Related issue

Related to #4402, which reports message catch-up after Android backgrounding. This PR addresses the separate presence-reconciliation symptom and does not claim to fix stored-message catch-up.

Testing

  • dart format --output=none --set-exit-if-changed on both changed files: passed.
  • Focused presence provider suite: 20 tests passed.
  • Repository-required . ./bin/activate-hermit && just ci: passed, including 1,177 mobile tests.
  • Tested on a real Android device: the observed stale/offline presence symptom was resolved.
  • Message catch-up behavior remains unconfirmed and out of scope for this PR.

No visual layout was changed, so before/after screenshots are not applicable.

Signed-off-by: syntaxafterdark <309209481+syntaxafterdark@users.noreply.github.com>
@syntaxafterdark
syntaxafterdark marked this pull request as ready for review August 5, 2026 07:23
@syntaxafterdark
syntaxafterdark requested a review from a team as a code owner August 5, 2026 07:23
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