You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make mobile auto-reattach instant on a network change that happens while the app stays in the foreground (e.g. Wi-Fi ↔ cellular, without backgrounding).
Background
Auto-reattach shipped in #70 (apps/mobile/App.tsx, apps/mobile/src/connection.ts). It covers the two dominant triggers instantly:
Socket drop — the transport's onClose → reconnect.
Both back off (1s → 15s) and rebind the board + open terminal to the fresh api.
The gap
A network change while the app stays foregrounded isn't caught instantly. We rely on the socket's onClose + the 15s keepalive (connection.ts) to notice. If the flip leaves a half-open socket that never fires a close event, reattach can lag up to ~15s (until the next keepalive ping fails).
This is a secondary case — the keepalive catches it eventually, and the far more common "app-switch" path is already instant via AppState. Filing so it's tracked, not lost.
Proposed fix
Add a network-state change listener that triggers the existing reconnect() immediately when connectivity returns.
expo-network exposes Network.addNetworkStateChangeListener — confirmed not currently installed (apps/mobile/node_modules has neither expo-network nor @react-native-community/netinfo).
Cost: a native dependency → requires an expo prebuild + pod install cycle. That's the reason it was deliberately deferred rather than bundled into would it be possible to create #70 (which added zero native deps).
Acceptance
Toggling Wi-Fi/airplane mode off→on while a task terminal is open reattaches within ~1–2s (not up to 15s).
No new native module beyond the network listener; reuses the existing reconnect() path.
Priority
Low. Add only if the ~15s worst-case lag is felt in practice. See the Clawnify decision doc "Ateam Mobile Connectivity — Decision: SSH-to-any-host vs Tailscale."
Summary
Make mobile auto-reattach instant on a network change that happens while the app stays in the foreground (e.g. Wi-Fi ↔ cellular, without backgrounding).
Background
Auto-reattach shipped in #70 (
apps/mobile/App.tsx,apps/mobile/src/connection.ts). It covers the two dominant triggers instantly:AppStateactive→ probe (Connection.ping()) → reconnect if dead.onClose→ reconnect.Both back off (1s → 15s) and rebind the board + open terminal to the fresh
api.The gap
A network change while the app stays foregrounded isn't caught instantly. We rely on the socket's
onClose+ the 15s keepalive (connection.ts) to notice. If the flip leaves a half-open socket that never fires a close event, reattach can lag up to ~15s (until the next keepalive ping fails).This is a secondary case — the keepalive catches it eventually, and the far more common "app-switch" path is already instant via
AppState. Filing so it's tracked, not lost.Proposed fix
Add a network-state change listener that triggers the existing
reconnect()immediately when connectivity returns.expo-networkexposesNetwork.addNetworkStateChangeListener— confirmed not currently installed (apps/mobile/node_moduleshas neitherexpo-networknor@react-native-community/netinfo).expo prebuild+pod installcycle. That's the reason it was deliberately deferred rather than bundled into would it be possible to create #70 (which added zero native deps).Acceptance
reconnect()path.Priority
Low. Add only if the ~15s worst-case lag is felt in practice. See the Clawnify decision doc "Ateam Mobile Connectivity — Decision: SSH-to-any-host vs Tailscale."