Skip to content

fix(components): keep presence snapshots across bounded reconnect stop - #481

Open
slashdevcorpse wants to merge 2 commits into
LodyAI:mainfrom
slashdevcorpse:fix/presence-survives-bounded-reconnect
Open

fix(components): keep presence snapshots across bounded reconnect stop#481
slashdevcorpse wants to merge 2 commits into
LodyAI:mainfrom
slashdevcorpse:fix/presence-survives-bounded-reconnect

Conversation

@slashdevcorpse

@slashdevcorpse slashdevcorpse commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Related issue

Closes #480

Problem / pressure

#449 bounded renderer meta reconnect backoff. Each retry still stops the presence transport, which published {}. The UI then treated a live PC as offline. That is the renderer side of the same cluster as #398 / #399.

Summary

WorkspacePresenceTransport no longer publishes a snapshot with no kind: 'machine' entries. stop() does not emit {}. A reconnect start() on an empty store does not either. Wake detection still stamps lastSnapshotAtMs. Last machine heartbeats remain until a new machine snapshot or the 90s TTL.

Before / after

Before After
stop() or the next empty start() emitted {} and lists showed the PC offline. Those paths keep the last machine snapshot. Sync state is idle.
#449 bounded retry rate only. Bounded retries no longer wipe liveness.

Test plan

  • corepack pnpm exec vitest run tests/workspace-presence-transport.test.ts tests/local-reconnect-loop.test.ts tests/create-workspace-runtime-meta-recovery.test.ts from packages/components — 34 passed.
  • The presence-stop test failed first ({} vs last machine snapshot) and passed after the skip.
  • fix(components): bound meta reconnect recovery #449 reconnect-loop tests still pass.
  • No live desktop reconnect session was run.

Context handoff

Instructions for reviewing agents

  • Review focus: onBeforeStop and onStoreChange in workspace-presence-transport.ts, plus the keep-on-stop / restart-empty case in workspace-presence-transport.test.ts.
  • Decisions to challenge: Skip any snapshot with no kind: 'machine' instead of a UI .has() sweep. Viewing-only updates no longer notify onSnapshot.
  • Plausible failures / evidence gaps: A machine that truly leaves can look online until TTL (90s). Viewing presence in the UI snapshot can lag across reconnect until the next machine heartbeat. Workspace switch still clears via clearLodyPresenceStatesAtom.

Authoring context

Follow-up to LodyAI#449. Presence transport stop no longer publishes an empty map, so a live PC is not shown offline for each renderer reconnect.
stop() no longer wiping was not enough. start() still published an empty store. Skip snapshots that contain no machine heartbeat.
@slashdevcorpse
slashdevcorpse marked this pull request as ready for review September 8, 2026 00:46
Copilot AI lite review requested due to automatic review settings September 8, 2026 00:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the status:needs-pr-attention External PR needs contributor attention before review label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

@slashdevcorpse, this pull request needs updates before review.

It is marked status:needs-pr-attention. Address the findings below by 2026-09-16 08:24:01 UTC. The label and this comment are removed automatically after the PR passes validation.

If the PR remains invalid for 7 days, it will be closed and marked status:pr-policy-expired. Continue afterward by opening a new pull request with the current template.

Policy findings
PR does not meet Lody contribution requirements:

- Missing required heading: ## Visual explanation

See `CONTRIBUTING.md` and `.github/PULL_REQUEST_TEMPLATE.md`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: components status:needs-pr-attention External PR needs contributor attention before review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Bounded renderer reconnect still paints the PC offline

2 participants