openclaw-windows-node icon indicating copy to clipboard operation
openclaw-windows-node copied to clipboard

Remote gateway node pairing broken — node token scopes empty, approval flow incomplete

Open AS76 opened this issue 5 months ago • 10 comments

Issue: Remote gateway node pairing broken — node token scopes empty, approval flow incomplete

Replaces locked issue #663

Summary

The Windows tray Node Mode can connect to a remote gateway, but the pairing and token scoping flow is broken for remote gateway setups. The feature was described as "already implemented" in #663 which was then locked, but the implementation doesn't work in practice.

Environment

  • Client: OpenClaw Windows Hub v0.6.0 (latest)
  • Gateway: VPS behind reverse proxy (wss:// Traefik + Let's Encrypt)
  • Setup: Node Mode enabled, remote gateway URL + auth token configured

What works

  • Device (operator) connection via wss:// ✅
  • Paired device shows on gateway ✅
  • Control UI session over remote WebSocket ✅

What doesn't work (remote Node Mode)

  1. Node token scopes empty — after device pairing approval, the node token is issued with scopes: [] while the operator token gets proper scopes. The gateway doesn't assign node-appropriate scopes for remote connections.

  2. openclaw nodes approve returns unknown requestId — node-specific pairing requests never appear as pending on the gateway side. The approval flow advertised in the docs doesn't work.

  3. openclaw devices rotate --role node denied — token rotation rejects the node role, so even manually fixing scopes in paired.json doesn't survive rotation.

  4. Tray UI stuck — Windows tray UI stays in "Awaiting approval" state indefinitely even after device approval completes on the gateway.

Use case

Corporate laptop with restricted IT policy, no local gateway possible. A lightweight Windows node client connecting to a remote VPS gateway would enable:

  • exec host=node commands from the remote agent on the Windows machine
  • Local file access without GDrive/workaround
  • Agent availability on the laptop without full gateway installation

Request

Re-open and track the remaining pairing/scoping bugs so remote Node Mode actually works. Happy to provide logs and reproduce on demand.

AS76 avatar Jun 07 '26 08:06 AS76

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 10, 2026, 4:58 AM ET / 08:58 UTC.

Summary Keep open: current main fixes several Windows-client approval, token-handoff, and recovery-UI problems, but the same fresh-pair empty-capability state remains open upstream and the local pairing epic explicitly retains this report as an unfinished child. The unresolved node-token scope and role-rotation behavior crosses a security boundary and still needs coordinated gateway ownership plus current remote-gateway proof.

Reproducibility: yes. at source and report level: remote Windows, local loopback, and upstream gateway reports demonstrate paired or connected fresh nodes with pending approval and empty effective capabilities. A matched current-main Windows-to-external-gateway run is still required to verify the eventual fix.

Next step Maintainers must settle the cross-repository authorization boundary and coordinate gateway plus Windows live validation; this is not safe for an autonomous single-repository fix PR.

Maintainer decision needed

  • Question: Should node-role token scopes and node-role rotation be owned exclusively by the upstream gateway while this repository limits its fix to precise diagnostics, recovery UX, and cross-repository end-to-end proof?
  • Rationale: The Windows client consumes gateway-issued authorization and must not self-grant scopes, but maintainers need to define the permanent gateway/client ownership boundary and coordinated acceptance test.
  • Likely owner: ranjeshj — Their merged history most directly covers the node/device approval distinction and Windows-client pairing hardening that defines this boundary.
  • Options:
    • Gateway contract plus client UX (recommended): Fix token issuance and node-role rotation upstream, then add only state-specific recovery guidance and live cross-repository proof here.
    • Approved compatibility fallback: Add a narrowly scoped Windows compatibility path only if maintainers determine that supported older gateways cannot provide the required role-token behavior.

Security Needs attention: The remaining work crosses gateway-issued scoped-token and explicit remote-execution approval boundaries.

Review details

Best possible solution:

Keep this issue as the detailed child acceptance case, repair node-role token issuance and rotation in the upstream gateway, retain explicit command-trust approval, and close only after a current Windows companion plus current remote gateway proves scoped durable tokens, clear approval/repair UI, and a successful node invocation.

Do we have a high-confidence way to reproduce the issue?

Yes at source and report level: remote Windows, local loopback, and upstream gateway reports demonstrate paired or connected fresh nodes with pending approval and empty effective capabilities. A matched current-main Windows-to-external-gateway run is still required to verify the eventual fix.

Is this the best way to solve the issue?

No, a Windows-only patch is not the complete solution. The maintainable path is to preserve explicit trust approval, repair gateway-issued node token and rotation semantics upstream, and make the Windows UI distinguish role approval, command trust, token mismatch, and zero-capability states.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • The unresolved gateway behavior controls authorization for remote Windows execution; a client-only workaround must not invent scopes or bypass explicit node command trust.
  • Closing this detailed child would risk losing its node-token scope, node-role rotation, and external remote-gateway acceptance criteria inside the broader tracking epic.
  • Current main has newer credential and connection-state changes than release v0.6.12, so final verification must use matched current gateway and Windows companion versions rather than assuming release behavior.

Codex review notes: model internal, reasoning high; reviewed against 8a9e35142d49.

Label changes

Label changes:

  • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
  • add clawsweeper:source-repro: Current issue advisory state selects this label.
  • remove clawsweeper:fix-shape-clear: Current issue advisory state no longer selects this label.
  • remove issue-rating: 🐚 platinum hermit: Current issue advisory state no longer selects this label.
  • remove clawsweeper:needs-live-repro: Current issue advisory state no longer selects this label.

Label justifications:

  • P1: Pairing can leave an enabled Windows node unusable with zero effective capabilities in demonstrated local and remote setups.
  • impact:security: The issue concerns scoped role tokens and explicit approval boundaries authorizing remote node capabilities and execution.
  • impact:auth-provider: The failure involves node-role token issuance, scope claims, credential persistence, and role-specific rotation.
  • impact:ux-friction: The UI can report connected and node-active states while recovery requires separate CLI approvals, logs, and credential-state investigation.
Evidence reviewed

Security concerns:

  • [high] Preserve gateway-issued node authorization A repair must not let the Windows client manufacture missing scopes, silently downgrade credentials, or bypass the separate node command-trust approval required before remote commands become effective. Confidence: 0.96

What I checked:

Likely related people:

  • ranjeshj: Authored merged work distinguishing node and device approval APIs and later hardened Windows pairing, scope requests, response handling, and role-token handoff. (role: pairing-flow contributor; confidence: high; commits: 6eb18a6cdcdd, ea36b12f9e4c; files: src/OpenClaw.Connection/GatewayConnectionManager.cs, src/OpenClaw.Shared/OpenClawGatewayClient.cs)
  • Barbara Kudiess: Authored the latest current-main changes to multi-gateway credential handling and connection snapshot truth in the central affected paths. (role: recent area contributor; confidence: high; commits: 5a181504336b, 74604aebafef; files: src/OpenClaw.Connection/GatewayConnectionManager.cs, src/OpenClaw.Tray.WinUI/Pages/ConnectionPagePlan.cs)
  • vincentkoc: Authored bootstrap reconnect, signature compatibility, and stale token recovery work with live gateway/node validation. (role: bootstrap pairing contributor; confidence: medium; commits: 64b650cb3313; files: src/OpenClaw.Connection/GatewayConnectionManager.cs, src/OpenClaw.Shared/OpenClawGatewayClient.cs)
  • Jason (Json): Introduced Command Center visibility for pending node reapproval, directly relating to the reported zero-capability recovery experience. (role: reapproval UX contributor; confidence: medium; commits: cb68abf8e75e; files: src/OpenClaw.Tray.WinUI/Pages/ConnectionPagePlan.cs)
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-review comments, 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-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

clawsweeper[bot] avatar Jun 07 '26 08:06 clawsweeper[bot]

Live reproduction — screenshots attached

Here are the screenshots from OpenClaw Windows Companion v2026.6.1 connected to a remote gateway:

Evidence

Screenshot 1 — Connection overview:

  • "Node active · 0 capabilities" / "Providing no capabilities"
  • Operator: "Active · no current sessions"
  • Gateway connected via wss://[redacted]/ (remote VPS, not local)

Screenshot 2 — Full view:

  • Same connection from overview + gateways list
  • Node mode confirmed active but providing zero capabilities
  • Device registered as operator but node role has no functional scopes

image

Summary

Item Expected Actual
Node mode ON Tool execution, file access 0 capabilities, nothing provided
Role: Node Scopes for node operations Empty scopes (confirmed via paired.json)
nodes approve Match node pairing requests Returns unknown requestId
Token rotation Rotate with --role node Denied for node role

Happy to provide gateway logs or paired.json excerpts (with tokens redacted) on request.

AS76 avatar Jun 07 '26 09:06 AS76

Image

AS76 avatar Jun 07 '26 09:06 AS76

Image

AS76 avatar Jun 07 '26 09:06 AS76

I can reproduce a closely related approval/token/capability-registration issue in a fully local loopback setup.

Unlike the remote gateway setup in #710, this does not require a VPS, reverse proxy, or public wss:// endpoint. The Gateway is running locally in WSL on the same Windows machine, and the Windows Companion connects to ws://127.0.0.1:18789.

This suggests the same approval/token state-machine problem can also affect the default/local Windows + WSL setup. I also have a concrete recovery path from this machine.

Environment

  • OpenClaw Windows Companion: v2026.6.1
  • Companion app/node version: 0.6.3
  • Gateway: OpenClaw v2026.6.1, running in local WSL on the same Windows machine
  • Gateway URL used by Companion: ws://127.0.0.1:18789
  • Windows user: Administrator
  • Windows build reported by device.info: Microsoft Windows 10.0.26220
  • Companion identity file:
    • %APPDATA%\OpenClawTray\gateways\<gateway-id>\device-key-ed25519.json
  • Gateway state files involved:
    • ~/.openclaw/devices/paired.json
    • ~/.openclaw/nodes/paired.json

Loopback connectivity was already working:

curl.exe http://127.0.0.1:18789/
Test-NetConnection 127.0.0.1 -Port 18789

So this was not a port/firewall issue.

Symptoms

Windows Companion UI showed:

  • Gateway connected
  • operator online
  • node mode enabled
  • Node active
  • System tools / Browser control / Camera toggles enabled
  • but node activity still showed 0 capabilities

Gateway initially showed the Windows node as paired but disconnected, or later connected with no caps/commands:

{
  "clientId": "node-host",
  "clientMode": "node",
  "caps": [],
  "commands": [],
  "paired": true,
  "connected": true
}

Trying to invoke a node command failed with:

nodes invoke failed: GatewayClientRequestError: node command not allowed: the node did not declare any supported commands

Evidence

Gateway logs showed repeated auth/repair paths:

unauthorized ... role=node ... reason=device_token_mismatch
device access upgrade requested reason=role-upgrade ... roleFrom=operator roleTo=node ... client=node-host
device metadata upgrade requested reason=metadata-upgrade ... client=cli

Companion logs showed that the Windows node did build and send capabilities:

Capabilities registered: system, canvas, screen, camera, location, tts, stt, device, browser (9 caps)
[NodeService] AttachClient DONE: client.Registration.Capabilities=9, client.Registration.Commands=29

[HANDSHAKE] role=node, clientId=node-host, mode=node
[HANDSHAKE] caps=9: [system, canvas, screen, camera, location, tts, stt, device, browser]
[HANDSHAKE] commands=29: [...]
[HANDSHAKE] isBootstrap=False, hasNodeDeviceToken=True
Node registered successfully!
Node status: Connected

But openclaw nodes status --json still showed caps=[] / commands=[] until the separate node capability approval was completed.

What fixed it

The working recovery required three separate pieces to line up:

  1. Device/operator approval:
openclaw devices approve <operator-request-id>
  1. Device/node role approval:
openclaw devices approve <node-role-request-id>
  1. Node capability approval:
openclaw nodes pending --json
openclaw nodes approve <node-capability-request-id>

In this case, nodes pending contained the actual capability surface:

{
  "caps": [
    "system",
    "canvas",
    "screen",
    "camera",
    "location",
    "tts",
    "stt",
    "device",
    "browser"
  ],
  "commands": [
    "system.notify",
    "system.run",
    "system.run.prepare",
    "system.which",
    "canvas.present",
    "canvas.hide",
    "canvas.navigate",
    "canvas.eval",
    "canvas.snapshot",
    "canvas.a2ui.push",
    "canvas.a2ui.pushJSONL",
    "canvas.a2ui.reset",
    "screen.snapshot",
    "camera.list",
    "location.get",
    "tts.speak",
    "stt.transcribe",
    "device.info",
    "device.status",
    "browser.proxy"
  ]
}

Also, the Companion local identity could drift from the Gateway state. In my case I had to verify/sync:

DeviceToken      <-> ~/.openclaw/devices/paired.json[deviceId].tokens.operator.token
NodeDeviceToken  <-> ~/.openclaw/devices/paired.json[deviceId].tokens.node.token

After approving the node capability request, nodes status showed:

{
  "clientId": "node-host",
  "clientMode": "node",
  "caps": [
    "browser",
    "camera",
    "canvas",
    "device",
    "location",
    "screen",
    "stt",
    "system",
    "tts"
  ],
  "commands": [
    "browser.proxy",
    "camera.list",
    "canvas.a2ui.push",
    "canvas.a2ui.pushJSONL",
    "canvas.a2ui.reset",
    "canvas.eval",
    "canvas.hide",
    "canvas.navigate",
    "canvas.present",
    "canvas.snapshot",
    "device.info",
    "device.status",
    "location.get",
    "screen.snapshot",
    "stt.transcribe",
    "system.notify",
    "system.run",
    "system.run.prepare",
    "system.which",
    "tts.speak"
  ],
  "paired": true,
  "connected": true
}

And this succeeded:

openclaw nodes invoke --node <device-id> --command device.info --params '{}' --json

UX issue

From a user perspective this flow is extremely hard to understand.

The UI can show "Connected", "Node active", and enabled permission toggles, while the Gateway still exposes 0 capabilities. The missing step is not obvious because devices approve and nodes approve are separate approval paths.

The Companion should either guide the user through all required approvals, or show a clear state such as:

Node capabilities approval pending
Run: openclaw nodes approve <request-id>

It would also help if the UI distinguished:

  • operator/device approval pending
  • node role approval pending
  • node capability approval pending
  • token mismatch / repair required

Right now all of these can look like "Connected / Node active / 0 capabilities", which is very hard to recover from without inspecting logs and Gateway state manually.

Suggested local-loopback behavior

For the local WSL Gateway + Windows Companion case, it would be much better if the app exposed this as one trusted local-node approval flow instead of several separate hidden approval paths.

Possible fixes:

  • Auto-approve the Companion's own local node role/capability request when the Gateway is local loopback and the operator has already approved the same local device.
  • Or show a single "Approve local Windows node" action that performs both the node role approval and the node capability approval.
  • If auto-approval is not acceptable, the UI should at least surface the exact pending request and command, for example:
Node capabilities approval pending
Run: openclaw nodes approve <request-id>

This seems related to previous fixes in the same area, especially #382 (node.pair.approve vs device.pair.approve causing 0 effective commands), #461 (capability binding diagnostics), #587 (stale token mismatch recovery), and #616 (clearer reconnect/startup state).

sorry123luck avatar Jun 09 '26 05:06 sorry123luck

This looks less like a remote-only wss:// problem and more like a role/capability state-machine gap that shows up in both remote gateway and local loopback paths.

A small maintainer-facing verification checklist that may reduce the repro ambiguity:

  • Compare issued token claims for operator vs node immediately after pairing approval; the node path should not end with scopes: [] after a role-specific approval.
  • Verify that openclaw nodes approve and tray pairing are writing/reading pending request IDs from the same gateway identity namespace.
  • Add a local loopback regression case using ws://127.0.0.1:18789, since the later WSL repro suggests the bug can happen without reverse proxy or VPS variables.
  • On devices rotate --role node, assert that role=node is preserved or rejected with an explicit reason rather than silently reverting to a no-capability state.
  • In the tray UI, treat "paired but 0 capabilities" as a token/scope failure state, not just "Awaiting approval".

No private logs are needed for that checklist; it can be validated against the public repro details already posted in this thread.

maxim-ultra avatar Jun 09 '26 06:06 maxim-ultra

Update from #741:

#741 partially addresses the Windows-client side of this issue:

  • shared-token operator connects request operator.pairing alongside admin so pairing-management methods are reachable;

ode.pair.approve and device.pair.approve now wait for gateway responses instead of treating a sent frame as success;

  • node-pair approval falls back to device.pair.approve only when the operator has admin authority, matching the documented distinction between gateway-owned node trust and WebSocket device pairing;
  • diagnostics now distinguish missing pairing/admin authority from generic approval failure;
  • node-token receipt from the Windows node client is surfaced to the connection manager so bootstrap cleanup waits for durable node + operator role tokens.

Still pending / not covered by #741:

  • reported empty node token scopes, node-role rotation denial, and remote VPS/reverse-proxy behavior appear gateway-side or live-remote-environment dependent from the current evidence;
  • true external wss:// / Tailscale/Funnel live validation remains lower-confidence and was not claimed as fixed by #741.

So this issue is improved but should remain open until the remote gateway/node-scope behavior is reproduced and resolved.

ranjeshj avatar Jun 10 '26 19:06 ranjeshj


[!NOTE] The pull request was not created — a fallback review issue was created instead due to protected file changes: #754

🤖 This is an automated response from Repo Assist.

PR #741 ("Harden gateway connection and pairing flows") was merged on 2026-06-12 and addresses several Windows-client-side aspects of this issue:

What #741 covers:

  • Scoping fix: "request and handle pairing scopes correctly, including response-aware node/device approval and admin-gated fallback" — targets the empty scopes: [] on the Windows client's pairing handshake
  • Stuck UI fix: "prevent stale node clients from mutating current state and abort node handshakes when capability registration fails" — directly addresses the "Awaiting approval" stuck state
  • Token forwarding: "forward node device-token receipt from WindowsNodeClient through NodeConnector so bootstrap cleanup can complete after node reconnect" — improves token persistence after reconnect

What still needs gateway-side work:

  • openclaw nodes approve returning unknown requestId — the node pairing request approval is a gateway-side flow; the client can't fix this alone
  • Token rotation denying the node role (devices rotate --role node) — gateway policy on role assignment
  • The node token being issued with scopes: [] may still happen if the gateway is not updated; the #741 changes improve client-side scope handling but can't override what the gateway grants

If you're on a gateway version prior to 2026.6.x, upgrading the gateway alongside updating the Windows companion should be the first troubleshooting step.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@97143ac59cb3a13ef2a77581f929f06719c7402a

github-actions[bot] avatar Jun 13 '26 01:06 github-actions[bot]

This issue has been automatically marked as stale due to inactivity. Please add updated OpenClaw Windows details or it will be closed.

github-actions[bot] avatar Jul 25 '26 04:07 github-actions[bot]

Thanks for the detailed report. The investigation now separates expected authorization behavior from the actionable Windows pairing failure.

Node device tokens intentionally have scopes: []; device and node approvals use separate request IDs; non-admin node-role rotation is denied; and commands remain hidden until node command trust is approved. Those observations are not standalone defects.

The Windows bootstrap, approval, durable-token, capability-binding, and reconnect problems were addressed by PR #741 and first shipped in v0.6.11.

We’re closing this as completed by that fix. If the remote-WSS flow still fails on v0.6.11 or later, please follow up with the current device approval request ID, node approval request ID, Windows connection diagnostics, and Gateway version. Do not include tokens or credentials.

bkudiess avatar Jul 30 '26 00:07 bkudiess