fix(rig-bridge): stop auth retry storm and rate-limit server log warnings#1041
Conversation
…ings When rig-bridge holds a stale session token (e.g. after a server restart invalidates the token store), two retry loops caused continuous log spam: - pushState() fired every 2 s and kept retrying on 401 - longPollCommands() retried every 1 s on any non-200 response, including 401 Server-side: requireRelayAuth now rate-limits logWarn to once per 5 minutes per sessionId instead of logging every rejected request. MeshCom ingest warnings are similarly throttled to once per minute per subtype. Client-side (cloud-relay.js): a shared handleCredentialsInvalid() helper permanently stops both the push timer and the long-poll loop on a 401/403 response, logging once and instructing the user to re-run Connect Cloud Relay. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Couple of small things noticed during review, neither blocking, both are follow-up-able whenever you feel like it: The The other one is just messaging. The error tells the user to "re-run Connect Cloud Relay in OHC Settings" but in practice they also need to restart rig-bridge for the new credentials to actually take effect, since the old token is still in memory and |
* fix(rig-bridge): stop auth retry storm and rate-limit server log warnings When rig-bridge holds a stale session token (e.g. after a server restart invalidates the token store), two retry loops caused continuous log spam: - pushState() fired every 2 s and kept retrying on 401 - longPollCommands() retried every 1 s on any non-200 response, including 401 Server-side: requireRelayAuth now rate-limits logWarn to once per 5 minutes per sessionId instead of logging every rejected request. MeshCom ingest warnings are similarly throttled to once per minute per subtype. Client-side (cloud-relay.js): a shared handleCredentialsInvalid() helper permanently stops both the push timer and the long-poll loop on a 401/403 response, logging once and instructing the user to re-run Connect Cloud Relay. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(rig-bridge): bump version to 2.2.1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(rig-bridge): address PR review feedback - Prune authWarnLastLogged entries in the existing 5-minute cleanup interval (entries older than 2× AUTH_WARN_INTERVAL) so the map doesn't grow unboundedly when clients cycle through many bad sessionIds - Add "then restart rig-bridge" to the credentials-invalid error message since credentialsInvalid stays set for the life of the process and clicking Connect Cloud Relay alone is not enough to resume the relay Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
plugins/cloud-relay.js): on a 401/403 response, a newhandleCredentialsInvalid()helper permanently stops both the push timer and the long-poll loop, logging once with a clear action for the user. Previously,pushStatekept retrying every 2 s andlongPollCommandsretried every 1 s on any non-200 — flooding the server log at ~1 warn/s indefinitely.server/routes/rig-bridge.js):requireRelayAuthnow rate-limitslogWarnto once per 5 minutes per sessionId. MeshCom ingest failure warnings are similarly throttled to once per minute per subtype.Test plan
🤖 Generated with Claude Code