Feature: warn and guide migration of paired nodes when Gateway bind changes to loopback
Problem
Changing an existing LAN Gateway to a loopback bind for trusted-proxy, per-person access left a previously paired ESP node disconnected. The Gateway and browser UI were healthy and the device remained paired, but its saved endpoint still pointed at the former LAN listener. The setup path did not make this impact or an endpoint migration path clear.
Environment
- Gateway: OpenClaw 2026.11.2 (b556fdf), Linux, Node 26.13.
- ESP32 node: ESP-IDF 5.4.2; existing paired
role=nodedevice with a saved LAN WebSocket endpoint and device token. - Gateway changed from LAN reachable on port 18789 to
gateway.bind: loopback, with same-host trusted-proxy ingress and per-person roles. - Browser HTTPS terminates at Caddy. Addresses, identities, tokens and device IDs are intentionally omitted.
Observed sequence and evidence
- After loopback cutover, the Gateway listened on loopback; the node appeared paired but disconnected.
- A temporary passive LAN listener on the former endpoint observed the device retrying a WebSocket upgrade about once per second:
GET / HTTP/1.1
Connection: Upgrade
User-Agent: ESP32 Websocket Client
Upgrade: websocket
- Installed Gateway code and pairing metadata indicated that this node's existing device token did not have the shared-gateway-auth issuer generation; a stale issuer was not demonstrated. The device's stored endpoint had become unreachable.
- Restoring a LAN proxy listener on the previous endpoint made the node reconnect using its existing credential, without re-pairing or injecting a person identity. A signed node handshake with an invalid token was rejected with
AUTH_DEVICE_TOKEN_MISMATCH; a spoofed forwarded-user header was stripped and an operator attempt was rejected. After a proxy restart, the node automatically reconnected and its uptime continued increasing. - A
device.statusinvocation succeeded and an AHT20 read returned temperature and humidity. The browser route returned 401 anonymously and 200 for configured family credentials.
This is a single live installation observation; it has not yet been independently reproduced with an isolated synthetic Gateway and node. It does not establish a device-token authentication bug.
Workaround and limitation
A same-host Caddy listener bound to the previous LAN IP/port forwards to the loopback Gateway, removes incoming user identity headers, and forwards client attribution. It restored the already paired node. This workaround uses plaintext ws:// on the LAN and lacks an independent proxy-side access control on that listener. It is not proposed as a recommended secure topology; the trusted-proxy documentation advises protecting proxy routes. A secured WSS migration remains to be verified.
Request
When setup or configuration changes a Gateway bind/ingress, inventory paired and recently connected nodes, warn that previously reachable endpoints may disappear, and provide a supported migration/recovery path before applying the change. Ideally verify node reconnect and preserve device identity where possible. Clarify supported human trusted-proxy and machine device-token topologies and secure ingress requirements.
Potential test: in an isolated Gateway, pair a synthetic node to the LAN endpoint, change to loopback/trusted-proxy, assert that preflight reports the affected endpoint, and verify a documented protected replacement allows reconnect without broadening operator access.
Related, but different client/topology: #190474. No credentials or private device details are included.
Codex review: this still needs some work.
Summary Keep open: current setup lacks the requested paired-node migration preflight, and the same author’s open ESP companion issue remains unresolved.
Reproducibility: Source confirms loopback removes direct LAN reachability and the inspected configuration path lacks the requested node migration preflight; no live reproduction or authentication defect is claimed.
Maintainer decision needed
- Question: Should Gateway reconfiguration warn about known remote nodes and guide manual migration, or also orchestrate endpoint migration and reconnect verification?
- Recommendation: Add advisory preflight and guidance: Show known remote nodes before reachability-changing configuration and explain protected replacement ingress and client-specific endpoint updates without promising automatic migration.
- Why: Current setup and Doctor checks do not define a migration contract, and paired status alone cannot establish a node’s saved endpoint or supported provisioning operations.
Next step Decide the Gateway-side warning scope alongside https://github.com/openclaw/esp-openclaw-node/issues/236 before designing automated migration.
Security None.
Review details
Best possible solution:
Provide an advisory setup warning and a protected migration guide, coordinating client-specific provisioning with the ESP companion issue.
Do we have a high-confidence way to reproduce the issue?
Source confirms loopback removes direct LAN reachability and the inspected configuration path lacks the requested node migration preflight; no live reproduction or authentication defect is claimed.
Is this the best way to solve the issue?
An advisory warning and protected recovery documentation are the smallest useful first step; automatic migration requires a separate client capability and recovery contract.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
- The Gateway can inventory known nodes but cannot infer every client’s saved endpoint or private-CA provisioning capabilities.
- The reported installation and secure replacement ingress have not been independently exercised on current main.
Codex review notes: model internal, reasoning medium; reviewed against 1d72ad079047.
Label changes
Label changes:
No label changes.
Label justifications:
P2: This affects deliberate advanced ingress reconfiguration with limited scope and a reported recovery, rather than a general onboarding outage.impact:ux-friction: A healthy Gateway can obscure disconnected nodes, and setup does not explain their endpoint migration.
Evidence reviewed
What I checked:
- Configuration lacks node migration preflight: promptGatewayConfig presents bind choices and returns the new Gateway configuration without reading paired-node inventory or checking replacement connectivity. (
src/commands/configure.gateway.ts:46, 1d72ad079047) - Gateway health does not prove node connectivity: The configure wizard checks the local Gateway WebSocket and reports Gateway reachability; this does not verify previously connected remote nodes. (
src/commands/configure.wizard.ts:664, 1d72ad079047) - Existing Doctor coverage is narrower: Doctor checks configured node-hosting intent and missing onboarding ingress; its function accepts configuration alone, without previous bind state or paired-node inventory. Tests cover these configuration warnings rather than endpoint migration. (
src/commands/doctor-node-hosting-preconditions.ts:85, 1d72ad079047) - Loopback behavior matches the reported transport failure: The explicit loopback bind resolves to 127.0.0.1, removing direct LAN reachability rather than changing the node’s saved endpoint. (
src/gateway/net.ts:244, 1d72ad079047) - Protected ingress is an existing requirement: The trusted-proxy guide requires proxy enforcement for HTTP and WebSocket routes and explicitly warns against an unprotected node route: https://docs.openclaw.ai/gateway/trusted-proxy-auth. (
docs/gateway/trusted-proxy-auth.md:499, 1d72ad079047) - Unresolved same-author companion: https://github.com/openclaw/esp-openclaw-node/issues/236 remains open and explicitly pairs client-side private-CA provisioning, endpoint migration, and rollback with this Gateway-side request; its deployed firmware is locally customized.
How this review workflow works
- ClawSweeper keeps one durable marker-backed review comment per issue or PR.
- Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
- A fresh review can be triggered by eligible
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch. - PR/issue authors and users with repository write access can comment
@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only. - Maintainers can also comment
@clawsweeper reviewto request a fresh review only. - Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
- Maintainers can comment
@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.
Reviewed November 11, 2026, 11:50 AM ET / 16:50 UTC.