Skip to content

perf(remote): adopt push-based remote catalog with version gate and slow-poll fallback - #1015

Merged
huichen merged 5 commits into
mainfrom
perf/remote-push-catalog
Oct 13, 2026
Merged

huichen merged 5 commits into
mainfrom
perf/remote-push-catalog

Conversation

@huichen

@huichen huichen commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Make the desktop remote client consume host-pushed state.sessions / state.workspaces snapshots instead of polling, with a slow-poll fallback and heartbeat self-heal.

What changed

  • Rust remote_peer/runtime.rs now reads state.sessions / state.workspaces snapshots and emits them as PeerEvent of kind catalog.
  • Added CatalogVersionGate (desktop/src/features/remote-peer/catalogVersion.ts) mirroring mobile's gate semantics: epoch from handshake/presence, monotonic revision, allowEqual for explicit reads.
  • useRemotePeers.ts now applies pushed snapshots, uses presence catalogVersion for heartbeat self-heal, and keeps a 60 s slow poll for old hosts / drop detection.
  • Tests cover the gate and the hook: old/equal revision rejection, heartbeat catch-up, and old-host polling fallback.

Quantified benefit

For each connected push-capable host, we eliminate the fixed 15 s catalog poll (4 req/min/host) and replace it with a 60 s safety poll (1 req/min/host) + snapshots on change. Net saving: 3 catalog-read requests per minute per host, plus no polling traffic at all when the catalog is unchanged.

@huichen
huichen enabled auto-merge (squash) October 13, 2026 04:29
…low-poll fallback

- Rust: read state.sessions/state.workspaces snapshots and emit them as catalog PeerEvents

- Frontend: add CatalogVersionGate, apply pushed snapshots, heartbeat self-heal from catalogVersion

- Keep a 60 s slow poll fallback for old hosts and drop detection
@huichen
huichen force-pushed the perf/remote-push-catalog branch from 22c6258 to 52bf45d Compare October 13, 2026 04:32
@huichen
huichen merged commit a9c352b into main Oct 13, 2026
12 checks passed
@huichen
huichen deleted the perf/remote-push-catalog branch October 13, 2026 05:42
huichen added a commit that referenced this pull request Oct 13, 2026
…ay and gaps (#1019)

Bring §2.2.2 (The Desktop as a client) back in line with origin/main after the
remote-alignment round (#1007, #1009, #1010, #1012, #1013, #1014, #1015, #1017,
#1018):

- The two "mechanism, not a gap" table rows are gone: the desktop replays with
  get_events_since (falling back to one whole-page read) and probes
  get_prompt_receipt on a stored send, both as the phone does. The one remaining
  mechanism difference -- get_presence on a suspect socket vs. the presence
  subscription -- is stated in prose.
- The capability paragraph names the gains: workspace rename on the phone, and
  per-host/per-conversation drafts, the stored outbox, the done bell, question
  navigation, list search and image zoom on the desktop.
- The merged-list paragraph describes the pushed catalog: domain-tagged snapshots
  gated by {epoch, revision}, healed by the presence heartbeat, with a slow
  per-host read only as the fallback for older hosts.
- CONNECTION.zh-CN.md carries the same edits.
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