Adom Bridge
Public Made by Adomby adom
Adom Bridge unleashes your AI onto your full PC: full power, full safety. The AI breaks out of the container it runs in and onto your real machine, managing and running your entire laptop as you: launch apps, move files, drive any window, control KiCad, Fusion 360 or your real signed-in browser. Works with any AI, cloud or local (Claude Desktop, Claude Code, Codex), no Hydrogen required. Bridge and its bridges are an operating system for AI, with managed Node and Python runtimes, and a human-onl
ws_client: zero backoff on repeated clean closes creates a 20Hz reconnect storm and ~1GB/day log spam when a relay backend is dead behind a live proxy
Type: Bug · ws_client reconnects with backoff=0 forever when the server closes cleanly, producing a ~20Hz reconnect storm and ~1GB/day of log spam
Symptom
Three cloud relay connections in my AD (gallia, AdomPNP, factoryOS) sit in a tight loop, each cycle ~130-160ms:
[15:01:59][app_lib::ws_client][INFO] [gallia] WebSocket connected
[15:01:59][app_lib::ws_client][INFO] [gallia] Authenticated - clientId: unknown
[15:01:59][app_lib::ws_client][INFO] [gallia] Server sent close frame
[15:01:59][app_lib::ws_client][INFO] [gallia] WS closed cleanly after 142.979ms - backoff=0, reconnecting immediately
[15:01:59][app_lib::ws_client][INFO] [gallia] Connecting to wss://drew2-gallia-....adom.cloud/proxy/8765/...
Three relays at ~150ms per cycle is roughly 20 reconnects/sec aggregate. The log wrote 22.9MB in 34 minutes (about 1GB/day pace), hit the rotation cap, and rotated away all history, so I can no longer see when the storm started.
Trigger
The peer endpoints are half-dead: the Cloudflare proxy in front of each accepts the WS upgrade fast (~130ms round trip, HTTP 400 on plain GET as expected for WS-only), but the relay server behind it is gone or mismatched, so auth never yields a clientId ("Authenticated - clientId: unknown") and the server closes immediately. My side; I will fix the backends. But any user with a stale/dead relay entry will reproduce this.
The AD bug
ws_client treats a clean server close as grounds to reconnect immediately with zero backoff, forever. A dead-but-proxied endpoint therefore turns into an infinite tight loop: CPU + network churn, log spam that defeats rotation, and the real history destroyed exactly when you want to debug.
Suggested fix
- Exponential backoff on repeated clean closes: if a connection closes cleanly within N seconds of connecting (i.e. it never did useful work), back off like an error close would: e.g. 1s, 2s, 5s, 15s, 60s cap, with jitter. A close after a healthy long-lived session can keep the fast reconnect.
- Treat "authenticated but no clientId" as auth failure, not success: it currently logs as Authenticated then acts surprised at the close. If no clientId arrives, count it as a failed attempt for backoff purposes.
- Log throttle: collapse repeated identical connect/close cycles into a periodic summary line ("[gallia] 1,240 reconnect cycles in last 60s, backing off"), so rotation stops eating real history.
Environment
AD 1.9.217, Windows laptop adom_drew2, embedded under HD. Main laptop relay unaffected throughout (commands flow normally). Endpoints: drew2-gallia-*.adom.cloud/proxy/8765, drew2-adompnp-*.adom.cloud/proxy/8765, factoryos-relay-*.adom.cloud.
Log excerpts and timing measurements available on request; the loop is trivially reproducible by pointing a relay entry at a proxied host whose backend is down.