Skip to content

Missing deviceToken #81

Closed
Closed

Description

@andyeskridge

Apologies for creating a PR before creating an issue. This issue is resolved by #80. I was getting everything working on my machine and ended up with code changes that got everything working before I put up an issue.

Summary

After approving a Windows WS node, the gateway accepts the node connection and the node works normally, but hello-ok does not include auth.deviceToken.

This appears inconsistent with the documented pairing/token flow, where an approved device is expected to receive a device token in the handshake response so the client can persist it locally.

Expected behavior

After a previously unpaired device is approved, the next successful connect / hello-ok response should include:

auth.deviceToken

so the client can store the device token for future reconnects.

Actual behavior

After approval:

  • the node reconnects successfully
  • hello-ok is returned
  • node commands work normally
  • but auth.deviceToken is absent

This leaves the client without a local persisted device token even though the gateway considers the node approved and connected.

Evidence

With the current tray build, the gateway returns hello-ok and the node reaches Connected, but the tray still marks the node as pending approval only because no local deviceToken is present:

[2026-03-20 12:50:51.839] [DEBUG] [NODE RX] {"type":"res","id":"b36136ab-3f27-43a5-b3b6-3a88d39a2a29","ok":true,"payload":{"type":"hello-ok", ... }}
[2026-03-20 12:50:51.840] [INFO] Node registered successfully! ID: 52be65c247513a6a
[2026-03-20 12:50:51.841] [INFO] Not yet paired - check 'openclaw devices list' for pending approval
[2026-03-20 12:50:51.841] [INFO] To approve, run: openclaw devices approve 52be65c247513a6a1f173f6538534971e531fa10bad593648a8192b2dcd736d0
[2026-03-20 12:50:51.842] [INFO] Pairing status changed: Pending (device: 52be65c247513a6a...)
[2026-03-20 12:50:51.842] [INFO] Pairing status: Pending
[2026-03-20 12:50:51.842] [INFO] [ActivityStream] Item added: [node] Node pairing pending
[2026-03-20 12:50:51.870] [INFO] Node status changed: Connected
[2026-03-20 12:50:51.870] [INFO] Node status: Connected
[2026-03-20 12:50:51.871] [INFO] [ActivityStream] Item added: [node] Node mode Connected

This is the incorrect behavior:

  • the gateway accepted the connection
  • the node became connected
  • but the tray still treated the node as pending approval

Local device state still has no stored token:

{
  "DeviceToken": null
}

File:
C:\Users\andye\AppData\Local\OpenClawTray\device-key-ed25519.json

Why this matters

This creates ambiguity for node clients:

  • the gateway treats the device as approved and usable
  • the client never receives a durable device token
  • clients that assume deviceToken is required for pairing state end up in a false broken/unknown state

In our testing, node functionality still works after approval, including node requests such as system.notify, so this looks like either:

  • the docs are stale and deviceToken is now optional for approved WS node flows, or
  • the gateway is no longer returning a token that it still nominally promises to clients

Activity

  1. github-actions commented on Mar 21, 2026

    @github-actions
    Contributor

    🤖 This is an automated response from Repo Assist.

    Thanks for the detailed write-up, @andyeskridge! And great that you already have a PR ready — PR #80 addresses exactly this.

    Root cause summary: The tray's pairing state machine relied on auth.deviceToken being present in hello-ok to consider a node "paired". When the gateway omits the token (which appears to be current behaviour for approved WS nodes), the client never transitions out of "Pending" — even though the node is fully functional.

    What PR #80 does: It decouples pairing state from token presence. An approved hello-ok (i.e., no NOT_PAIRED response) is now treated as "paired" regardless of whether auth.deviceToken is included. The NOT_PAIRED response becomes the explicit signal for "user action required".

    The diagnostics in the issue log match this exactly — Connected and Pending were both true simultaneously, which is the inconsistency PR #80 resolves.

    Worth noting: the docs for the gateway protocol may need a follow-up update to clarify that deviceToken is optional for approved WS nodes — but that's a separate concern from this client-side fix.

    Happy to see this get reviewed — it's a solid fix.

    Generated by Repo Assist · ◷

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64
    
  2. added
    bug
    on Mar 21, 2026
  3. shanselman commented on Apr 1, 2026

    @shanselman
    Collaborator

    The Windows client is now resilient to hello-ok responses that omit deviceToken — the client stores the token if present but works fine without it. PR #117 (merged) added device identity + reconnect hardening that covers this scenario. PR #109 fixed the double-fire pairing event issue.

    The underlying gateway behavior (not returning deviceToken for approved devices) may still warrant a server-side fix, but the client handles it gracefully now.

  4. locked as resolved and limited conversation to collaborators on May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions