fix: stop OpenClawX Node token_missing reconnect storm on gateway restart#109
Merged
Conversation
- Add openclaw.json config file as 3rd fallback in _readGatewayToken() so the node always finds the gateway auth token even when dashboardUrl was cleared before a gateway restart (root cause of token_missing loop) - Fix reconnect backoff: remove _reconnectAttempt = 0 from _doConnect() so the exponential backoff actually grows when auth keeps failing; reset only on successful authenticated connection via resetReconnectAttempt() Agent-Logs-Url: https://github.com/mithun50/openclaw-termux/sessions/2f5ef8ee-b8bf-4ee1-ab15-ba2a1603670c Co-authored-by: mithun50 <[email protected]>
mithun50
approved these changes
Apr 5, 2026
…ugging Agent-Logs-Url: https://github.com/mithun50/openclaw-termux/sessions/2f5ef8ee-b8bf-4ee1-ab15-ba2a1603670c Co-authored-by: mithun50 <[email protected]>
Copilot
AI
changed the title
[WIP] Fix warning issue after updating to OpenClaw 2026.4.1
fix: stop OpenClawX Node token_missing reconnect storm on gateway restart
Apr 5, 2026
Build SuccessfulVersion: Download APKs
Built from de96904 by GitHub Actions |
Owner
|
@copilot do smallest version bump |
mithun50
approved these changes
Apr 5, 2026
Contributor
Author
Done in commit |
mithun50
approved these changes
Apr 5, 2026
mithun50
marked this pull request as ready for review
April 5, 2026 08:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After updating to 2026.4.1, the OpenClawX Node component hammers the gateway with unauthenticated connections at near-350ms intervals, flooding logs with
reason=token_missingwarnings fromclient=OpenClawX Node remote=127.0.0.1.Two independent bugs compound to cause this:
1. Token resolution misses the config file (root cause of
token_missing)NodeService._readGatewayToken()only checkedprefs.nodeGatewayTokenandprefs.dashboardUrl.GatewayService.start()nulls outdashboardUrlbefore restarting the gateway — so any Node connect attempt during startup finds no token and sends an unauthenticated frame.Added
openclaw.jsonas a third fallback, consistent withGatewayService._readTokenFromConfig()which already treats it as the source of truth:2. Reconnect backoff always restarted from base delay (keeps the storm alive)
NodeWsService._doConnect()reset_reconnectAttempt = 0on every successful TCP handshake. Since the gateway accepts the TCP connection then rejects auth and closes the socket, the attempt counter never grew — the exponential backoff (base 350ms, cap 8s) was permanently stuck at 350ms.Removed the reset from
_doConnect(). AddedresetReconnectAttempt()and call it only fromNodeService._onConnected()— after the gateway has accepted the full authenticated handshake. Fresh explicitconnect()calls still reset to 0.