Repository navigation
Description
[Bug]: Windows Tray regenerates device identity on every reboot, requiring re-pairing each time
Summary
After every system reboot, the OpenClaw Windows Tray (v0.6.12) generates a new device keypair instead of reusing the persisted one in AppData\Roaming\OpenClawTray\gateways\{id}\device-key-ed25519.json. This causes a new deviceId, which the gateway doesn't recognize → triggers a re-pairing flow every single boot.
Environment
- OpenClaw Gateway: v2026.7.1-2
- OpenClaw Tray: v0.6.12 (WinUI 3 companion app)
- OS: Windows 11 (Build 26200)
- Setup: Gateway + Node on same machine (localhost,
ws://127.0.0.1:18789) - Gateway mode: local, token auth
Steps to Reproduce
- Pair the Windows Node through the Tray app
- Reboot the computer
- After reboot, check
openclaw nodes list
Actual Behavior
Every reboot creates a brand new node entry with a different nodeId:
# Reboot 1: nodeId = f6f52b38...
# Reboot 2: nodeId = 43ea1d7e...
# Reboot 3: nodeId = f1985d41...
# Reboot 4: nodeId = dcafbd90...
# Reboot 5: nodeId = 1ebcfe09...
Evidence from Tray logs showing the handshake flow on each boot:
[HANDSHAKE] isBootstrap=False, hasNodeDeviceToken=[REDACTED]
→ device.pair.requested (reason: "role-upgrade")
→ error: "pairing required: device is asking for a higher role than currently approved"
→ node.pair.requested
→ auto-approve cron approves → Paired!
The device-key-ed25519.json file is overwritten with a brand new keypair on each startup (file creation time matches boot time).
Meanwhile, C:\Users\{user}\.openclaw\nodes\paired.json accumulates stale entries — one per reboot.
Expected Behavior
- Tray should load the existing
device-key-ed25519.jsonon startup - Same
deviceIdshould persist across reboots - Gateway should recognize the device and skip re-pairing
Root Cause Analysis
The Tray app appears to generate a new Ed25519 keypair on every startup instead of checking if device-key-ed25519.json already exists and loading it. The persistent file at AppData\Roaming\OpenClawTray\gateways\{gatewayId}\device-key-ed25519.json gets overwritten each time.
The auto-approve cron workaround handles the re-pairing automatically, so the node eventually works — but this creates unnecessary pairing entries, a ~60 second gap on boot, and is a fundamentally broken identity persistence model.
Additional Context
- macOS/Linux nodes don't have this issue — identity persists correctly
devices/paired.jsonon the gateway side also only retains the latest entry, suggesting the gateway side also doesn't handle device identity churn gracefully- The
gatewayIddirectory name (94356bcb-...) is stable across reboots, ruling out a directory path issue
Workaround
Set up an auto-approve cron that runs every 30 seconds to catch the pending pairing request. This masks the symptom but doesn't fix the root cause.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsChannels
Activity
clawsweeper commentedon Jul 20, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 20, 2026, 2:22 AM ET / 06:22 UTC.
Summary
This should remain open: repeated device-identity rotation would break the established pairing contract, but the current report has not yet been reproduced against current main and the nearby closed torn-write report does not establish the same trigger.
Reproducibility: no. The report supplies a credible Windows reboot sequence and logs from v0.6.12, but there is not yet a verified current-main reproduction showing the key file changes across a controlled restart.
Ways to help us reproduce this
Next step
A maintainer should first confirm the exact current-main reboot-time mutation or load failure because this path handles persistent device credentials and overlaps only partially with the prior torn-write report.
Security
Needs attention: The report concerns persistence of a device private-key identity and repeated authentication re-enrollment; the exact current-main failure path needs confirmation before a security-sensitive repair is chosen.
Review details
Best possible solution:
Add a focused Windows regression that pairs once, restarts the Tray process, and proves the key fingerprint and device ID remain stable; then route every identity-file mutation and recovery decision through one atomic, non-destructive persistence contract.
Do we have a high-confidence way to reproduce the issue?
No. The report supplies a credible Windows reboot sequence and logs from v0.6.12, but there is not yet a verified current-main reproduction showing the key file changes across a controlled restart.
Is this the best way to solve the issue?
Unclear. Preserving a stable per-gateway identity is the right contract, but current-main tracing and a Windows restart proof are needed before selecting whether the fault is startup loading, token clearing, rollback restore, or corrupted-file recovery.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against bd6c4bf8e575.
Label changes
Label changes:
P1: Repeated re-pairing after every reboot disrupts a real gateway/node workflow for affected Windows users.impact:security: The reported overwritten artifact is the persisted Ed25519 device private-key identity used for pairing.impact:auth-provider: The observable failure is gateway device authentication no longer recognizing the previously paired node.issue-rating: 🦪 silver shellfish: Current issue advisory state selects this label.clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.clawsweeper:needs-security-review: Current issue advisory state selects this label.Label justifications:
P1: Repeated re-pairing after every reboot disrupts a real gateway/node workflow for affected Windows users.impact:security: The reported overwritten artifact is the persisted Ed25519 device private-key identity used for pairing.impact:auth-provider: The observable failure is gateway device authentication no longer recognizing the previously paired node.Evidence reviewed
Security concerns:
A per-boot key replacement would rotate the device authentication identity and cause new enrollment requests; confirm the writer, loader, and corrupted-file recovery paths on current main before changing persisted credential handling.
Confidence: 0.74
What I checked:
docs/SETUP.md)src/OpenClaw.Connection/DeviceIdentityStore.cs:60, 87dc3dc79d7c)Likely related people:
docs/SETUP.md,src/OpenClaw.Connection/DeviceIdentityStore.cs,src/OpenClaw.Shared/DeviceIdentity.cs)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.shanselman commentedon Jul 20, 2026
Very odd, I don't see this on my systems, but this "→ error: "pairing required: device is asking for a higher role than currently approved" is interesting...taking a look...
shanselman commentedon Jul 20, 2026
@FYFran, thank you for the unusually detailed report. We traced the exact v0.6.12 tag and current main rather than assuming the filesystem timestamp proves rotation.
Current finding: this is not yet a demonstrated recent regression, but the report exposes a real longstanding fail-open hazard. DeviceIdentity.LoadExisting() has behaved this way since the identity implementation was introduced in February: if an existing device-key-ed25519.json is unreadable, malformed, missing PrivateKeyBase64, or throws during key reconstruction, it logs Failed to load device key... and immediately calls GenerateNew(), overwriting the existing identity. That behavior is identical in v0.6.12 and current main. It would work indefinitely on machines where the file is readable—as it does on our current systems—but a transient boot-time ACL/file-access/parse failure can silently rotate identity.
One important evidence nuance: token persistence writes through a temporary file plus File.Move(..., overwrite: true). On NTFS that replacement can give the JSON file a new filesystem creation timestamp even when PrivateKeyBase64, DeviceId, and the keypair were preserved. So the timestamp alone cannot distinguish token refresh from key rotation. The changing node IDs are stronger evidence because the Windows node sends its cryptographic DeviceId as
odeId, but we need to confirm the JSON's non-secret identity fields changed too.
Could you please capture the following around one reboot, without sharing PrivateKeyBase64, device tokens, gateway tokens, or other secrets?
If DeviceId/JSON CreatedAt change and the failure/generation lines appear, the repair should be non-destructive: an existing identity that cannot be loaded must never be overwritten automatically. It should fail closed (with a typed diagnostic/retry or explicit reset path), while generation remains allowed only when the file is genuinely absent. We should also add a full process-restart regression proving the identity remains stable; the existing same-directory reload test does not cover this boot-time failure mode.
askforfly commentedon Jul 23, 2026
I have the same problem, when I restart the gateway , the openclaw companion needs to re-paring.
bkudiess commentedon Jul 30, 2026
@FYFran and @askforfly, thanks for the detailed reports. We found two independent Windows issues behind the repeated pairing behavior, and both fixes are now merged into
main.device-key-ed25519.jsonis no longer silently replaced with a new key. The existing identity remains untouched and the Companion surfaces an explicit recovery error.metadata-upgradepairing caused by the previous mismatch.Existing stale Gateway pairing records are not deleted automatically because the Windows client cannot safely determine which historical records are still legitimate. These fixes prevent new stale entries from being created by the two confirmed Windows paths.
A previously paired installation may require one metadata approval when first moving to a build containing #1064. Repeated pairing on later restarts should stop. An already damaged identity cannot be restored automatically; #1065 preserves it and requires explicit reset/re-pair rather than silently overwriting it.
We’re closing this as completed on current
main. If repeated pairing still occurs on a build containing merge commits80f35d074876d8a0a0ae1136ffc72041c2be07cdandc04c5fb062385d7185a2e1a8e83d9f8ebe4c6296, please share only the Windows Companion version, Gateway version, whether the DeviceId changed, and the reported pairing reason. Do not attach identity files, private keys, or tokens.