Gateway: fix device pairing when local connection retries with existing non-silent pending request#3744
Gateway: fix device pairing when local connection retries with existing non-silent pending request#3744photon3710 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
- Added a fix for device pairing rejection during local connection retries in the CHANGELOG. - Included guidance for Docker configuration to bypass device pairing in the installation documentation, detailing the necessary JSON configuration for the Control UI.
| image: ${MOLTBOT_IMAGE:-moltbot:local} | ||
| environment: |
There was a problem hiding this comment.
[P0] docker-setup.sh/docs still export CLAWDBOT_* env vars, but this compose file was switched to MOLTBOT_* names.
As-is, the documented ./docker-setup.sh flow won’t populate ${MOLTBOT_IMAGE} / ${MOLTBOT_GATEWAY_TOKEN} / ${MOLTBOT_CONFIG_DIR} etc., which can lead to empty volume mounts and missing tokens at runtime.
Also appears in docker-compose.yml:7-14,16-28,32,41-42 and is referenced by docs/install/docker.md:35-57 + docker-setup.sh:7,24-33,35-47 (still uses CLAWDBOT_*).
Prompt To Fix With AI
This is a comment left during a code review.
Path: docker-compose.yml
Line: 3:4
Comment:
[P0] `docker-setup.sh`/docs still export `CLAWDBOT_*` env vars, but this compose file was switched to `MOLTBOT_*` names.
As-is, the documented `./docker-setup.sh` flow won’t populate `${MOLTBOT_IMAGE}` / `${MOLTBOT_GATEWAY_TOKEN}` / `${MOLTBOT_CONFIG_DIR}` etc., which can lead to empty volume mounts and missing tokens at runtime.
Also appears in `docker-compose.yml:7-14,16-28,32,41-42` and is referenced by `docs/install/docker.md:35-57` + `docker-setup.sh:7,24-33,35-47` (still uses `CLAWDBOT_*`).
How can I resolve this? If you propose a fix, please make it concise.| - ${MOLTBOT_CONFIG_DIR}:/home/node/.moltbot | ||
| - ${MOLTBOT_WORKSPACE_DIR}:/home/node/moltbot |
There was a problem hiding this comment.
[P1] This service mounts ${MOLTBOT_CONFIG_DIR} / ${MOLTBOT_WORKSPACE_DIR} without defaults, unlike moltbot-gateway.
If users follow the “Quick start” (./docker-setup.sh) or don’t define these vars, docker compose will treat them as empty and fail (invalid spec: :/home/node/.moltbot) or mount an unintended path. Consider adding the same defaults here (or keep variable names consistent with the setup script).
Prompt To Fix With AI
This is a comment left during a code review.
Path: docker-compose.yml
Line: 41:42
Comment:
[P1] This service mounts `${MOLTBOT_CONFIG_DIR}` / `${MOLTBOT_WORKSPACE_DIR}` without defaults, unlike `moltbot-gateway`.
If users follow the “Quick start” (`./docker-setup.sh`) or don’t define these vars, `docker compose` will treat them as empty and fail (`invalid spec: :/home/node/.moltbot`) or mount an unintended path. Consider adding the same defaults here (or keep variable names consistent with the setup script).
How can I resolve this? If you propose a fix, please make it concise.bfc1ccb to
f92900f
Compare
Summary
Fixes a bug where the Control UI dashboard fails to connect with "pairing required" error when a browser reconnects after a failed pairing attempt.
Problem
When a browser connects to the dashboard (e.g.,
http://127.0.0.1:18789/?token=...), if there's already a pending pairing request withsilent: falsefrom a previous connection attempt, subsequent local connection retries would fail because:requestDevicePairing()returns the existing pending request unchangedsilent: false, preventing auto-approvalThis commonly occurs in Docker setups where the initial connection may not be detected as local due to Docker bridge network addressing.
Solution
Update
requestDevicePairing()to upgrade existing pending requests tosilent: truewhen a new local connection retries. This allows auto-approval to proceed even if the original request was non-silent.Changes
src/infra/device-pairing.ts- Check if new request issilent: trueand update existing pending requestsrc/infra/device-pairing.test.ts- Add test case for silent flag upgrade behaviordocs/gateway/pairing.md- Document the silent flag upgrade behaviordocs/install/docker.md- Add Docker configuration guidance for Control UI accessTesting
docker compose run --rm moltbot-cli dashboardAI-Assisted
Related
Addresses the "pairing required" error commonly seen in Docker deployments when accessing the Control UI dashboard.
Greptile Overview
Greptile Summary
This PR fixes a gateway pairing edge case by upgrading an existing pending pairing request to
silent: truewhen a retry comes from a local connection, enabling auto-approval to proceed. It adds a unit test covering the silent-flag upgrade path and updates Docker install docs / compose defaults to help users avoid “pairing required” issues in common Docker bridge setups.Confidence Score: 2/5
docker-setup.sh/docs environment variable contract (CLAWDBOT_* vs MOLTBOT_*), which can break the documented onboarding flow and lead to missing tokens or invalid mounts.(2/5) Greptile learns from your feedback when you react with thumbs up/down!