Skip to content

Refresh Connect status when realtime connectivity recovers - #4273

Merged
SawyerHood merged 2 commits into
mainfrom
slopcop/issue-4272
Oct 5, 2026
Merged

SawyerHood merged 2 commits into
mainfrom
slopcop/issue-4272

Conversation

@bb-slop-cop

@bb-slop-cop bb-slop-cop Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · new-issue-autopilot

Human comments

What was wrong

Connect settings fetched remote-access status once on mount, then relied only on realtime pushes. useRealtime doesn't replay signals that arrive while the browser's realtime socket is down. When the app is opened through Connect, that socket runs over the same tunnel that just dropped, so the status change that follows a reconnect can be missed. The page then keeps showing a stale status, or a stale initial load error, until it's reloaded. Reproduction and root-cause report.

What changed

  • plugins/connect/app.tsx: the shared useConnectStatus hook (used by Connect settings and Mobile pairing) watches useRealtimeConnectionState() and refetches status whenever the state changes back to connected. The mount fetch stays as is: there is no extra request when the page mounts already connected, and none when connectivity is lost.
  • The reconnect fetch can overlap an earlier fetch, so a response from a superseded request is now ignored. Otherwise a late failure or older status from the earlier request could replace the newer result.
  • plugins/connect/app.test.tsx: regression tests for repeated reconnects, recovery from an initial load error, and a superseded load that settles late.
  • Rebased onto current main. main had moved the status logic into useConnectStatus; the fix now lives there and covers both consumers. No wire, CLI, or SDK changes.

How you verified

  • The three new tests fail against main's plugins/connect/app.tsx and pass with this change. The superseded-load test also failed on the original PR code without the request guard ("Failed to load…" replaced "Connected").
  • pnpm exec turbo run test typecheck lint --filter=bb-plugin-connect: 138 tests passed; typecheck and lint are clean.
  • Isolated source dev app (fresh store, loopback only, headless Chromium over CDP), on /settings/plugins/connect: I closed the app's realtime socket (/ws), leaving Vite HMR alone so the page didn't reload, and let the app reconnect on its own. With this change, the reconnect issued 1 new Connect status RPC. With main's app.tsx, it issued 0. In both runs, the new socket reconnected without a page navigation. This simulates a dropped realtime socket; it doesn't interrupt a live Connect tunnel.

Fixes #4272

AGENT GENERATED

SawyerHood and others added 2 commits October 5, 2026 11:15
A reconnect refetch can race the mount fetch; a late failure or older
status must not replace the newer result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SawyerHood
SawyerHood merged commit 66f7ea2 into main Oct 5, 2026
34 checks passed
@SawyerHood
SawyerHood deleted the slopcop/issue-4272 branch October 5, 2026 18:55
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.

Connect settings page shows stale status after tunnel reconnect (no refetch on realtime reconnect)

1 participant